├── COPYING ├── Makefile ├── PC_Makefile ├── README ├── app ├── ebook │ ├── Makefile │ ├── app_ebook.c │ ├── page_ebook.c │ └── page_ebook.h ├── ffmotion │ ├── Makefile │ ├── app_ffmotion.c │ ├── ffmotion.c │ ├── ffmotion.h │ ├── ffmotion_utils.c │ ├── ffmotion_utils.h │ ├── page_ffmotion.c │ └── page_ffmotion.h ├── ffmusic │ ├── Makefile │ ├── app_ffmusic.c │ ├── ffmusic.c │ ├── ffmusic.h │ ├── ffmusic_utils.c │ ├── ffmusic_utils.h │ ├── ffunc.c │ ├── ffunc.h │ ├── page_ffmusic.c │ ├── page_ffmusic.h │ ├── test_ffmuz │ └── test_ffmuz.c ├── game │ ├── Makefile │ ├── PC_Makefile │ ├── app_avenger.c │ ├── avenger.c │ ├── avenger.h │ ├── avg_mvobj.c │ ├── avg_mvobj.h │ ├── avg_sound.c │ ├── avg_sound.h │ ├── avg_utils.c │ ├── avg_utils.h │ ├── icon_collections.png │ ├── page_avenger.c │ └── page_avenger.h └── news │ ├── Makefile │ ├── app_news.c │ ├── app_news.h │ ├── juhe_news.c │ ├── juhe_news.h │ ├── page_minipanel.c │ └── page_minipanel.h ├── cpptest ├── Makefile_cpp ├── PC_Makefile_cpp ├── cpp_maketest.sh ├── cpp_pcmaketest.sh ├── e3d_animate.cpp ├── e3d_animate.h ├── e3d_glTF.cpp ├── e3d_glTF.h ├── e3d_scene.cpp ├── e3d_scene.h ├── e3d_trimesh.cpp ├── e3d_trimesh.h ├── e3d_vector.cpp ├── e3d_vector.h ├── e3d_volumes.cpp ├── e3d_volumes.h ├── test_2022.cpp ├── test_boxman.cpp ├── test_cpp.cpp ├── test_cube.cpp ├── test_juliaset.cpp ├── test_material.cpp ├── test_nav.cpp ├── test_sphere.cpp ├── test_trimesh.cpp └── test_vector.cpp ├── data ├── README ├── button.bmp ├── buttons.img ├── buttons.o ├── chrysanthemum.jpg ├── cloud.jpg ├── dict.img ├── home.jpg ├── icons.bmp ├── icons.img ├── icons_2.bmp ├── icons_2.img ├── lake.jpg ├── numbfont.img ├── openwrt.jpg ├── openwrt.png ├── sbuttons.img ├── slide.jpg ├── testfont.img ├── testfont.img_bw ├── testfont.img_gray ├── unihangroups_pinyin.dat └── unihans_pinyin.dat ├── dict.c ├── dict.h ├── dts_spidev.jpg ├── egi.c ├── egi.conf ├── egi.h ├── egi_FTcharmap.c ├── egi_FTcharmap.h ├── egi_FTsymbol.c ├── egi_FTsymbol.h ├── egi_bjp.c ├── egi_bjp.h ├── egi_btn.c ├── egi_btn.h ├── egi_color.c ├── egi_color.h ├── egi_common.h ├── egi_data.c ├── egi_debug.h ├── egi_fbdev.c ├── egi_fbdev.h ├── egi_fbgeom.c ├── egi_fbgeom.h ├── egi_gb2unicode.c ├── egi_gb2unicode.h ├── egi_gb2unicode_list.h ├── egi_gif.c ├── egi_gif.h ├── egi_image.c ├── egi_image.h ├── egi_imgbuf.h ├── egi_input.c ├── egi_input.h ├── egi_list.c ├── egi_list.h ├── egi_log.c ├── egi_log.h ├── egi_math.c ├── egi_math.h ├── egi_matrix.c ├── egi_matrix.h ├── egi_objbtn.c ├── egi_objbtn.h ├── egi_objlist.c ├── egi_objlist.h ├── egi_objtxt.c ├── egi_objtxt.h ├── egi_page.c ├── egi_page.h ├── egi_pic.c ├── egi_pic.h ├── egi_procman.c ├── egi_procman.h ├── egi_sbtn.c ├── egi_sbtn.h ├── egi_slider.c ├── egi_slider.h ├── egi_surface.c ├── egi_surface.h ├── egi_surfcontrols.c ├── egi_surfcontrols.h ├── egi_symbol.c ├── egi_symbol.h ├── egi_timer.c ├── egi_timer.h ├── egi_touch.c ├── egi_touch.h ├── egi_txt.c ├── egi_txt.h ├── egi_unihan.c ├── egi_unihan.h ├── ering ├── Makefile ├── egi_ring.c ├── egi_ring.h ├── ering_client.c └── ering_server.c ├── ffmpeg ├── Makefile ├── alsa_play.c ├── egi_ffplay.c ├── egi_ffplay.h ├── ff_utils.c ├── ff_utils.h ├── ffplay_fltloop_240x160 ├── ffplay_swsloop_170x170 ├── ffplay_swsloop_185x185 ├── filtering_video.c ├── test_decode264.c ├── test_decode264X.c ├── test_ffutils ├── test_ffutils.c └── tmp │ ├── egi_ffplay.c │ ├── egi_ffplay.c_OLD │ ├── ff_pcm.c │ ├── ff_pcm.h │ ├── ff_utils.c_1 │ ├── ffplay.h │ ├── ffplay5.c │ ├── ffplay6.c │ ├── play_ffpcm.c │ └── play_ffpcm.h ├── ffserver ├── ffcam.conf ├── ffmp3.conf ├── mp3push.sh ├── mpcam.sh └── pullmp3.sh ├── freetype ├── Makefile ├── get_sympgHeight.c ├── test_asciibook.c ├── test_freetype.c ├── test_wbook.c └── test_wchar.c ├── heweather ├── Makefile ├── he_weather.c ├── he_weather.h ├── simplessl.c ├── test_forecast.c └── test_now.c ├── install ├── 2rotate ├── autorec ├── clear_screen ├── image_test ├── jpgshow ├── mjpgshow ├── runbmp ├── showpic ├── sq_rotate ├── test_base64 ├── test_bigiot ├── test_bmpjpg ├── test_color ├── test_geom ├── test_stock ├── test_sym ├── test_weather ├── test_writetxt ├── tjpgshow ├── touch └── track ├── iot ├── Makefile ├── egi_iotclient.c └── egi_iotclient.h ├── lib ├── libegi.a ├── libegi.so ├── libegi.so.1 ├── libegi.so.1.0.0 ├── libepages.a └── libesound.a ├── neo_lcd_wiring.png ├── nnc ├── Makefile ├── actfs.c ├── actfs.h ├── digits_imgdata.h ├── nnc.c ├── nnc.h ├── nnc_digits.c ├── nnc_digits.h ├── nnc_touchdraw.c ├── params.h ├── test_digits.c ├── test_nnc.c └── test_train.c ├── old ├── Makefile_BK ├── container ├── egi_font.c ├── egi_font.dep ├── egi_font.o ├── egi_list_C ├── egi_list_H ├── fbmp_op.h ├── image_test_C ├── iot_client_C ├── jpgshow_C ├── mjpgshow_C ├── read_objimg_C ├── runbmp_C ├── tmp_app_C ├── touch1_C ├── touch_C ├── touch_btns_C ├── touch_home_C ├── touch_home_C2 ├── touch_home_C3 ├── track_area_C └── track_logo_C ├── open-gcc ├── open_ar ├── open_nm ├── open_objcopy ├── open_objdump ├── open_strip ├── page ├── Makefile ├── egi_appstock.c ├── egi_appstock.h ├── egi_pagealphb.c ├── egi_pagebook.c ├── egi_pagebook.h ├── egi_pagehome.c ├── egi_pagehome.h ├── egi_pagemplay.c ├── egi_pagemplay.h ├── egi_pageopenwrt.c ├── egi_pageopenwrt.h ├── egi_pageslide.c ├── egi_pageslide.h ├── egi_pagestock.c ├── egi_pagestock.h ├── egi_pagetest.c └── egi_pagetest.h ├── pclib ├── libegi.a ├── libegi.so ├── libegi.so.1 ├── libegi.so.1.0.0 ├── libepages.a └── libesound.a ├── png ├── Makefile ├── angel.png ├── loop_show.c ├── pngtest.c ├── pngtest.png ├── test_blend.c └── test_png.c ├── prototype.jpg ├── sound ├── Makefile ├── PC_Makefile ├── autorec.c ├── egi_pcm.c ├── egi_pcm.h ├── madplay_resample.h ├── pcm2wav.h ├── recmp3.c ├── test_minimad.c ├── test_minimad_noresample.c ├── test_pcmbuf.c ├── test_recplay.c ├── test_snd.c └── test_tone.c ├── spi.c ├── spi.h ├── spi_cs2.patch ├── sqlite ├── Makefile ├── sqlite_exec.c ├── sqlite_insert.c ├── sqlite_open.c └── sqlite_select.c ├── sys_incbin.h ├── sys_list.h ├── test ├── Makefile ├── PC_Makefile ├── PC_showpic.c ├── PC_test_aquarium.c ├── egi_HelloWorld.c ├── egi_aes256.c ├── egi_geometry.c ├── egi_sha256.c ├── egi_sndfft.c ├── egi_wifiscan.c ├── kbd_ev.c ├── maketest.sh ├── matrix_solve.c ├── pc_udpcam ├── pc_udpfile ├── pc_usbcam ├── pcmaketest.sh ├── pridata.o ├── read_conf.c ├── showpic.c ├── surf │ ├── Makefile │ ├── PC_Makefile │ ├── makeall.sh │ ├── maketest.sh │ ├── pc_makeall.sh │ ├── pcmaketest.sh │ ├── surf_alarm.c │ ├── surf_book.c │ ├── surf_editor.c │ ├── surf_madplay.c │ ├── surf_madplay.h │ ├── surf_pinyin.h │ ├── surf_tetris.c │ ├── surf_timer.c │ ├── surf_triangles.c │ ├── surf_wallpaper.c │ ├── surf_wetradio.c │ ├── surf_wifiscan.c │ ├── surfman_guider.c │ ├── test_surfman.c │ └── test_surfuser.c ├── test_Egif.c ├── test_FTsymbol.c ├── test_FTsymbol2.c ├── test_TCP.c ├── test_TouchEffect.c ├── test_UDP.c ├── test_adstouch.c ├── test_aescbc.c ├── test_aesfile.c ├── test_aquarium.c ├── test_base64.c ├── test_bigiot.c ├── test_bjp.c ├── test_bulbControl.c ├── test_cad.c ├── test_color.c ├── test_cstr.c ├── test_cstring.c ├── test_curl.c ├── test_editor.c ├── test_elf.c ├── test_emoji.c ├── test_ering.c ├── test_etouch.c ├── test_fb.c ├── test_fbbuff.c ├── test_fft.c ├── test_fifo.c ├── test_filo.c ├── test_float.c ├── test_gb2312.c ├── test_geom.c ├── test_gif.c ├── test_gif2.c ├── test_gif3.c ├── test_graph.c ├── test_helixaac.c ├── test_html.c ├── test_html2.c ├── test_http.c ├── test_http2.c ├── test_img.c ├── test_img2.c ├── test_img3.c ├── test_img4.c ├── test_img5.c ├── test_img6.c ├── test_imgdownload.c ├── test_input.c ├── test_jpgFile.c ├── test_juhe.c ├── test_kbd.c ├── test_keypad.c ├── test_loading.c ├── test_login.c ├── test_maproam.c ├── test_math.c ├── test_matrix.c ├── test_mem.c ├── test_memfd.c ├── test_menulist.c ├── test_meter.c ├── test_miniStreamPlay.c ├── test_moon.c ├── test_mouse.c ├── test_mp3tag.c ├── test_mspline.c ├── test_multGif.c ├── test_palette.c ├── test_pic.c ├── test_pinyin.c ├── test_pinyin3500.c ├── test_pngFile.c ├── test_primer.c ├── test_puzz.c ├── test_pwmdev.c ├── test_rectBTNs.c ├── test_resizeimg.c ├── test_ringbuff.c ├── test_rollmeter.c ├── test_scroll.c ├── test_scrollinput.c ├── test_sha256.c ├── test_show.c ├── test_sndfft.c ├── test_spline.c ├── test_stock.c ├── test_sym.c ├── test_tcpfile.c ├── test_time.c ├── test_timer.c ├── test_tonefft.c ├── test_touch.c ├── test_ts.c ├── test_txt.c ├── test_udpcam.c ├── test_udpfile.c ├── test_unet.c ├── test_usbcam.c ├── test_utils.c ├── test_vector.c ├── test_wbook.c ├── test_wifiscan.c ├── test_writetxt.c ├── test_xterm.c ├── test_zombie.c ├── test_zoomimg.c ├── tmp_app.c └── touchscreen_calib.c ├── utils ├── OLD_Makefile ├── egi_aes.c ├── egi_aes.h ├── egi_cstring.c ├── egi_cstring.h ├── egi_fifo.c ├── egi_fifo.h ├── egi_filo.c ├── egi_filo.h ├── egi_https.c ├── egi_https.h ├── egi_inet.c ├── egi_inet.h ├── egi_iwinfo.c ├── egi_iwinfo.h ├── egi_ringbuffer.c ├── egi_ringbuffer.h ├── egi_shmem.c ├── egi_shmem.h ├── egi_test.conf ├── egi_unet.c ├── egi_unet.h ├── egi_utils.c └── egi_utils.h ├── xpt2046.c └── xpt2046.h /PC_Makefile: -------------------------------------------------------------------------------- 1 | SRC_PATH = /home/midas-zhou/wegi 2 | 3 | #### ----- 产生文件列表 ------ 4 | SRC_FILES = $(wildcard *.c) 5 | OBJS = $(patsubst %.c, %.o, $(SRC_FILES)) 6 | SRC_UTILS_FILES = $(wildcard utils/*.c) 7 | OBJS += $(patsubst %.c, %.o, $(SRC_UTILS_FILES)) 8 | 9 | #OBJS += utils/egi_utils.o utils/egi_cstring.o utils/egi_fifo.o utils/egi_filo.o utils/egi_iwinfo.o 10 | #OBJS += utils/egi_https.o 11 | #OBJS += heweather/he_weather.o 12 | 13 | $(warning "----- OBJS:$(OBJS) -----") 14 | 15 | ##--- exclude some objs !!!BEWARE, :NO SPACE ---- 16 | OBJS := $(OBJS:utils/egi_https.o=) 17 | 18 | DEP_FILES = $(patsubst %.c,%.dep,$(SRC_FILES)) 19 | 20 | #EXTRA_OBJS = iot/egi_iotclient.o utils/egi_utils.o utils/egi_iwinfo.o utils/egi_fifo.o \ 21 | # utils/egi_filo.o utils/egi_cstring.o \ 22 | # ffmpeg/ff_pcm.o 23 | 24 | 25 | #### ----- 编译标志 ----- 26 | ## -Wall for __attribut__ 27 | CFLAGS = -I./ -I./page -I./iot -I./utils 28 | CFLAGS += -I/usr/local/include 29 | CFLAGS += -I/usr/local/include/freetype2 30 | CFLAGS += -I/usr/local/include/libpng12 31 | CFLAGS += -Wall -fPIC -O2 32 | CFLAGS += -D_GNU_SOURCE ## for O_CLOEXEC flag ## 33 | CFLAGS += -fno-stack-protector ## disable stack protector 34 | CFLAGS += -Wunused-result 35 | ## MUST enable back buffer for LETS_NOTE 36 | CFLAGS += -DENABLE_BACK_BUFFER -DLETS_NOTE 37 | 38 | #### --- for debug, put before LDFLAGS!!!! ---- 39 | #CFLAGS += -g -DEGI_DEBUG 40 | 41 | LDFLAGS += -L./pclib 42 | 43 | LIBS = -ljpeg -lm -lpthread #-ljson-c -lasound 44 | LIBS += -lfreetype -lm -lz -lbz2 45 | LIBS += -lgif 46 | LIBS += -lrt #for shm_open() shm_unlink()... 47 | 48 | #### ------ 手动设置特定目标生成规则 ------ 49 | 50 | all: shared_egilib static_egilib 51 | 52 | shared_egilib: $(OBJS) 53 | $(LD) -shared -soname libegi.so.1 -o libegi.so.1.0.0 $(OBJS) 54 | 55 | # 1. Bewear of the order of the lib and objs. 56 | # 2. Note!!! All libs here are compiled with -fPIC option. 57 | static_egilib: $(OBJS) 58 | $(AR) rcv libegi.a $(OBJS) 59 | 60 | install: libegi.so.1.0.0 libegi.a 61 | cd $(SRC_PATH) 62 | cp -rf libegi.a ./pclib/libegi.a 63 | cp -rf libegi.so.1.0.0 ./pclib/libegi.so.1.0.0 64 | ln -s -f $(SRC_PATH)/pclib/libegi.so.1.0.0 $(SRC_PATH)/pclib/libegi.so.1 65 | ln -s -f $(SRC_PATH)/pclib/libegi.so.1.0.0 $(SRC_PATH)/pclib/libegi.so 66 | rm libegi.so.1.0.0 libegi.a 67 | 68 | #### ----- 目标文件自动生成规则 ----- 69 | %:%.c $(DEP_FILES) 70 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -c -o $@ $@.c 71 | 72 | 73 | #### ----- 清除目标 ----- 74 | clean: 75 | rm -rf test_*.o libegi.so.1.0.0 libegi.a $(OBJS) $(DEP_FILES) 76 | 77 | 78 | include $(DEP_FILES) 79 | $(warning "----- %.dep: %.c -----") 80 | #### ---- 依赖文件自动生成规则 ----- 81 | %.dep: %.c 82 | @set -e; rm -f $@ 83 | @$(CC) -MM $(CFLAGS) $< > $@.123 84 | @sed 's,\($*\)\.o[: ]*,\1 : ,g' < $@.123 > $@ 85 | cat $@.123 86 | 87 | 88 | #------- \1 表示第一个$(*)所代表的内容 89 | @rm -f $@.123 90 | 91 | 92 | #----- 下面这个会被执行两遍 --------- 93 | $(warning "----- end -----") 94 | 95 | #------------------------------------------------------------------------------------------- 96 | # 97 | # 自动依赖的例子: 98 | # midas-zhou@midas-hp:~/apptest$ gcc -MM fbin_r.c | sed 's,\($*\)\.o[: ]*,\1 : ,g' 99 | # fbin_r : fbin_r.c fbin.h 100 | # 101 | # gcc -M fbin_r.c 会将标准库的头文件也包括进来,用 gcc -MM 就不会了。 102 | # 103 | #------------------------------------------------------------------------------------------- 104 | -------------------------------------------------------------------------------- /app/ebook/Makefile: -------------------------------------------------------------------------------- 1 | export STAGING_DIR=/home/midas-zhou/openwrt_widora/staging_dir 2 | COMMON_USRDIR=/home/midas-zhou/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr 3 | SRC_PATH=/home/midas-zhou/Ctest/wegi 4 | 5 | CC= $(STAGING_DIR)/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc 6 | 7 | CFLAGS = -I$(COMMON_USRDIR)/include -I$(SRC_PATH) -I$(SRC_PATH)/utils -I$(SRC_PATH)/page 8 | CFLAGS += -I$(COMMON_USRDIR)/include/freetype2 9 | CFLAGS += -Wall -O2 10 | 11 | LDFLAGS += -L$(SRC_PATH)/lib -L$(COMMON_USRDIR)/lib 12 | 13 | LIBS = -lepages -lesound 14 | LIBS += -lpng -lz -lm -pthread -ljpeg -lasound 15 | LIBS += -lcurl -lssl -lcrypto -pthread 16 | LIBS += -lubox -lubus -lblobmsg_json -ljson_script -ljson-c 17 | LIBS += -lfreetype -lm -lz -lbz2 18 | 19 | APPS = app_ebook 20 | 21 | all: $(APPS) 22 | ### !!! NOTE: put '-o $@ $@.c' ahead of FLAGS and LIBS in LD !!!! 23 | 24 | app_ebook: app_ebook.c page_ebook.o 25 | $(CC) app_ebook.c $(CFLAGS) $(LDFLAGS) $(LIBS) -legi page_ebook.o -o app_ebook 26 | # $(CC) app_ebook.c $(CFLAGS) $(LDFLAGS) -Wl,-Bstatic -legi -Wl,-Bdynamic $(LIBS) page_ebook.o -o app_ebook 27 | 28 | 29 | page_ebook.o: page_ebook.c page_ebook.h 30 | $(CC) -c page_ebook.c $(CFLAGS) $(LDFLAGS) -legi $(LIBS) 31 | # $(CC) -c page_ebook.c $(CFLAGS) $(LDFLAGS) -Wl,-Bstatic -legi -Wl,-Bdynamic $(LIBS) 32 | 33 | 34 | clean: 35 | rm -rf *.o $(APPS) *.dep 36 | 37 | -------------------------------------------------------------------------------- /app/ebook/page_ebook.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -----------------------------------------------------------------*/ 8 | 9 | #ifndef __PAGE_EBOOK_H__ 10 | #define __PAGE_EBOOK_H__ 11 | 12 | #include "egi.h" 13 | 14 | EGI_PAGE *create_ebook_page(void); 15 | void free_ebook_page(void); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /app/ffmotion/Makefile: -------------------------------------------------------------------------------- 1 | export STAGING_DIR=/home/midas-zhou/openwrt_widora/staging_dir 2 | COMMON_USRDIR=/home/midas-zhou/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr 3 | SRC_PATH=/home/midas-zhou/Ctest/wegi 4 | 5 | #### ----- 产生文件列表 ------ 6 | SRC_FILES = $(wildcard *.c) 7 | OBJS = $(patsubst %.c, %.o, $(SRC_FILES)) 8 | DEP_FILES = $(patsubst %.c,%.dep,$(SRC_FILES)) 9 | 10 | CC= $(STAGING_DIR)/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc 11 | 12 | CFLAGS = -I$(COMMON_USRDIR)/include -I$(SRC_PATH) -I$(SRC_PATH)/utils/ -I$(SRC_PATH)/page/ -I$(SRC_PATH)/ffmpeg/ 13 | CFLAGS += -I/home/midas-zhou/ffmpeg-2.8.15/finish/include 14 | CFLAGS += -I$(COMMON_USRDIR)/include/freetype2 15 | CFLAGS += -Wall -O2 16 | 17 | LDFLAGS += -L$(SRC_PATH)/lib -L$(COMMON_USRDIR)/lib 18 | LDFLAGS += -L/home/midas-zhou/ffmpeg-2.8.15/finish/lib 19 | 20 | LIBS = -lepages -lesound 21 | #LIBS += -legi 22 | LIBS += -lpng -lz -lm -pthread -ljpeg -lasound 23 | LIBS += -lcurl -lssl -lcrypto -pthread 24 | LIBS += -lubox -lubus -lblobmsg_json -ljson_script -ljson-c 25 | LIBS += -lavutil -lswscale -lavcodec -lavformat -lswresample -lavfilter -lpostproc 26 | LIBS += -lfreetype -lm -lz -lbz2 27 | 28 | #--- use static or dynamic libs ----- 29 | EGILIB=dynamic 30 | 31 | 32 | #---!!! OBJS will be made and cleaned !!!--- 33 | #OBJS = page_ffmusic.o $(SRC_PATH)/ffmpeg/egi_ffplay.o $(SRC_PATH)/ffmpeg/ff_utils.o $(SRC_PATH)/sound/egi_pcm.o 34 | APPS = app_ffmotion 35 | 36 | all: $(APPS) 37 | ### !!! NOTE: put '-o $@ $@.c' ahead of FLAGS and LIBS in LD !!!! 38 | 39 | app_ffmotion: app_ffmotion.c $(OBJS) 40 | ### Use dynamic or static egi_libs 41 | ifeq ($(EGILIB),static) 42 | $(CC) $(OBJS) -o app_ffmotion $(CFLAGS) $(LDFLAGS) $(LIBS) -Wl,-Bdynamic $(LIBS) \ 43 | -Wl,-Bstatic -legi -Wl,-Bdynamic 44 | else 45 | $(CC) $(OBJS) -o app_ffmotion $(CFLAGS) $(LDFLAGS) $(LIBS) -legi 46 | endif 47 | 48 | #page_ffmusic.o: page_ffmusic.c page_ffmusic.h 49 | # $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -legi -c page_ffmusic.c 50 | 51 | 52 | #### ----- 目标文件自动生成规则 ----- 53 | %:%.c $(DEP_FILES) 54 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -c -o $@ $@.c 55 | 56 | 57 | #### ---- 依赖文件自动生成规则 ----- 58 | include $(DEP_FILES) 59 | $(warning "----- %.dep: %.c -----") 60 | %.dep: %.c 61 | @set -e; rm -f $@ 62 | @$(CC) -MM $(CFLAGS) $< > $@.123 63 | @sed 's,\($*\)\.o[: ]*,\1 : ,g' < $@.123 > $@ 64 | cat $@.123 65 | #------- \1 表示第一个$(*)所代表的内容 66 | @rm -f $@.123 67 | 68 | clean: 69 | rm -rf *.o $(APPS) *.dep $(OBJS) 70 | 71 | -------------------------------------------------------------------------------- /app/ffmotion/ffmotion_utils.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | Note: 8 | Never forget why you start! ---Just For Fun! 9 | 10 | TODO: 11 | 1. Use a new FB_DEV to display subtitle. or it rises a race condition 12 | for the FB dev. 13 | 2. 14 | 15 | Midas_Zhou 16 | ----------------------------------------------------------------------*/ 17 | #ifndef __FFMOTION_UTILS_H__ 18 | #define __FFMOTION_UTILS_H__ 19 | 20 | #include 21 | #include "egi_bjp.h" 22 | #include "egi.h" 23 | #include "egi_timer.h" 24 | #include "ffmotion.h" 25 | #include "libavcodec/avcodec.h" 26 | 27 | //#define LCD_MAX_WIDTH 240 28 | //#define LCD_MAX_HEIGHT 320 29 | //#define FFPLAY_MUSIC_PATH "/mmc/" 30 | 31 | /* in seconds, playing time elapsed for Video */ 32 | extern int ff_sec_Velapsed; 33 | extern int ff_sub_delays; /* delay sub display in seconds, relating to ff_sec_Velapsed */ 34 | extern enum ffmotion_cmd control_cmd; 35 | 36 | extern FFMOTION_CONTEXT *FFmotion_Ctx; 37 | extern FBDEV ff_fb_dev; 38 | 39 | //#define MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48KHz 32bit audio 40 | #define BUFF_NUM_EXPONENT 2 41 | #define PIC_BUFF_NUM (1<ebox->imgbuf */ 53 | }; 54 | 55 | extern struct ffmotion_PicInfo motPicInfo; 56 | 57 | 58 | /* check if it's image */ 59 | #define IS_IMAGE_CODEC(vcodecID) ( vcodecID == AV_CODEC_ID_MJPEG || vcodecID == AV_CODEC_ID_BMP || \ 60 | vcodecID == AV_CODEC_ID_MJPEGB || vcodecID == AV_CODEC_ID_PNG || \ 61 | vcodecID == AV_CODEC_ID_JPEG2000 || vcodecID == AV_CODEC_ID_GIF || \ 62 | vcodecID == AV_CODEC_ID_TIFF || vcodecID == AV_CODEC_ID_GIF || \ 63 | vcodecID == AV_CODEC_ID_LJPEG || vcodecID == AV_CODEC_ID_JPEGLS ) 64 | 65 | /* functions */ 66 | int init_ffmotionCtx(char *fext); 67 | void free_ffmotionCtx(void); 68 | uint8_t** malloc_PicBuffs(int pic_size, int pixel_size ); 69 | int load_Pic2Buff(struct ffmotion_PicInfo *ppic,const uint8_t *data, int numBytes); 70 | void* thdf_Display_motionPic(void * argv); 71 | void* thdf_Display_Subtitle(void * argv); 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /app/ffmotion/page_ffmotion.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -----------------------------------------------------------------*/ 8 | 9 | #ifndef __PAGE_FFMOTION_H__ 10 | #define __PAGE_FFMOTION_H__ 11 | 12 | #define TIME_SLIDER_ID 100 13 | #define TIME_TXT0_ID 101 14 | #define TIME_TXT1_ID 102 15 | 16 | EGI_PAGE *create_ffmotionPage(void); 17 | void free_ffmotionPage(void); 18 | void motpage_update_timingBar(int tm_elapsed, int tm_duration ); 19 | void motpage_update_title(const unsigned char *title); 20 | void motpage_rotate(unsigned char pos); 21 | #endif 22 | -------------------------------------------------------------------------------- /app/ffmusic/Makefile: -------------------------------------------------------------------------------- 1 | export STAGING_DIR=/home/midas-zhou/openwrt_widora/staging_dir 2 | COMMON_USRDIR=/home/midas-zhou/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr 3 | SRC_PATH=/home/midas-zhou/Ctest/wegi 4 | 5 | CC= $(STAGING_DIR)/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc 6 | 7 | #### ----- 产生文件列表 ------ 8 | SRC_FILES = $(wildcard *.c) 9 | OBJS = $(patsubst %.c, %.o, $(SRC_FILES)) 10 | DEP_FILES = $(patsubst %.c,%.dep,$(SRC_FILES)) 11 | 12 | ##--- exclude some objs !!!BEWARE, :NO SPACE ---- 13 | OBJS := $(OBJS:test_ffmuz.o=) 14 | OBJS := $(OBJS:app_ffmusic.o=) 15 | 16 | CFLAGS = -I$(COMMON_USRDIR)/include -I$(SRC_PATH) -I$(SRC_PATH)/utils/ -I$(SRC_PATH)/page/ -I$(SRC_PATH)/ffmpeg/ 17 | CFLAGS += -I/home/midas-zhou/ffmpeg-2.8.15/finish/include 18 | CFLAGS += -I$(COMMON_USRDIR)/include/freetype2 19 | CFLAGS += -Wall -O2 20 | 21 | LDFLAGS += -L$(SRC_PATH)/lib -L$(COMMON_USRDIR)/lib 22 | LDFLAGS += -L/home/midas-zhou/ffmpeg-2.8.15/finish/lib 23 | 24 | LIBS = -lepages -lesound -lsndfile #-legi 25 | LIBS += -lpng -lz -lm -pthread -ljpeg -lasound 26 | LIBS += -lcurl -lssl -lcrypto -pthread 27 | LIBS += -lubox -lubus -lblobmsg_json -ljson_script -ljson-c 28 | LIBS += -lavutil -lswscale -lavcodec -lavformat -lswresample -lavfilter -lpostproc 29 | LIBS += -lfreetype -lm -lz -lbz2 30 | 31 | #--- use static or dynamic libs ----- 32 | EGILIB=dynamic 33 | 34 | 35 | #---!!! OBJS will be made and cleaned !!!--- 36 | #OBJS = page_ffmusic.o $(SRC_PATH)/ffmpeg/egi_ffplay.o $(SRC_PATH)/ffmpeg/ff_utils.o $(SRC_PATH)/sound/egi_pcm.o 37 | APPS = app_ffmusic 38 | 39 | 40 | all: $(APPS) 41 | ### !!! NOTE: put '-o $@ $@.c' ahead of FLAGS and LIBS in LD !!!! 42 | 43 | app_ffmusic: app_ffmusic.c $(OBJS) 44 | ### Use dynamic or static egi_libs 45 | ifeq ($(EGILIB),static) 46 | $(CC) $(OBJS) -o app_ffmusic $(CFLAGS) $(LDFLAGS) $(LIBS) -Wl,-Bdynamic $(LIBS) \ 47 | -Wl,-Bstatic -legi -Wl,-Bdynamic 48 | else 49 | $(CC) $(OBJS) -o app_ffmusic $(CFLAGS) $(LDFLAGS) $(LIBS) -legi #Sequence! 50 | endif 51 | 52 | 53 | 54 | test_ffmuz: test_ffmuz.c $(OBJS) test_ffmuz.o 55 | ifeq ($(EGILIB),static) 56 | $(CC) $(OBJS) test_ffmuz.o -o test_ffmuz $(CFLAGS) $(LDFLAGS) -Wl,-Bdynamic $(LIBS) \ 57 | -Wl,-Bstatic -legi -Wl,-Bdynamic 58 | else 59 | $(CC) $(OBJS) test_ffmuz.o -o test_ffmuz $(CFLAGS) $(LDFLAGS) $(LIBS) -legi 60 | endif 61 | 62 | 63 | 64 | #page_ffmusic.o: page_ffmusic.c page_ffmusic.h 65 | # $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -legi -c page_ffmusic.c 66 | 67 | 68 | #### ----- 目标文件自动生成规则 ----- 69 | %:%.c $(DEP_FILES) 70 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -c -o $@ $@.c 71 | 72 | 73 | #### ---- 依赖文件自动生成规则 ----- 74 | include $(DEP_FILES) 75 | $(warning "----- %.dep: %.c -----") 76 | %.dep: %.c 77 | @set -e; rm -f $@ 78 | @$(CC) -MM $(CFLAGS) $< > $@.123 79 | @sed 's,\($*\)\.o[: ]*,\1 : ,g' < $@.123 > $@ 80 | cat $@.123 81 | #------- \1 表示第一个$(*)所代表的内容 82 | @rm -f $@.123 83 | 84 | clean: 85 | rm -rf *.o $(APPS) *.dep $(OBJS) 86 | 87 | -------------------------------------------------------------------------------- /app/ffmusic/ffmusic_utils.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | Note: 8 | Never forget why you start! ---Just For Fun! 9 | 10 | TODO: 11 | 1. Use a new FB_DEV to display subtitle. or it rises a race condition 12 | for the FB dev. 13 | 2. 14 | 15 | Midas_Zhou 16 | ----------------------------------------------------------------------*/ 17 | #ifndef __FFMUSIC_UTILS_H__ 18 | #define __FFMUSIC_UTILS_H__ 19 | 20 | #include 21 | #include "egi_bjp.h" 22 | #include "egi.h" 23 | #include "egi_timer.h" 24 | #include "ffmusic.h" 25 | #include "libavcodec/avcodec.h" 26 | 27 | #define LCD_MAX_WIDTH 240 28 | #define LCD_MAX_HEIGHT 320 29 | //#define FFPLAY_MUSIC_PATH "/mmc/" 30 | 31 | /* in seconds, playing time elapsed for Video */ 32 | //extern int ff_sec_Velapsed; 33 | extern int ff_sub_delays; /* delay sub display in seconds, relating to ff_sec_Velapsed */ 34 | extern enum ffmuz_cmd control_cmd; 35 | 36 | extern FFMUSIC_CONTEXT *FFmuz_Ctx; 37 | extern FBDEV ff_fb_dev; 38 | 39 | //#define MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48KHz 32bit audio 40 | #define BUFF_NUM_EXPONENT 2 41 | #define PIC_BUFF_NUM (1<ebox->imgbuf */ 56 | }; 57 | 58 | /* check if it's image */ 59 | #define IS_IMAGE_CODEC(vcodecID) ( vcodecID == AV_CODEC_ID_MJPEG || vcodecID == AV_CODEC_ID_BMP || \ 60 | vcodecID == AV_CODEC_ID_MJPEGB || vcodecID == AV_CODEC_ID_PNG || \ 61 | vcodecID == AV_CODEC_ID_JPEG2000 || vcodecID == AV_CODEC_ID_GIF || \ 62 | vcodecID == AV_CODEC_ID_TIFF || vcodecID == AV_CODEC_ID_GIF || \ 63 | vcodecID == AV_CODEC_ID_LJPEG || vcodecID == AV_CODEC_ID_JPEGLS ) 64 | 65 | 66 | 67 | /* functions */ 68 | int init_ffmuzCtx(char *path, char *fext); 69 | void free_ffmuzCtx(void); 70 | uint8_t** ff_malloc_PICbuffs(int width, int height, int pixel_size ); 71 | //static void ff_free_PicBuffs(void); 72 | int ff_load_Pic2Buff(struct PicInfo *ppic,const uint8_t *data, int numBytes); 73 | void* display_MusicPic(void * argv); 74 | void* thdf_Display_Subtitle(void * argv); 75 | //static long seek_Subtitle_TmStamp(char *subpath, unsigned int tmsec); 76 | void ff_load_FFTdata(void ** buffer, int nf); 77 | void* ff_display_spectrum(void *argv); 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /app/ffmusic/ffunc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ffunc.h" 4 | 5 | void muzpage_update_title(const unsigned char *title) 6 | { 7 | return; 8 | } 9 | 10 | void muzpage_update_timingBar(int tm_elapsed, int tm_duration ) 11 | { 12 | return; 13 | } 14 | -------------------------------------------------------------------------------- /app/ffmusic/ffunc.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #ifndef __FFUNC_H__ 5 | #define __FFUNC_H__ 6 | 7 | extern void muzpage_update_title(const unsigned char *title); 8 | extern void muzpage_update_timingBar(int tm_elapsed, int tm_duration ); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /app/ffmusic/page_ffmusic.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -----------------------------------------------------------------*/ 8 | 9 | #ifndef __PAGE_FFMUSIC_H__ 10 | #define __PAGE_FFMUSIC_H__ 11 | 12 | #include "egi.h" 13 | 14 | #define TIME_SLIDER_ID 100 15 | #define TIME_TXT0_ID 101 16 | #define TIME_TXT1_ID 102 17 | 18 | extern EGI_PAGE *create_ffmuzPage(void); 19 | extern void free_ffmuzPage(void); 20 | extern void muzpage_update_title(const unsigned char *title)__attribute__((weak)); 21 | extern void muzpage_update_timingBar(int tm_elapsed, int tm_duration )__attribute__((weak)); 22 | 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /app/ffmusic/test_ffmuz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/app/ffmusic/test_ffmuz -------------------------------------------------------------------------------- /app/ffmusic/test_ffmuz.c: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | A test program for ffmusic 7 | 8 | Usage: test_ffmuz audio_file 9 | Example: test_ffmuz /music/*.mp3 10 | 11 | Midas Zhou 12 | midaszhou@yahoo.com 13 | -------------------------------------------------------------------*/ 14 | #include 15 | #include 16 | #include 17 | #include "page_ffmusic.h" 18 | #include "ffmusic_utils.h" 19 | #include "ffmusic.h" 20 | 21 | int main(int argc, char **argv) 22 | { 23 | // char* mypath; 24 | 25 | if(argc<2){ 26 | fprintf(stderr, "Usage: %s file\n", argv[0]); 27 | return -1; 28 | } 29 | // mypath=strdup(argv[1]); 30 | 31 | // FFMUSIC_CONTEXT myFFmuzCtx={ .ftotal=1, .fpath=&mypath, .ffmode=mode_play_once }; 32 | FFMUSIC_CONTEXT myFFmuzCtx={ .ftotal=argc-1, .fpath=argv+1, .ffmode=mode_play_once }; 33 | FFmuz_Ctx=&myFFmuzCtx; 34 | 35 | thread_ffplay_music(NULL); 36 | 37 | // free(mypath); 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /app/game/Makefile: -------------------------------------------------------------------------------- 1 | export STAGING_DIR=/home/midas-zhou/openwrt_widora/staging_dir 2 | COMMON_USRDIR=/home/midas-zhou/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr 3 | SRC_PATH=/home/midas-zhou/Ctest/wegi 4 | 5 | #### ----- 产生文件列表 ------ 6 | SRC_FILES = $(wildcard *.c) 7 | OBJS = $(patsubst %.c, %.o, $(SRC_FILES)) 8 | DEP_FILES = $(patsubst %.c,%.dep,$(SRC_FILES)) 9 | 10 | CC= $(STAGING_DIR)/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc 11 | 12 | CFLAGS = -I$(COMMON_USRDIR)/include -I$(SRC_PATH) -I$(SRC_PATH)/sound -I$(SRC_PATH)/utils -I$(SRC_PATH)/page 13 | CFLAGS += -I$(COMMON_USRDIR)/include/freetype2 14 | CFLAGS += -Wall -O2 15 | 16 | LDFLAGS += -L$(SRC_PATH)/lib -L$(COMMON_USRDIR)/lib 17 | 18 | LIBS = -lepages -lesound -lsndfile 19 | #LIBS += -legi 20 | LIBS += -lpng -lz -lm -pthread -ljpeg -lasound 21 | LIBS += -lcurl -lssl -lcrypto -pthread 22 | LIBS += -lubox -lubus -lblobmsg_json -ljson_script -ljson-c 23 | LIBS += -lfreetype -lm -lz -lbz2 24 | 25 | #--- use static or dynamic libs ----- 26 | EGILIB=dynamic 27 | 28 | #---!!! OBJS will be made and cleaned !!!--- 29 | #OBJS = page_ffmusic.o $(SRC_PATH)/ffmpeg/egi_ffplay.o $(SRC_PATH)/ffmpeg/ff_utils.o $(SRC_PATH)/sound/egi_pcm.o 30 | APPS = app_avenger 31 | 32 | all: $(APPS) 33 | ### !!! NOTE: put '-o $@ $@.c' ahead of FLAGS and LIBS in LD !!!! 34 | 35 | app_avenger: app_avenger.c $(OBJS) 36 | ### Use dynamic or static egi_libs 37 | ifeq ($(EGILIB),static) 38 | $(CC) $(OBJS) -o app_avenger $(CFLAGS) $(LDFLAGS) $(LIBS) -Wl,-Bdynamic $(LIBS) \ 39 | -Wl,-Bstatic -legi -Wl,-Bdynamic 40 | else 41 | $(CC) $(OBJS) -o app_avenger $(CFLAGS) $(LDFLAGS) $(LIBS) -legi 42 | endif 43 | 44 | #page_ffmusic.o: page_ffmusic.c page_ffmusic.h 45 | # $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -legi -c page_ffmusic.c 46 | 47 | 48 | #### ----- 目标文件自动生成规则 ----- 49 | %:%.c $(DEP_FILES) 50 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -c -o $@ $@.c 51 | 52 | 53 | #### ---- 依赖文件自动生成规则 ----- 54 | include $(DEP_FILES) 55 | $(warning "----- %.dep: %.c -----") 56 | %.dep: %.c 57 | @set -e; rm -f $@ 58 | @$(CC) -MM $(CFLAGS) $< > $@.123 59 | @sed 's,\($*\)\.o[: ]*,\1 : ,g' < $@.123 > $@ 60 | cat $@.123 61 | #------- \1 表示第一个$(*)所代表的内容 62 | @rm -f $@.123 63 | 64 | clean: 65 | rm -rf *.o $(APPS) *.dep $(OBJS) 66 | 67 | -------------------------------------------------------------------------------- /app/game/PC_Makefile: -------------------------------------------------------------------------------- 1 | CC=gcc 2 | 3 | SRC_PATH=/home/midas-zhou/wegi 4 | 5 | #### ----- 产生文件列表 ------ 6 | SRC_FILES = $(wildcard *.c) 7 | OBJS = $(patsubst %.c, %.o, $(SRC_FILES)) 8 | DEP_FILES = $(patsubst %.c,%.dep,$(SRC_FILES)) 9 | 10 | CFLAGS = -I$(SRC_PATH) -I$(SRC_PATH)/sound -I$(SRC_PATH)/utils -I$(SRC_PATH)/page 11 | ## for libasound.h 12 | CFLAGS += -I/home/midas-zhou/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include 13 | CFLAGS += -I/usr/local/include/freetype2 14 | CFLAGS += -I/usr/local/include/libpng12 15 | CFLAGS += -Wall -O2 -DLETS_NOTE 16 | 17 | LDFLAGS = -L$(SRC_PATH)/pclib 18 | LDFLAGS += -L/lib 19 | LDFLAGS += -L/usr/lib/i386-linux-gnu 20 | 21 | ## for libpng12.so 22 | 23 | LIBS = -lsndfile 24 | LIBS += -lpng12 25 | LIBS += -lasound 26 | LIBS += -lz -lm -pthread -ljpeg 27 | LIBS += -lfreetype 28 | #LIBS += -legi 29 | 30 | #--- use static or dynamic libs ----- 31 | EGILIB=dynamic 32 | 33 | #---!!! OBJS will be made and cleaned !!!--- 34 | APPS = app_avenger 35 | 36 | all: $(APPS) 37 | ### !!! NOTE: put '-o $@ $@.c' ahead of FLAGS and LIBS in LD !!!! 38 | 39 | app_avenger: app_avenger.c $(OBJS) 40 | ### Use dynamic or static egi_libs 41 | ifeq ($(EGILIB),static) 42 | $(CC) -o app_avenger $(OBJS) $(CFLAGS) $(LDFLAGS) \ 43 | -Wl,-Bstatic -legi -lesound -Wl,-Bdynamic $(LIBS) 44 | else 45 | $(CC) $(CFLAGS) $(LDFLAGS) -o app_avenger $(OBJS) -legi -lesound $(LIBS) 46 | endif 47 | 48 | 49 | #### ----- 目标文件自动生成规则 ----- 50 | %:%.c $(DEP_FILES) 51 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -c -o $@ $@.c 52 | 53 | 54 | #### ---- 依赖文件自动生成规则 ----- 55 | include $(DEP_FILES) 56 | $(warning "----- %.dep: %.c -----") 57 | %.dep: %.c 58 | @set -e; rm -f $@ 59 | @$(CC) -MM $(CFLAGS) $< > $@.123 60 | @sed 's,\($*\)\.o[: ]*,\1 : ,g' < $@.123 > $@ 61 | cat $@.123 62 | #------- \1 表示第一个$(*)所代表的内容 63 | @rm -f $@.123 64 | 65 | clean: 66 | rm -rf *.o $(APPS) *.dep $(OBJS) 67 | 68 | -------------------------------------------------------------------------------- /app/game/avenger.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -------------------------------------------------------------------*/ 8 | #ifndef __AVENGER_H__ 9 | #define __AVENGER_H__ 10 | 11 | extern bool disable_avgsound; 12 | void *thread_game_avenger(EGI_PAGE *page); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /app/game/avg_mvobj.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | Midas Zhou 8 | -------------------------------------------------------------------*/ 9 | #ifndef __AVG_MVOBJ_H__ 10 | #define __AVG_MVOBJ_H__ 11 | 12 | #include "egi_common.h" 13 | #include "egi_FTsymbol.h" 14 | #include "page_avenger.h" 15 | 16 | 17 | typedef struct avg_mvobj_data AVG_MVOBJ; /* movable object */ 18 | struct avg_mvobj_data { 19 | unsigned int id; /* Identity number */ 20 | unsigned long int refcnt; /* Refresh count */ 21 | 22 | /* Icons and images */ 23 | const EGI_IMGBUF *icons; /* Icons collection */ 24 | int icon_index; /* Index of the icons for the mvobj image */ 25 | EGI_IMGBUF *refimg; /* Loaded image as for refrence */ 26 | EGI_IMGBUF *actimg; /* Image for displaying */ 27 | 28 | /* Reference station */ 29 | AVG_MVOBJ *station; /* A station, as a ref. obj to the mvobj */ 30 | 31 | /* Position, center of the mvobj */ 32 | EGI_POINT pxy; /* Current position in integer, image center hopefully.*/ 33 | float fpx; /* Coord. in float, to improve calculation precision */ 34 | float fpy; 35 | EGI_FVAL fvpx; /* Fixed point value for pxy.x */ 36 | EGI_FVAL fvpy; 37 | 38 | /* Heading & Speed */ 39 | int heading; /* Current heading, in Degree 40 | * screenY as heading 0 Degree line. 41 | * Counter_Clockwise as positive direction. 42 | * Constrain to [0, 360] 43 | */ 44 | int speed; /* Current speed, in pixles per refresh */ 45 | float fspeed; 46 | int vang; /* angular velocity, degree per refresh */ 47 | float fvang; 48 | 49 | /* Trail mode */ 50 | int (*trail_mode)(AVG_MVOBJ *); /* Method to refresh trail 51 | * Jobs: 52 | * 1. Update params(positon/heading/vang...) of the mvobj. 53 | * 2. Check if its out of visible region. then renew the 54 | * mvobj or destroy it. 55 | * 3. Update actimg and/or refimg. 56 | */ 57 | 58 | /* Renew mode */ 59 | int (*renew_method)(AVG_MVOBJ *); /* Method to renew a mvobj 60 | * 1. Reset necessary parameters. 61 | * 2. Reset refimg and/or actimg. 62 | */ 63 | 64 | /* For hit effect */ 65 | int (*hit_effect)(AVG_MVOBJ *); /* Method to display effect for an hit/damaged mvobj */ 66 | bool is_hit; /* Whether it's hit */ 67 | int effect_index; /* Effect image index of icons, starting index of a serial subimages */ 68 | int effect_stages; /* Total number of special effect subimages in icons, 69 | * after it's hit/damaged. 70 | */ 71 | int stage; /* current exploding image index, from 0 to effect_stages-1 */ 72 | }; 73 | 74 | /* FUNCTIONS */ 75 | AVG_MVOBJ* avg_create_mvobj( EGI_IMGBUF *icons, int icon_index, 76 | EGI_POINT pxy, int heading, int speed, 77 | int (*trail_mode)(AVG_MVOBJ *) 78 | ); 79 | 80 | void avg_destroy_mvobj(AVG_MVOBJ **mvobj); 81 | 82 | int avg_effect_exploding(AVG_MVOBJ *mvobj); 83 | 84 | int upward_trail(AVG_MVOBJ *mvobj); 85 | int plane_trail(AVG_MVOBJ *plane); 86 | int bullet_trail(AVG_MVOBJ *mvobj); 87 | int turn_trail(AVG_MVOBJ *mvobj); 88 | 89 | int avg_renew_plane(AVG_MVOBJ *plane); 90 | int avg_renew_bullet(AVG_MVOBJ *bullet); 91 | 92 | int refresh_mvobj(AVG_MVOBJ *mvobj); 93 | 94 | int avg_random_speed(void); 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /app/game/avg_sound.c: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Note: 7 | 1. To make sample rate of effect sound same as of alsa config 8 | value will improve sound mixing speed? 9 | OR a fraction of Max HW sample rate? 10 | 11 | Midas Zhou 12 | midaszhou@yahoo.com 13 | ------------------------------------------------------------------*/ 14 | #include "egi_pcm.h" 15 | 16 | static EGI_PCMBUF *pcmbuf_launch; /* Sound data for launching a missle */ 17 | static EGI_PCMBUF *pcmbuf_explode; /* Sound data for exploding */ 18 | 19 | static void * thread_sound_launch(void *arg); 20 | static void * thread_sound_explode(void *arg); 21 | 22 | 23 | /*------------------------------------ 24 | Load sound file to EGI_PCMBUFs 25 | 26 | Return: 27 | 0 OK 28 | <0 Fails 29 | ------------------------------------*/ 30 | int avg_load_sound(void) 31 | { 32 | int ret=0; 33 | 34 | /* launching sound */ 35 | #ifdef LETS_NOTE 36 | pcmbuf_launch=egi_pcmbuf_readfile("/home/midas-zhou/avenger/launch.wav"); 37 | #else 38 | pcmbuf_launch=egi_pcmbuf_readfile("/mmc/avenger/launch.wav"); 39 | #endif 40 | if(pcmbuf_launch==NULL) { 41 | printf("%s: Fail to load sound file for pcmbuf_launch.\n", __func__); 42 | ret--; 43 | } 44 | 45 | /* exploding sound */ 46 | #ifdef LETS_NOTE 47 | pcmbuf_explode=egi_pcmbuf_readfile("/home/midas-zhou/avenger/explode.wav"); 48 | #else 49 | pcmbuf_explode=egi_pcmbuf_readfile("/mmc/avenger/explode.wav"); 50 | #endif 51 | if(pcmbuf_explode==NULL) { 52 | printf("%s: Fail to load sound file for pcmbuf_explode.\n", __func__); 53 | ret--; 54 | } 55 | 56 | return ret; 57 | } 58 | 59 | 60 | /* ----------------------------------------- 61 | Sound effect for launching a missle 62 | -------------------------------------------*/ 63 | static void * thread_sound_launch(void *arg) 64 | { 65 | pthread_detach(pthread_self()); 66 | 67 | egi_pcmbuf_playback("default", (const EGI_PCMBUF *)pcmbuf_launch, 1024); 68 | usleep(10000); 69 | 70 | pthread_exit((void *)0); 71 | } 72 | 73 | 74 | /*------------------------------------------ 75 | Sound effect for plane exploding 76 | -------------------------------------------*/ 77 | static void * thread_sound_explode(void *arg) 78 | { 79 | pthread_detach(pthread_self()); 80 | 81 | egi_pcmbuf_playback("default", (const EGI_PCMBUF *)pcmbuf_explode, 1024); 82 | usleep(10000); 83 | 84 | pthread_exit((void *)0); 85 | } 86 | 87 | 88 | /*------------------------------------- 89 | Create thread to play launching sound 90 | --------------------------------------*/ 91 | void avg_sound_launch(void) 92 | { 93 | pthread_t thread; 94 | 95 | if( pthread_create( &thread, NULL, thread_sound_launch, NULL ) !=0 ) 96 | printf("%s:Fail to create pthread for sound launching!\n",__func__); 97 | 98 | } 99 | 100 | 101 | /*------------------------------------- 102 | Create thread to play launching sound 103 | --------------------------------------*/ 104 | void avg_sound_explode(void) 105 | { 106 | pthread_t thread; 107 | 108 | if( pthread_create( &thread, NULL, thread_sound_explode, NULL ) !=0 ) 109 | printf("%s:Fail to create pthread for sound launching!\n",__func__); 110 | 111 | } 112 | -------------------------------------------------------------------------------- /app/game/avg_sound.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | Midas Zhou 8 | midaszhou@yahoo.com 9 | ------------------------------------------------------------------*/ 10 | #ifndef __AVG_SOUND_H__ 11 | #define __AVG_SOUND_H__ 12 | 13 | int avg_load_sound(void); 14 | void avg_sound_launch(void); 15 | void avg_sound_explode(void); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /app/game/avg_utils.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | Midas Zhou 8 | -------------------------------------------------------------------*/ 9 | #ifndef __AVG_UTILS_H__ 10 | #define __AVG_UTILS_H__ 11 | 12 | //#include "egi_common.h" 13 | //#include "egi_FTsymbol.h" 14 | //#include "page_avenger.h" 15 | 16 | int avg_intAbs(int a); 17 | void game_readme(void); 18 | void game_levelUp(bool levelup, int level); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /app/game/icon_collections.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/app/game/icon_collections.png -------------------------------------------------------------------------------- /app/game/page_avenger.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -----------------------------------------------------------------*/ 8 | 9 | #ifndef __PAGE_AVENGER_H__ 10 | #define __PAGE_AVENGER_H__ 11 | 12 | EGI_PAGE *create_avengerPage(void); 13 | void avenpage_update_creditTxt(int score, int level); 14 | void free_avengerPage(void); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /app/news/Makefile: -------------------------------------------------------------------------------- 1 | export STAGING_DIR=/home/midas-zhou/openwrt_widora/staging_dir 2 | COMMON_USRDIR=/home/midas-zhou/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr 3 | 4 | SRC_PATH=/home/midas-zhou/wegi 5 | 6 | CC= $(STAGING_DIR)/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc 7 | 8 | 9 | #### ----- 产生文件列表 ------ 10 | SRC_FILES = $(wildcard *.c) 11 | OBJS = $(patsubst %.c, %.o, $(SRC_FILES)) 12 | 13 | #OBJS += heweather/he_weather.o 14 | 15 | $(warning "----- OBJS:$(OBJS) -----") 16 | 17 | ##--- exclude some objs !!!BEWARE, :NO SPACE ---- 18 | #OBJS := $(OBJS:test_color.o=) 19 | 20 | DEP_FILES = $(patsubst %.c,%.dep,$(SRC_FILES)) 21 | 22 | 23 | CFLAGS = -I$(SRC_PATH) -I$(SRC_PATH)/utils -I$(SRC_PATH)/iot -I$(SRC_PATH)/sound 24 | CFLAGS += -I$(COMMON_USRDIR)/include 25 | CFLAGS += -I$(COMMON_USRDIR)/include/freetype2 26 | CFLAGS += -I$(COMMON_USRDIR)/include/json-c 27 | 28 | #-I$(SRC_PATH)/page 29 | CFLAGS += -Wall -O2 30 | CFLAGS += -D_GNU_SOURCE 31 | CFLAGS += -DENABLE_BACK_BUFFER 32 | 33 | LDFLAGS += -L$(SRC_PATH)/lib -L$(COMMON_USRDIR)/lib 34 | 35 | LIBS = -lepages 36 | LIBS += -lesound 37 | LIBS += -lpng -lz -lm -pthread -ljpeg -lasound -lsndfile 38 | LIBS += -lcurl -lssl -lcrypto -pthread 39 | LIBS += -lubox -lubus -lblobmsg_json -ljson_script -ljson-c 40 | LIBS += -lfreetype -lm -lz -lbz2 41 | LIBS += -lgif 42 | 43 | APP_NAME = app_juhe 44 | 45 | #--- use static or dynamic libs ----- 46 | EGILIB=dynamic 47 | 48 | #### --- use dynamic and static libs in compilatoin!!! --- 49 | # 1. Exclude dynamic -legi first. 50 | # 2. Use -Wl,Bdynamic and -Wl,Bstatic to switch to dynamic/static libs 51 | # 3. At last, we must switch back to dynamic libs, as default for Linux system runtime setup. 52 | # 4. Source/obj files must be put before all -Wl. 53 | 54 | #all: $(APPS) 55 | 56 | $(APP_NAME): $(OBJS) $(DEP_FILES) 57 | ifeq ($(EGILIB),static) 58 | $(CC) $(OBJS) -o $(APP_NAME) $(CFLAGS) $(LDFLAGS) -Wl,-Bdynamic $(LIBS) \ 59 | -Wl,-Bstatic -legi -lesound -Wl,-Bdynamic 60 | else 61 | $(CC) -o $(APP_NAME) $(OBJS) $(CFLAGS) $(LDFLAGS) $(LIBS) -legi -lesound 62 | endif 63 | 64 | #### ----- 目标文件自动生成规则 ----- 65 | %:%.c $(DEP_FILES) 66 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -c -o $@ $@.c 67 | 68 | 69 | include $(DEP_FILES) 70 | 71 | $(warning "----- %.dep: %.c -----") 72 | #### ---- 依赖文件自动生成规则 ----- 73 | %.dep: %.c 74 | @set -e; rm -f $@ 75 | @$(CC) -MM $(CFLAGS) $< > $@.123 ### $< 表示第一个依赖文件 $@ 当前目标文件 76 | @sed 's,\($*\)\.o[: ]*,\1 : ,g' < $@.123 > $@ 77 | # cat $@.123 78 | #------- \1 表示第一个$(*)所代表的内容 79 | @rm -f $@.123 80 | 81 | 82 | #### ----- 清除目标 ----- 83 | clean: 84 | rm -rf $(OBJS) $(APP_NAME) $(DEP_FILES) 85 | 86 | -------------------------------------------------------------------------------- /app/news/app_news.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | --------------------------------------------------------------------*/ 8 | #ifndef __APP_NEWS_H__ 9 | #define __APP_NEWS_H__ 10 | 11 | /* ZONE divisions, --- NOTE: In LCD touch pad coord. --- */ 12 | extern EGI_BOX text_box; /* Text display zone */ 13 | extern EGI_BOX right_box; 14 | extern EGI_BOX left_box; 15 | extern EGI_BOX title_box; /* Title display zone */ 16 | extern EGI_BOX minipanel_box; /* Mini panel zone */ 17 | 18 | #endif 19 | 20 | -------------------------------------------------------------------------------- /app/news/juhe_news.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -----------------------------------------------------------------------*/ 8 | #ifndef __JUHE_NEWS_H__ 9 | #define __JUHE_NEWS_H__ 10 | #include 11 | #include 12 | #include 13 | #include "egi_filo.h" 14 | 15 | /* Callback functions for libcurl API */ 16 | size_t curlget_callback(void *ptr, size_t size, size_t nmemb, void *userp); 17 | size_t download_callback(void *ptr, size_t size, size_t nmemb, void *stream); 18 | 19 | /* Functions */ 20 | int juhe_get_errorCode(const char *strinput); 21 | int juhe_get_totalItemNum(const char *strinput); 22 | char* juhe_dupGet_elemValue(const char *strinput, int index, const char *strkey); 23 | EGI_FILO* juhe_get_newsFilo(const char* url); 24 | void print_json_object(const json_object *json); 25 | int juhe_save_charBuff(const char *fpath, const char *buff); 26 | int juhe_fill_charBuff(const char *fpath, char *buff, int size); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /app/news/page_minipanel.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -----------------------------------------------------------------*/ 8 | #ifndef __PAGE_MINIPANEL_H__ 9 | #define __PAGE_MINIPANEL_H__ 10 | 11 | //EGI_PAGE *create_panelPage(void); 12 | int create_miniPanel(void); 13 | int miniPanel_routine(void); 14 | int free_miniPanel(void); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /cpptest/cpp_maketest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | make -f Makefile_cpp test_cpp TEST_NAME=$1 EGILIB=static 4 | -------------------------------------------------------------------------------- /cpptest/cpp_pcmaketest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | make -f PC_Makefile_cpp test_cpp TEST_NAME=$1 EGILIB=static 4 | -------------------------------------------------------------------------------- /data/README: -------------------------------------------------------------------------------- 1 | --- Symbol Page Image File --- 2 | 3 | buttons.img Home_page buttons 4 | icons.img Home_page head_bar icons 5 | icons_2.img Other icons 6 | numbfont.img Number symbols 7 | sbuttons.img Some small buttons for APPs 8 | testfont.img Ascii symbols 9 | unihangroups_pinyin.dat UNIHANGROUPS/Cizu 10 | unihans_pinyin.dat UNIHAN/Hanzi 11 | 12 | --- Others --- 13 | 14 | 1. lake.jpg: a landscape photo taken at the West Lake, by Midas. 15 | 2. cloud.jpg: clean sky of Zhoushan, by Midas. 16 | 3. convert a file to an obj: 17 | openwrt_objcopy -I binary -O elf32-tradlittlemips -B mips buttons.img buttons.o 18 | 19 | 20 | Midas Zhou 21 | -------------------------------------------------------------------------------- /data/button.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/button.bmp -------------------------------------------------------------------------------- /data/buttons.img: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/buttons.img -------------------------------------------------------------------------------- /data/buttons.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/buttons.o -------------------------------------------------------------------------------- /data/chrysanthemum.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/chrysanthemum.jpg -------------------------------------------------------------------------------- /data/cloud.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/cloud.jpg -------------------------------------------------------------------------------- /data/dict.img: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/dict.img -------------------------------------------------------------------------------- /data/home.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/home.jpg -------------------------------------------------------------------------------- /data/icons.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/icons.bmp -------------------------------------------------------------------------------- /data/icons.img: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/icons.img -------------------------------------------------------------------------------- /data/icons_2.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/icons_2.bmp -------------------------------------------------------------------------------- /data/icons_2.img: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/icons_2.img -------------------------------------------------------------------------------- /data/lake.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/lake.jpg -------------------------------------------------------------------------------- /data/numbfont.img: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/numbfont.img -------------------------------------------------------------------------------- /data/openwrt.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/openwrt.jpg -------------------------------------------------------------------------------- /data/openwrt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/openwrt.png -------------------------------------------------------------------------------- /data/sbuttons.img: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/sbuttons.img -------------------------------------------------------------------------------- /data/slide.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/slide.jpg -------------------------------------------------------------------------------- /data/testfont.img: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/testfont.img -------------------------------------------------------------------------------- /data/testfont.img_bw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/testfont.img_bw -------------------------------------------------------------------------------- /data/testfont.img_gray: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/testfont.img_gray -------------------------------------------------------------------------------- /data/unihangroups_pinyin.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/unihangroups_pinyin.dat -------------------------------------------------------------------------------- /data/unihans_pinyin.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/data/unihans_pinyin.dat -------------------------------------------------------------------------------- /dict.h: -------------------------------------------------------------------------------- 1 | /*----------------- !!! OBSOLETE !!! -------------------------------- 2 | ===--- This is for clock digital number only !!!! ---=== 3 | 4 | Dictionary for symbols 5 | 6 | Midas Zhou 7 | --------------------------------------------------------------------*/ 8 | #include 9 | #include 10 | #include "egi_fbgeom.h" 11 | 12 | #define DICT_IMG_WIDTH 240 13 | #define DICT_IMG_HEIGHT 320 14 | 15 | /* number of symbols in a dict */ 16 | #define DICT_NUM_LIMIT_H20W15 32 /* MAX. 16*16=256 */ 17 | 18 | /* symbols dict data */ 19 | extern uint16_t *dict_h20w15; 20 | 21 | 22 | /* ----------------- function ------------------ */ 23 | uint16_t *dict_init_h20w15(void); 24 | void dict_display_img(FBDEV *fb_dev,char *path); 25 | uint16_t *dict_load_h20w15(char *path); 26 | void dict_print_symb20x15(uint16_t *dict); 27 | void dict_writeFB_symb20x15(FBDEV *fb_dev, int blackoff, uint16_t color, \ 28 | int index, int x0, int y0); 29 | void wirteFB_str20x15(FBDEV *fb_dev, int blackoff, uint16_t color, \ 30 | char *str, int x0, int y0); 31 | void dict_release_h20w15(void); 32 | -------------------------------------------------------------------------------- /dts_spidev.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/dts_spidev.jpg -------------------------------------------------------------------------------- /egi_btn.h: -------------------------------------------------------------------------------- 1 | /*---------------- egi_btn.h-------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | egi btn tyep ebox functions 7 | 8 | Midas Zhou 9 | ------------------------------------------------------*/ 10 | #ifndef __EGI_BTN_H__ 11 | #define __EGI_BTN_H__ 12 | 13 | 14 | #include "egi.h" 15 | #include "egi_symbol.h" 16 | 17 | EGI_DATA_BTN *egi_btndata_new(int id, enum egi_btn_type shape, 18 | EGI_SYMPAGE *icon, int icon_code, 19 | EGI_SYMPAGE *font 20 | ); 21 | 22 | EGI_EBOX * egi_btnbox_new( char *tag, 23 | EGI_DATA_BTN *egi_data, 24 | bool movable, 25 | int x0, int y0, 26 | int width, int height, 27 | int frame, 28 | int prmcolor 29 | ); 30 | 31 | int egi_btnbox_activate(EGI_EBOX *ebox); 32 | int egi_btnbox_refresh(EGI_EBOX *ebox); 33 | void egi_btngroup_refresh(EGI_EBOX **ebox_group, int num); 34 | int egi_btnbox_hide(EGI_EBOX *ebox); 35 | int egi_btnbox_unhide(EGI_EBOX *ebox); 36 | void egi_free_data_btn(EGI_DATA_BTN *data_btn); 37 | int egi_btnbox_setsubcolor(EGI_EBOX *ebox, EGI_16BIT_COLOR subcolor); 38 | EGI_EBOX *egi_copy_btn_ebox(EGI_EBOX *ebox); /* Wait to be tested! */ 39 | //static void egi_btn_touch_effect(EGI_EBOX *ebox, EGI_TOUCH_DATA *touch_data); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /egi_common.h: -------------------------------------------------------------------------------- 1 | #ifndef __EGI_HEADER_H__ 2 | #define __EGI_HEADER_H__ 3 | 4 | #include "egi.h" 5 | #include "spi.h" 6 | #include "egi_page.h" 7 | #include "egi_fbdev.h" 8 | #include "egi_fbgeom.h" 9 | #include "egi_touch.h" 10 | #include "egi_timer.h" 11 | #include "egi_symbol.h" 12 | #include "egi_bjp.h" 13 | #include "egi_imgbuf.h" 14 | #include "egi_image.h" 15 | #include "egi_math.h" 16 | #include "egi_debug.h" 17 | #include "egi_log.h" 18 | #include "egi_color.h" 19 | #include "egi_pic.h" 20 | #include "egi_txt.h" 21 | #include "egi_list.h" 22 | #include "egi_btn.h" 23 | #include "egi_sbtn.h" 24 | #include "egi_slider.h" 25 | #include "egi_objbtn.h" 26 | #include "egi_objlist.h" 27 | #include "egi_objtxt.h" 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /egi_data.c: -------------------------------------------------------------------------------- 1 | /*------------------------------------ 2 | all shared data 3 | -------------------------------------*/ 4 | -------------------------------------------------------------------------------- /egi_gb2unicode.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | A lookup table for converting GB2312 codes to Unicode. 7 | 8 | Journal: 9 | 2021-11-24: Create the EGI_GB2UNICODE_LIST[] lookup table. 10 | 11 | 12 | Midas Zhou 13 | midaszhou@yahoo.com(Not in use since 2022_03_01) 14 | -------------------------------------------------------------------*/ 15 | #ifndef __EGI_GB2UNICODE_H__ 16 | #define __EGI_GB2UNICODE_H__ 17 | 18 | #include 19 | 20 | typedef struct GB2312toUnicode { 21 | uint16_t gbcode; /* GB2312 code */ 22 | uint16_t unicode; /* Unicode */ 23 | } EGI_GB2UNICODE; 24 | extern const EGI_GB2UNICODE EGI_GB2UNICODE_LIST[]; 25 | 26 | int UniHan_gb2unicode_listSize(void); 27 | int cstr_gb2312_to_unicode(const char *src, wchar_t *dest); /* OBSOLETE */ 28 | int cstr_gbk_to_unicode(const char *src, wchar_t *dest); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /egi_list.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | Midas Zhou 8 | -------------------------------------------------------------------*/ 9 | 10 | #ifndef __EGI_LIST_H__ 11 | #define __EGI_LIST_H__ 12 | 13 | #include "egi.h" 14 | #include "egi_symbol.h" 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | #define LIST_ITEM_MAXLINES 10 /* MAX number of txt line for each list item */ 21 | #define LIST_DEFAULT_BKCOLOR WEGI_COLOR_GRAY /*default list item bkcolor */ 22 | 23 | 24 | /* functions for list */ 25 | EGI_EBOX *egi_listbox_new ( 26 | int x0, int y0, /* left top point */ 27 | int inum, /* item number of a list */ 28 | int nwin, /* number of items in displaying window */ 29 | int width, /* H/W for each list item ebox, W/H of the hosting ebox depends on it */ 30 | int height, 31 | int frame, /* -1 no frame for ebox, 0 simple .. */ 32 | int nl, /* number of txt lines for each txt ebox */ 33 | int llen, /* in byte, length for each txt line */ 34 | EGI_SYMPAGE *font, /* txt font */ 35 | int txtoffx, /* offset of txt from the ebox, all the same */ 36 | int txtoffy, 37 | int iconoffx, /* offset of icon from the ebox, all the same */ 38 | int iconoffy 39 | ); 40 | 41 | void egi_free_data_list(EGI_DATA_LIST *data_list); 42 | int egi_listbox_activate(EGI_EBOX *ebox); 43 | int egi_listbox_refresh(EGI_EBOX *ebox); 44 | int egi_listbox_updateitem(EGI_EBOX *ebox, int n, int prmcolor, const char **txt); 45 | // static int egi_itembox_decorate(EGI_EBOX *ebox); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /egi_log.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -------------------------------------------------------------------*/ 8 | 9 | #ifndef __EGI_LOG__ 10 | #define __EGI_LOG__ 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #define EGI_LOGFILE_PATH "/mmc/egi_log" /* default */ 17 | 18 | //#define ENABLE_LOGBUFF_PRINT /* enable to print log buff content, replaced by log_is_silent */ 19 | 20 | #define EGI_LOG_MAX_BUFFITEMS 128 /* MAX. number of log buff items */ 21 | #define EGI_LOG_MAX_ITEMLEN 512 //256 /* Max length for each log string item */ 22 | #define EGI_LOG_WRITE_SLEEPGAP 10 /* in ms, sleep gap between two buff write session in egi_log_thread_write() */ 23 | #define EGI_LOG_QUITWAIT 55 /* in ms, wait for other thread to finish pushing inhand log string, 24 | * before quit the log process */ 25 | 26 | /* LOG LEVEL */ 27 | /* NOTE: to accord with egi_loglv_to_string()! */ 28 | enum egi_log_level 29 | { 30 | LOGLV_NONE =(1<<0), 31 | LOGLV_INFO =(1<<1), 32 | LOGLV_ASSERT =(1<<2), 33 | LOGLV_WARN =(1<<3), 34 | LOGLV_CRITICAL =(1<<4), 35 | LOGLV_ERROR =(1<<5), 36 | LOGLV_TEST =(1<<15), 37 | }; 38 | 39 | #define ENABLE_EGI_PLOG 40 | 41 | /* Only log levels included in DEFAULT_LOG_LEVELS will be effective in EGI_PLOG() */ 42 | #define DEFAULT_LOG_LEVELS (LOGLV_NONE|LOGLV_TEST|LOGLV_INFO|LOGLV_WARN|LOGLV_ERROR|LOGLV_CRITICAL|LOGLV_ASSERT) 43 | 44 | /* Only log level gets threshold(>=) that will be written to log file directly, without putting to buffer */ 45 | #define LOGLV_NOBUFF_THRESHOLD LOGLV_INFO //LOGLV_WARN 46 | 47 | 48 | /* --- logger functions --- */ 49 | void egi_log_silent(bool enable); 50 | int egi_push_log(enum egi_log_level log_level, const char *fmt, ...) __attribute__(( format(printf,2,3) )); 51 | //static void egi_log_thread_write(void); 52 | int egi_init_log(const char *fpath); 53 | //static int egi_stop_log(void); 54 | //static int egi_free_logbuff(void) 55 | int egi_quit_log(void); 56 | 57 | 58 | #ifdef ENABLE_EGI_PLOG 59 | /* define EGI_PLOG(), push log content to log_buff. 60 | * Note: 61 | * 1. If log file is NOT open/available and log_is_silent==false, it only prints out the log string 62 | * and will NOT push/write the log. 63 | * 2. Let the caller to put FILE and FUNCTION, we can not ensure that two egi_push_log() 64 | * will push string to the log buff exactly one after the other,because of concurrency 65 | * race condition. 66 | * 3. A '\n' included in egi_push_log(), so NOT necessary to put it in EGI_PLOG()! 67 | * egi_push_log(" From file %s, %s(): \n",__FILE__,__FUNCTION__); 68 | */ 69 | #define EGI_PLOG(level, fmt, args...) \ 70 | do { \ 71 | if(level & DEFAULT_LOG_LEVELS) \ 72 | { \ 73 | egi_push_log(level,fmt, ## args); \ 74 | } \ 75 | } while(0) 76 | 77 | #else 78 | #define EGI_PLOG(level, fmt, args...) /* leave as blank */ 79 | 80 | #endif 81 | 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /egi_matrix.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | Midas Zhou 8 | midaszhou@yahoo.com(Not in use since 2022_03_01) 9 | ------------------------------------------------------------------*/ 10 | #ifndef __EGI_MATRIX__H__ 11 | #define __EGI_MATRIX__H__ 12 | 13 | #include 14 | #include 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | typedef struct float_Matrix EGI_MATRIX; 21 | 22 | struct float_Matrix 23 | { 24 | int nr; /* Rows */ 25 | int nc; /* Columns */ 26 | float* pmat; 27 | }; 28 | 29 | 30 | /* ------function declaration ------- */ 31 | uint32_t mat_get_costtimeus(struct timeval tm_start, struct timeval tm_end); 32 | uint32_t mat_tmIntegral_NG(uint8_t num, const double *fx, double *sum, uint32_t *pdt_us); 33 | uint32_t mat_tmIntegral(const double fx, double *sum, uint32_t *pdt_us); 34 | 35 | 36 | /*<<<<<<<<<<<<<<< MATRIX --- OPERATION >>>>>>>>>>>>>>>>>> 37 | NOTE: 38 | 1. All matrix data is stored from row to column. 39 | 2. All indexes starts from 0 !!! 40 | ------------------------------------------------------------------*/ 41 | struct float_Matrix * init_float_Matrix(int nr, int nc); 42 | void release_float_Matrix(struct float_Matrix ** pMat); 43 | 44 | void Matrix_Print(struct float_Matrix *matA); 45 | struct float_Matrix* Matrix_FillArray(struct float_Matrix * pMat, const float * array); //fill pMat->pmat with data from array 46 | float Matrix3X3_Determ(float *pmat); // determinnat of a 3X3 matrix 47 | float MatrixGT3X3_Determ(int nrc, float *pmat); // determinant of a matrix with dimension more than 3x3 48 | 49 | struct float_Matrix* Matrix_CopyColumn(struct float_Matrix *matA, int nclmA, struct float_Matrix *matB, int nclmB); 50 | 51 | struct float_Matrix* Matrix_Add( const struct float_Matrix *matA, 52 | const struct float_Matrix *matB, 53 | struct float_Matrix *matC ); 54 | 55 | struct float_Matrix* Matrix_Sub( const struct float_Matrix *matA, 56 | const struct float_Matrix *matB, 57 | struct float_Matrix *matC ); 58 | 59 | struct float_Matrix* Matrix_Multiply( const struct float_Matrix *matA, 60 | const struct float_Matrix *matB, 61 | struct float_Matrix *matC ); 62 | 63 | struct float_Matrix* Matrix_MultFactor(struct float_Matrix *matA, float fc); 64 | struct float_Matrix* Matrix_DivFactor(struct float_Matrix *matA, float fc); 65 | struct float_Matrix* Matrix_Transpose(const struct float_Matrix *matA, struct float_Matrix *matB ); 66 | float* Matrix_Determ( const struct float_Matrix *matA, float *determ ); 67 | struct float_Matrix* Matrix_Inverse( const struct float_Matrix *matA, struct float_Matrix *matAdj ); 68 | struct float_Matrix* Matrix_SolveEquations( const struct float_Matrix *matAB, struct float_Matrix *matX); 69 | 70 | /* Special Matrix Equation Algrithom */ 71 | EGI_MATRIX* Matrix_GuassSolve( const struct float_Matrix *matAB ); 72 | EGI_MATRIX* Matrix_ThomasSolve( const EGI_MATRIX *abcd, const EGI_MATRIX *matAD); 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /egi_objbtn.c: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -------------------------------------------------------------------*/ 8 | 9 | 10 | #include 11 | #include "egi.h" 12 | #include "egi_debug.h" 13 | #include "egi_btn.h" 14 | 15 | 16 | /*----------------------------------- 17 | -----------------------------------*/ 18 | void objbtn_create_homebtns(void) 19 | { 20 | 21 | 22 | 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /egi_objbtn.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | All EGI OBJ Initializations 7 | 8 | 9 | Midas Zhou 10 | -----------------------------------------------------------------*/ 11 | #ifndef __EGI_OBJBTN_H__ 12 | #define __EGI_OBJBTN_H__ 13 | 14 | #include 15 | 16 | 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /egi_objlist.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -----------------------------------------------------------------*/ 8 | 9 | #ifndef __EGI_OBJLIST_H__ 10 | #define __EGI_OBJLIST_H__ 11 | 12 | #include "egi.h" 13 | 14 | int egi_listbox_test(EGI_EBOX *ebox, EGI_TOUCH_DATA * touch_data); 15 | 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /egi_objtxt.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | All EGI OBJ Initializations 7 | 8 | 9 | Midas Zhou 10 | -----------------------------------------------------------------*/ 11 | #ifndef __EGI_OBJTXT_H__ 12 | #define __EGI_OBJTXT_H__ 13 | 14 | #include 15 | 16 | 17 | /* ------------ MEMO: txt ebox ----------- */ 18 | EGI_EBOX *create_ebox_memo(void); 19 | EGI_EBOX *create_ebox_clock(void); 20 | EGI_EBOX *create_ebox_note(void); 21 | int egi_txtbox_demo(EGI_EBOX *ebox, EGI_TOUCH_DATA * touc_data); 22 | 23 | /* -------- egi pattern ----- */ 24 | EGI_EBOX *create_ebox_titlebar( 25 | int x0, int y0, 26 | int offx, int offy, 27 | uint16_t bkcolor, 28 | char *title 29 | ); 30 | 31 | EGI_EBOX *egi_msgbox_create(char *msg, long ms, uint16_t bkcolor); 32 | void egi_msgbox_pvupdate(EGI_EBOX *msgbox, int pv); 33 | void egi_msgbox_destroy(EGI_EBOX *msgbox); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /egi_page.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | ------------------------------------------------------------------*/ 8 | 9 | #ifndef __EGI_PAGE_H__ 10 | #define __EGI_PAGE_H__ 11 | 12 | #include 13 | #include "egi.h" 14 | 15 | EGI_PAGE * egi_page_new(char *tag); 16 | int egi_page_free(EGI_PAGE *page); 17 | int egi_suspend_runner(EGI_PAGE *page, int runnerID); 18 | int egi_resume_runner(EGI_PAGE *page, int runnerID); 19 | int egi_runner_sigSuspend_handler(EGI_PAGE *page); /* for the PAGE runner */ 20 | int egi_page_addlist(EGI_PAGE *page, EGI_EBOX *ebox); 21 | int egi_page_travlist(EGI_PAGE *page); 22 | int egi_page_activate(EGI_PAGE *page); 23 | int egi_page_refresh(EGI_PAGE *page); 24 | int egi_page_start_runners(EGI_PAGE *page); 25 | int egi_page_routine(EGI_PAGE *page); 26 | int egi_homepage_routine(EGI_PAGE *page); 27 | int egi_page_flag_needrefresh(EGI_PAGE *page); 28 | int egi_page_needrefresh(EGI_PAGE *page); 29 | EGI_EBOX *egi_page_pickbtn(EGI_PAGE *page, enum egi_ebox_type type,unsigned int id); 30 | EGI_EBOX *egi_page_pickebox(EGI_PAGE *page, enum egi_ebox_type type, unsigned int id); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /egi_pic.h: -------------------------------------------------------------------------------- 1 | /*------------------------- egi_pic.h------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | egi pic tyep ebox functions 8 | 9 | Midas Zhou 10 | ------------------------------------------------------------------*/ 11 | #ifndef __EGI_PIC_H__ 12 | #define __EGI_PIC_H__ 13 | 14 | #include "egi.h" 15 | #include "egi_symbol.h" 16 | #include "egi_image.h" 17 | 18 | EGI_DATA_PIC *egi_picdata_new( int offx, int offy, 19 | EGI_IMGBUF **imgbuf, 20 | int imgpx, int imgpy, 21 | int bkcolor, 22 | EGI_SYMPAGE *font 23 | ); 24 | 25 | EGI_EBOX * egi_picbox_new( char *tag, /* or NULL to ignore */ 26 | EGI_DATA_PIC *egi_data, 27 | bool movable, 28 | int x0, int y0, 29 | int frame, 30 | int prmcolor /* applys only if prmcolor>=0 and egi_data->icon != NULL */ 31 | ); 32 | int egi_picbox_renewimg(EGI_EBOX *ebox, EGI_IMGBUF **peimg); 33 | int egi_picbox_activate(EGI_EBOX *ebox); 34 | int egi_picbox_refresh(EGI_EBOX *ebox); 35 | int egi_picbox_sleep(EGI_EBOX *ebox); 36 | void egi_free_data_pic(EGI_DATA_PIC *data_pic); 37 | 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /egi_procman.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -------------------------------------------------------------------*/ 8 | #ifndef __EGI_PROCMAN_H__ 9 | #define __EGI_PROCMAN_H__ 10 | 11 | #include 12 | 13 | extern const char *app_name; 14 | 15 | int egi_system(const char *cmd); 16 | int egi_common_sigAction(int signum, void(*handler)(int) ); 17 | 18 | void __attribute__((constructor)) app_common_constructor(void); 19 | void __attribute__((destructor)) app_common_destructor(void); 20 | int egi_assign_AppSigActions(void); 21 | int egi_process_activate_APP(pid_t *apid, char* app_path); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /egi_sbtn.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | Midas Zhou 8 | midaszhou@yahoo.com(Not in use since 2022_03_01) 9 | ------------------------------------------------------------------------*/ 10 | #ifndef __EGI_SBTN_H__ 11 | #define __EGI_SBTN_H__ 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | //extern struct egi_touch_data; 18 | 19 | /* Simple rectangular button data */ 20 | typedef struct egi_rectbtn EGI_RECTBTN; 21 | struct egi_rectbtn { 22 | int id; /* button ID */ 23 | EGI_16BIT_COLOR color; /* Default BLACK */ 24 | 25 | int x0; /* left top coordinate */ 26 | int y0; 27 | 28 | unsigned int width; /* button width and height */ 29 | unsigned int height; 30 | unsigned int sw; /* width for bright/shadowy lines */ 31 | 32 | EGI_16BIT_COLOR tagcolor; /* Default BLACK */ 33 | int fw; /* tag font size */ 34 | int fh; 35 | int offx; /* tag Offset postion */ 36 | int offy; 37 | 38 | bool pressed; /* button status */ 39 | int type; /* 40 | * 0 - Normal, rectangular button shape. 41 | */ 42 | 43 | int effect; /* Transforming effect when being touched. 44 | * 0: Defalt, normal. 45 | * 1: Ink effect. 46 | */ 47 | 48 | /* All imgbufs are references, no need to free. Usually they are subimgs of an EGI_IMGBUF */ 49 | EGI_IMGBUF *pressimg; /* imgage icon for pressed status */ 50 | unsigned pressimg_subnum; 51 | EGI_IMGBUF *releaseimg; /* image icon for released status */ 52 | unsigned releaseimg_subnum; 53 | 54 | struct egi_touch_data *touch_data; /* pointer to current touch data */ 55 | void (* reaction)(EGI_RECTBTN *); /* button reaction callback */ 56 | }; 57 | 58 | 59 | void egi_sbtn_refresh(EGI_RECTBTN *btn, char *tag); 60 | 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /egi_slider.h: -------------------------------------------------------------------------------- 1 | /*---------------- egi_slider.h-------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | egi slider tyep ebox functions 7 | 8 | Midas Zhou 9 | ------------------------------------------------------*/ 10 | #ifndef __EGI_SLIDER_H__ 11 | #define __EGI_SLIDER_H__ 12 | 13 | 14 | #include "egi.h" 15 | #include "egi_symbol.h" 16 | 17 | EGI_DATA_BTN *egi_sliderdata_new( 18 | /* for btnbox */ 19 | int id, enum egi_btn_type btn_shape, 20 | EGI_SYMPAGE *icon, int icon_code, 21 | EGI_SYMPAGE *font, 22 | 23 | /* for slider */ 24 | enum egi_slid_type slid_type, /* slider type */ 25 | EGI_POINT pxy, 26 | int swidth, int slen, 27 | int value, /* usually to be 0 */ 28 | EGI_16BIT_COLOR val_color, EGI_16BIT_COLOR void_color, 29 | EGI_16BIT_COLOR slider_color 30 | ); 31 | 32 | EGI_EBOX * egi_slider_new( 33 | char *tag, /* or NULL to ignore */ 34 | EGI_DATA_BTN *egi_data, 35 | int width, int height, /* for frame drawing and prmcolor filled_rectangle */ 36 | int twidth, int theight, /* for touch area,which is coupled with ebox->x0,y0 */ 37 | int frame, 38 | int prmcolor /* 1. Let <0, it will draw slider, instead of applying gemo or icon. 39 | 2. prmcolor geom applys only if prmcolor>=0 and egi_data->icon != NULL */ 40 | ); 41 | 42 | 43 | int egi_slider_activate(EGI_EBOX *ebox); 44 | int egi_slider_refresh(EGI_EBOX *ebox); 45 | int egi_slider_setpsval(EGI_EBOX *ebox, int psval); 46 | int egi_slider_reset(EGI_EBOX *slider, int psval, int sl, EGI_POINT sxy); 47 | EGI_DATA_SLIDER *egi_slider_getdata(EGI_EBOX *slider); 48 | void egi_free_data_slider(EGI_DATA_BTN *data_btn); 49 | 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /egi_touch.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -----------------------------------------------------------------*/ 8 | #ifndef __EGI_TOUCH_H__ 9 | #define __EGI_TOUCH_H__ 10 | 11 | #include "egi.h" 12 | #include "egi_sbtn.h" 13 | #include 14 | 15 | /* typedef struct egi_touch_data EGI_TOUCH_DATA in "egi.h" */ 16 | 17 | bool egi_touch_on_rectBTN(EGI_TOUCH_DATA *touch_data, EGI_RECTBTN *btn); 18 | int egi_touch_timeWait_press( int s, unsigned int ms, EGI_TOUCH_DATA *touch_data); 19 | int egi_touch_timeWait_release( int s, unsigned int ms, EGI_TOUCH_DATA *touch_data); 20 | void egi_touchread_nowait(bool nowait); 21 | int egi_start_touchread(void); 22 | int egi_end_touchread(void); 23 | bool egi_touchread_is_running(void); 24 | bool egi_touch_getdata(EGI_TOUCH_DATA *data); 25 | int egi_touch_fbpos_data(FBDEV *fbdev, EGI_TOUCH_DATA *touch_data, int rpos); 26 | EGI_TOUCH_DATA egi_touch_peekdata(void); 27 | int egi_touch_peekdx(void); 28 | int egi_touch_peekdy(void); 29 | void egi_touch_peekdxdy(int *dx, int *dy); 30 | enum egi_touch_status egi_touch_peekstatus(void); 31 | void* egi_touch_loopread(void); 32 | 33 | 34 | /* Functions for ADS7846 based touchscreen and sensor */ 35 | #include 36 | #define INPUT_TOUCH_DEVNAME "/dev/input/event0" 37 | int egi_touch_waitPress(const struct timeval *timeout); 38 | int egi_touch_readXYP(EGI_POINT *pt, int *pressure); 39 | /* TODO: Save and restore caliberation data */ 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /egi_txt.h: -------------------------------------------------------------------------------- 1 | /*------------------ eig_txt.h -------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | Midas Zhou 8 | --------------------------------------------------------------------*/ 9 | #ifndef __EGI_TXT_H__ 10 | #define __EGI_TXT_H__ 11 | 12 | #include "egi.h" 13 | #include "egi_symbol.h" 14 | #include 15 | #include 16 | 17 | /* for txt ebox */ 18 | EGI_DATA_TXT *egi_init_data_txt(EGI_DATA_TXT *data_txt, /* ----- OBSOLETE ----- */ 19 | int offx, int offy, int nl, int llen, EGI_SYMPAGE *font, uint16_t color); 20 | 21 | /* For non_FTsymbols */ 22 | EGI_DATA_TXT *egi_txtdata_new( int offx, int offy, /* create new txt data */ 23 | int nl, /* lines */ 24 | int llen, /* chars per line */ 25 | EGI_SYMPAGE *font, /* font */ 26 | uint16_t color /* txt color */ 27 | ); 28 | 29 | /* For FTsymbols */ 30 | EGI_DATA_TXT *egi_utxtdata_new( int offx, int offy, /* offset from ebox left top */ 31 | int nl, /* lines */ 32 | int pixpl, /* pixels per line */ 33 | FT_Face font_face, /* font face type */ 34 | int fw, int fh, /* font width and height, in pixels */ 35 | int gap, /* adjust gap between lines */ 36 | uint16_t color /* txt color */ 37 | ); 38 | 39 | EGI_EBOX * egi_txtbox_new( char *tag,/* create new txt ebox */ 40 | EGI_DATA_TXT *egi_data, 41 | bool movable, 42 | int x0, int y0, 43 | int width, int height, 44 | int frame, 45 | int prmcolor 46 | ); 47 | 48 | int egi_txtbox_activate(EGI_EBOX *ebox); 49 | int egi_txtbox_refresh(EGI_EBOX *ebox); 50 | //static int egi_txtbox_decorate(EGI_EBOX *ebox); 51 | int egi_txtbox_sleep(EGI_EBOX *ebox); 52 | int egi_txtbox_hide(EGI_EBOX *ebox); 53 | int egi_txtbox_unhide(EGI_EBOX *ebox); 54 | EGI_DATA_TXT *egi_txtbox_getdata(EGI_EBOX *ebox); 55 | void egi_free_data_txt(EGI_DATA_TXT *data_txt); 56 | 57 | /* For non_FTsymbols only */ 58 | int egi_txtbox_readfile(EGI_EBOX *ebox, char *path); 59 | void egi_txtbox_settitle(EGI_EBOX *ebox, char *title); 60 | int egi_push_datatxt(EGI_EBOX *ebox, char *buf, int *pnl); 61 | int egi_txtbox_set_direct(EGI_EBOX *ebox, int direct); 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /ering/Makefile: -------------------------------------------------------------------------------- 1 | 2 | export STAGING_DIR=/home/midas-zhou/openwrt_widora/staging_dir 3 | COMMON_USRDIR=/home/midas-zhou/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr 4 | 5 | CC= $(STAGING_DIR)/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc 6 | #CC = gcc 7 | 8 | OBJS = ../egi_log.o ../utils/egi_utils.o ../egi_timer.o 9 | 10 | CFLAGS += -I$(COMMON_USRDIR)/include -I../. 11 | LDFLAGS += -L$(COMMON_USRDIR)/lib 12 | LIBS += -lubox -lubus -lblobmsg_json -ljson_script -ljson-c -pthread 13 | 14 | 15 | all: ering_server ering_client 16 | 17 | ering_server: ering_server.c egi_ring.h egi_ring.o 18 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJS) egi_ring.o ering_server.c -o ering_server 19 | 20 | ering_client: ering_client.c egi_ring.h egi_ring.o 21 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJS) egi_ring.o ering_client.c -o ering_client 22 | 23 | egi_ring.o: egi_ring.c egi_ring.h ../egi_debug.h ../egi_log.h 24 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -c egi_ring.c 25 | 26 | clean: 27 | rm -rf *.o ering_server ering_client 28 | 29 | -------------------------------------------------------------------------------- /ering/egi_ring.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | Midas Zhou 8 | midaszhou@yahoo.com 9 | ------------------------------------------------------------------*/ 10 | #ifndef __EGI_RING_H__ 11 | #define __EGI_RING_H__ 12 | 13 | #include 14 | #include 15 | 16 | /* ERING APP METHOD ID */ 17 | /* to be defined in APP header file. */ 18 | 19 | /* Enum for ERING command policy order */ 20 | enum { 21 | ERING_CMD_ID=0, 22 | ERING_CMD_DATA, 23 | ERING_CMD_MSG, 24 | __ERING_CMD_MAX, 25 | }; 26 | 27 | /* Enum for ERING returned data handling policy order */ 28 | enum { 29 | ERING_RET_CODE=0, 30 | ERING_RET_DATA, 31 | ERING_RET_MSG, 32 | __ERING_RET_MAX, 33 | }; 34 | 35 | // #define ERING_MAX_STRMSG 1024 36 | 37 | typedef struct egi_ring_command EGI_RING_CMD; /* ering caller command */ 38 | typedef struct egi_ring_return EGI_RING_RET; /* ering host reply */ 39 | 40 | struct egi_ring_command 41 | { 42 | char *caller; /* name of the ering caller, for client_obj.name */ 43 | 44 | bool cmd_valid[__ERING_CMD_MAX]; /* to indicate whether corresponding cmd filed data is valid/availble */ 45 | /*** 46 | * Complying with 'id','data' and 'msg' of ering_cmd_policy[] 47 | */ 48 | int16_t cmd_id; /* command ID, to be coded by APPs */ 49 | int32_t cmd_data; /* command param */ 50 | char *cmd_msg; /* command string message, if any */ 51 | 52 | // void (*cmd_handler)(EGI_RING_CMD *); /* handler for received command, provided by host APP */ 53 | }; 54 | 55 | struct egi_ring_return 56 | { 57 | char *host; /* name of the ering host (APP) */ 58 | 59 | bool ret_valid[__ERING_RET_MAX]; /* to indicate whether corresponding ret filed data is valid/availble */ 60 | /*** 61 | * Complying with 'code','data' and 'msg' of ering_ret_policy[] 62 | */ 63 | int16_t ret_code; /* returned code from the ering host, to be coded by APPs 64 | * however, Do NOT code ret_code=0, which it for 65 | * 'No Reply From the Host Yet!' 66 | */ 67 | int32_t ret_data; /* returned data, or void* ret_data ....TBD */ 68 | char *ret_msg; /* returned string msg from the host, if any */ 69 | 70 | // void (*ret_handler)(EGI_RING_RET *); /* handler for returned msg, provided by caller */ 71 | }; 72 | 73 | /* ering command and return msg handler */ 74 | typedef void(*ering_cmdret_handler_t)(EGI_RING_CMD *, EGI_RING_RET *); 75 | 76 | void ering_run_host(const char *ering_host, ering_cmdret_handler_t handler); 77 | int ering_call_host(const char *ering_host, EGI_RING_CMD *ering_cmd,ering_cmdret_handler_t handler); 78 | int ering_read_ret(EGI_RING_RET *eret); 79 | void ering_clear_ret(EGI_RING_RET *eret); 80 | void ering_clear_cmd(EGI_RING_CMD *ecmd); 81 | 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /ering/ering_client.c: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Create an ERING mechanism for EGI IPC. 7 | 8 | 9 | Midas Zhou 10 | midaszhou@yahoo.com 11 | ------------------------------------------------------------------*/ 12 | #include 13 | #include 14 | #include 15 | #include "egi_ring.h" 16 | #include "egi_log.h" 17 | 18 | /*---------------------------------------------------------- 19 | This is a ering_cmdret_handler_t type callback function 20 | Parse and process ering_ret feeded back from the ering host. 21 | 22 | For caller: ering_cmd,ering_ret are passed out params from 23 | the EGI_RING module. Here ering_cmd is just copied 24 | from caller's input ering_cmd. 25 | 26 | -----------------------------------------------------------*/ 27 | void result_parser(EGI_RING_CMD *ering_cmd, EGI_RING_RET *ering_ret) 28 | { 29 | printf("Call to host: "); 30 | if(ering_cmd->cmd_valid[ERING_CMD_ID]) 31 | printf("id=%d, ",ering_cmd->cmd_id); 32 | if(ering_cmd->cmd_valid[ERING_CMD_DATA]) 33 | printf("data=%d, ",ering_cmd->cmd_data); 34 | if(ering_cmd->cmd_valid[ERING_CMD_MSG]) 35 | printf("msg='%s' \n",ering_cmd->cmd_msg); 36 | 37 | printf("Return from host: "); 38 | if( ering_ret->ret_valid[ERING_RET_CODE]) 39 | printf("code=%d, ",ering_ret->ret_code); 40 | if( ering_ret->ret_valid[ERING_RET_DATA]) 41 | printf("data=%d, ",ering_ret->ret_data); 42 | if( ering_ret->ret_valid[ERING_RET_MSG]) 43 | printf("msg='%s' \n",ering_ret->ret_msg); 44 | } 45 | 46 | 47 | void main(void) 48 | { 49 | #define ERING_HOST_APP "ering.APP" 50 | #define ERING_HOST_STOCK "ering.STOCK" 51 | #define ERING_HOST_FFPLAY "ering.FFPLAY" 52 | 53 | #define ERING_STOCK_DISPLAY 1 54 | #define ERING_STOCK_HIDE 2 55 | #define ERING_STOCK_QUIT 3 56 | #define ERING_STOCK_SAVE 4 57 | 58 | int ret; 59 | int i=0; 60 | 61 | /* init ering_cmd */ 62 | EGI_RING_CMD ering_cmd= 63 | { 64 | .caller="UI_stock", 65 | .cmd_valid={1,1,1}, /* switch valid data */ 66 | .cmd_id=5, 67 | .cmd_data=56789, 68 | .cmd_msg=strdup("Hello EGI RING!"), 69 | }; 70 | 71 | 72 | /* init egi logger */ 73 | tm_start_egitick(); 74 | if(egi_init_log("/mmc/log_ering") != 0) 75 | { 76 | printf("Fail to init log_ering,quit.\n"); 77 | return; 78 | } 79 | 80 | /* loop test */ 81 | while(1) { 82 | i++; 83 | ering_cmd.cmd_data=i; 84 | if(ret=ering_call_host(ERING_HOST_APP, &ering_cmd, result_parser)) 85 | printf("Fail to call '%s', error: %s. \n", ERING_HOST_APP, ering_strerror(ret)); 86 | else 87 | printf("i=%d, Ering call session completed!'\n", i); 88 | 89 | if( (i&(64-1))==0 ) { 90 | EGI_PLOG(LOGLV_INFO, "%s: Finish %d rounds of ering calls.\n",__func__, i); 91 | } 92 | 93 | tm_delayms(50); 94 | } 95 | 96 | 97 | } 98 | 99 | -------------------------------------------------------------------------------- /ering/ering_server.c: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Create an ERING mechanism for EGI IPC. 7 | 8 | Test: 9 | ubus call ering.APP ering_cmd "{'msg':'Hello ERING'}" 10 | 11 | TODO: 12 | 1. APP cotrol command classification. 13 | 2. Method_calling feedback data format. 14 | 15 | 16 | Midas Zhou 17 | midaszhou@yahoo.com 18 | ------------------------------------------------------------------*/ 19 | #include 20 | #include 21 | #include 22 | #include "egi_ring.h" 23 | 24 | 25 | int count=1; 26 | 27 | /*---------------------------------------------------------- 28 | This is a ering_cmdret_handler_t type callback function. 29 | Parse and process ering_cmd from the caller and prepare 30 | ering_ret which will then be feeded back to the ering caller. 31 | 32 | ering_cmd: ering command received from any ering caller. 33 | ering_ret: return ering msg for the ering caller. 34 | -----------------------------------------------------------*/ 35 | void request_parser(EGI_RING_CMD *ering_cmd, EGI_RING_RET *ering_ret) 36 | { 37 | /* 1. check received ering_cmd */ 38 | /* already clear ering_cmd in EGI_RING module */ 39 | printf("Request from caller: "); 40 | if(ering_cmd->cmd_valid[ERING_CMD_ID]) 41 | printf("id=%d, ",ering_cmd->cmd_id); 42 | if(ering_cmd->cmd_valid[ERING_CMD_DATA]) 43 | printf("data=%d, ",ering_cmd->cmd_data); 44 | if(ering_cmd->cmd_valid[ERING_CMD_MSG]) 45 | printf("msg='%s' \n",ering_cmd->cmd_msg); 46 | 47 | 48 | /* 2. execute request method.... */ 49 | 50 | 51 | 52 | /* 3. feed back result ering_ret */ 53 | /* already clear ering_ret in EGI_RING module */ 54 | ering_ret->ret_valid[ERING_RET_CODE]=true; 55 | ering_ret->ret_code=count++; 56 | ering_ret->ret_valid[ERING_RET_DATA]=true; 57 | ering_ret->ret_data=555555; 58 | ering_ret->ret_valid[ERING_RET_MSG]=true; 59 | ering_ret->ret_msg=strdup("Request deferred!"); 60 | } 61 | 62 | void main(void) 63 | { 64 | 65 | /* init egi logger */ 66 | tm_start_egitick(); 67 | if(egi_init_log("/mmc/log_ering") != 0) 68 | { 69 | printf("Fail to init log_ering,quit.\n"); 70 | return; 71 | } 72 | 73 | /* ERING uloop */ 74 | ering_run_host("ering.APP", request_parser); 75 | } 76 | -------------------------------------------------------------------------------- /ffmpeg/ff_utils.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | Note: 8 | Never forget why you start! ---Just For Fun! 9 | 10 | TODO: 11 | 1. Use a new FB_DEV to display subtitle. or it rises a race condition 12 | for the FB dev. 13 | 2. 14 | 15 | Midas_Zhou 16 | ----------------------------------------------------------------------*/ 17 | #ifndef __FF_UTILS_H__ 18 | #define __FF_UTILS_H__ 19 | 20 | #include 21 | #include "egi_bjp.h" 22 | #include "egi.h" 23 | #include "egi_timer.h" 24 | #include "egi_ffplay.h" 25 | #include "libavcodec/avcodec.h" 26 | 27 | #define LCD_MAX_WIDTH 240 28 | #define LCD_MAX_HEIGHT 320 29 | //#define FFPLAY_MUSIC_PATH "/mmc/" 30 | 31 | /* in seconds, playing time elapsed for Video */ 32 | extern int ff_sec_Velapsed; 33 | extern int ff_sub_delays; /* delay sub display in seconds, relating to ff_sec_Velapsed */ 34 | extern enum ffplay_cmd control_cmd; 35 | 36 | extern FFPLAY_CONTEXT *FFplay_Ctx; 37 | extern FBDEV ff_fb_dev; 38 | 39 | //#define MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48KHz 32bit audio 40 | #define BUFF_NUM_EXPONENT 2 41 | #define PIC_BUFF_NUM (1<ebox->imgbuf */ 57 | }; 58 | 59 | /* check if it's image */ 60 | #define IS_IMAGE_CODEC(vcodecID) ( vcodecID == AV_CODEC_ID_MJPEG || vcodecID == AV_CODEC_ID_BMP || \ 61 | vcodecID == AV_CODEC_ID_MJPEGB || vcodecID == AV_CODEC_ID_PNG || \ 62 | vcodecID == AV_CODEC_ID_JPEG2000 || vcodecID == AV_CODEC_ID_GIF || \ 63 | vcodecID == AV_CODEC_ID_TIFF || vcodecID == AV_CODEC_ID_GIF || \ 64 | vcodecID == AV_CODEC_ID_LJPEG || vcodecID == AV_CODEC_ID_JPEGLS ) 65 | 66 | /* functions */ 67 | uint8_t** ff_malloc_PICbuffs(int width, int height, int pixel_size ); 68 | //static void ff_free_PicBuffs(void); 69 | //int ff_get_FreePicBuff(void); 70 | int ff_load_Pic2Buff(struct PicInfo *ppic,const uint8_t *data, int numBytes); 71 | void* thdf_Display_Pic(void * argv); 72 | void* thdf_Display_Subtitle(void * argv); 73 | //static long seek_Subtitle_TmStamp(char *subpath, unsigned int tmsec); 74 | //void ff_display_spectrum(FBDEV *fbdev, void ** buffer, int nf); 75 | void ff_load_FFTdata(void ** buffer, int nf); 76 | void* ff_display_spectrum(void *argv); 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /ffmpeg/ffplay_fltloop_240x160: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/ffmpeg/ffplay_fltloop_240x160 -------------------------------------------------------------------------------- /ffmpeg/ffplay_swsloop_170x170: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/ffmpeg/ffplay_swsloop_170x170 -------------------------------------------------------------------------------- /ffmpeg/ffplay_swsloop_185x185: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/ffmpeg/ffplay_swsloop_185x185 -------------------------------------------------------------------------------- /ffmpeg/test_ffutils: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/ffmpeg/test_ffutils -------------------------------------------------------------------------------- /ffmpeg/test_ffutils.c: -------------------------------------------------------------------------------- 1 | #include 2 | //#include "ff_utils.h" 3 | #include "egi_ffplay.h" 4 | 5 | int main(void) 6 | { 7 | int i; 8 | 9 | do{ 10 | 11 | if( egi_init_ffplayCtx("/mmc", "mp3, avi, jpg")) { 12 | printf("Fail to call egi_init_ffplayCtx() .\n"); 13 | return -1; 14 | } 15 | 16 | printf("Print totally %d fpath...\n", FFplay_Ctx->ftotal); 17 | for(i=0; i < FFplay_Ctx->ftotal; i++) 18 | printf("%s\n",(FFplay_Ctx->fpath)[i]); 19 | 20 | usleep(100000); 21 | 22 | egi_free_ffplayCtx(); 23 | 24 | }while(0); 25 | 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /ffmpeg/tmp/ff_pcm.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Based on: 7 | www.itwendao.com/article/detail/420944.html 8 | 9 | some explanation: 10 | sample: usually 8bits or 16bits, one sample data width. 11 | channel: 1-Mono. 2-Stereo 12 | frame: sizeof(one sample)*channels 13 | rate: frames per second 14 | period: Max. frame numbers hardware can be handled each time. (different value for PLAYBACK and CAPTURE!!) 15 | running show: 1536 frames for CAPTURE; 278 frames for PLAYBACK 16 | chunk: frames receive from/send to hardware each time. 17 | buffer: N*periods 18 | interleaved mode:record period data frame by frame, such as frame1(Left sample,Right sample),frame2(), ...... 19 | uninterleaved mode: record period data channel by channel, such as period(Left sample,Left ,left...),period(right,right..$ 20 | 21 | Midas Zhou 22 | --------------------------------------------------------------------------------------------------------------*/ 23 | #ifndef __FF_PCM_H__ 24 | #define __FF_PCM_H__ 25 | 26 | #define ALSA_PCM_NEW_HW_PARAMS_API 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | int prepare_ffpcm_device(unsigned int nchan, unsigned int srate, bool bl_interleaved); 33 | void close_ffpcm_device(void); 34 | void play_ffpcm_buff(void** buffer, int nf); 35 | int ffpcm_getset_volume(int *pvol, int *percnt); 36 | 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /ffmpeg/tmp/play_ffpcm.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------------------------------------------- 2 | Based on: 3 | www.itwendao.com/article/detail/420944.html 4 | 5 | some explanation: 6 | sample: usually 8bits or 16bits, one sample data width. 7 | channel: 1-Mono. 2-Stereo 8 | frame: sizeof(one sample)*channels 9 | rate: frames per second 10 | period: Max. frame numbers hardware can be handled each time. (different value for PLAYBACK and CAPTURE!!) 11 | running show: 1536 frames for CAPTURE; 278 frames for PLAYBACK 12 | chunk: frames receive from/send to hardware each time. 13 | buffer: N*periods 14 | interleaved mode:record period data frame by frame, such as frame1(Left sample,Right sample),frame2(), ...... 15 | uninterleaved mode: record period data channel by channel, such as period(Left sample,Left ,left...),period(right,right..$ 16 | 17 | Midas Zhou 18 | --------------------------------------------------------------------------------------------------------------*/ 19 | #ifndef __PLAY_FFPCM_H__ 20 | #define __PLAY_FFPCM_H__ 21 | 22 | #define ALSA_PCM_NEW_HW_PARAMS_API 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | int prepare_ffpcm_device(unsigned int nchan, unsigned int srate, bool bl_interleaved); 29 | void close_ffpcm_device(void); 30 | void play_ffpcm_buff(void** buffer, int nf); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /ffserver/ffmp3.conf: -------------------------------------------------------------------------------- 1 | 2 | ################# FFserver RTSP MP3 stream ################### 3 | # 4 | ## Note: 5 | ## 1.To release cache regularly: echo 3 >/proc/sys/vm/drop_caches 6 | ## 2.To increase mem: sysctl -w net.core.wmem_default=1310720 ... see /etc/sysctl.conf 7 | # If kernel net buffer is NOT enough, it will be choppy/jerky/jumpy! 8 | ## 3.APP VLC player will NOT disconnect automatically after it quits, and the bandwidth still 9 | # be ocuppied! For a normal RTSP session, the ffserver will receive [DESCRIBE] to start and [TEARDOWN] 10 | # to stop. but APP VLC seems only send a [PLAY] message. 11 | # MPlayer will also fail to send [TEARDOWN] sometimes. 12 | # !!!--- If there is NO [TEARDOWN] message, the bandwidth will NOT be released by ffserver! ---!!! 13 | 14 | ## 4.Not all types of audio data is supported by ffserver 15 | # FFmpeg internal fixed type audio codecs: 16 | # DEA.L. aac (decoders: aac aac_fixed ) 17 | # DEA.L. ac3 (decoders: ac3 ac3_fixed ) (encoders: ac3 ac3_fixed ) !NOT SUPPORTED for rtsp 18 | # DEA.L. mp2 (decoders: mp2 mp2float ) (encoders: mp2 mp2fixed ) !OK 19 | # 20 | ## 4.BiteRate and SampleRate MUST be compatible! 21 | # BitRate 128 SampleRate 16k Bigger latency 22 | # FileMaxSize 16k BitRate 256 SampleRate 48k TX:~30kBps, 1s latency, choppy after a while. 23 | # BitRate 512 SampleRate 48k NOT WORK, bitrate >256 is not allowed in mp2 24 | # 25 | ## 5.It may appears "ALSA buffer xrun.trate=262kbits/s(>256)" warnings occasionally! 26 | # Increase queue size in ffmpeg feeding command may help ??? 27 | # 'ffmpeg ... -f alsa -thread_queue_size 256 -i default ..' 28 | # 29 | ## 6.CPU load affects latency greatly, if you run ffserver and mplayer(listen) at the same WidoraNEO, it has 30 | # lagger time lag. ??? 31 | # 32 | ## 7.For mplayer, to press '->' to search to 0 position will shorten the latency! 33 | # 34 | ## 8.To test local voice capture and conversion latency: 35 | # arecord -f dat | aplay 36 | # AND 37 | # madplay fifo.mp2 /dev/null 2>&1 & 38 | # ffmpeg -y -f alsa -i default -c:a mp2 fifo.mp2 39 | # 40 | # Midas Zhou 41 | ################################################################# 42 | 43 | HTTPPort 8090 44 | 45 | # Address on which the server is bound. Only useful if you have 46 | # several network interfaces. 47 | HTTPBindAddress 0.0.0.0 48 | 49 | # Number of simultaneous HTTP connections that can be handled. It has 50 | # to be defined *before* the MaxClients parameter, since it defines the 51 | # MaxClients maximum limit. 52 | MaxHTTPConnections 20 53 | 54 | # Number of simultaneous requests that can be handled. Since FFServer 55 | # is very fast, it is more likely that you will want to leave this high 56 | # and use MaxBandwidth, below. 57 | MaxClients 10 58 | 59 | # This the maximum amount of kbit/sec that you are prepared to 60 | # consume when streaming to clients. 61 | MaxBandwidth 50000 62 | 63 | ## RTSP Port 64 | RTSPPort 5455 65 | 66 | #Launch 67 | 68 | 69 | file /tmp/feed_mp3.ffm 70 | FileMaxSize 16k 71 | 72 | 73 | 74 | Feed feed_mp3.ffm 75 | Format rtp 76 | AudioCodec mp2 77 | AudioBitRate 256 78 | AudioChannels 2 79 | AudioSampleRate 48000 80 | AVOptionAudio flags +global_header 81 | NoVideo 82 | 83 | ## Preroll seems NO effect for mp3 stream! 84 | #Preroll -4096 85 | 86 | NoDefaults 87 | 88 | 89 | -------------------------------------------------------------------------------- /ffserver/mp3push.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ######################################## 3 | # A test script to push live mp3 stream. 4 | # Midas Zhou 5 | ######################################## 6 | while [ 1 ] 7 | do 8 | killall -9 ffmpeg 9 | killall -9 ffserver 10 | 11 | ffserver -f ffmp3.conf -d & 12 | sleep 1 13 | 14 | ## OPTIONS 15 | ## -rtsp_transport tcp 16 | ## -bufsize 1k -f alsa -i hw:0,0 17 | ffmpeg -v verbose -f alsa -thread_queue_size 1024 -i default -b:a 48k -c:a mp2 http://localhost:8090/feed_mp3.ffm 18 | 19 | sleep 1 20 | done 21 | -------------------------------------------------------------------------------- /ffserver/mpcam.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ## To play rstp CAM stream. 4 | ## Example: ./mpcam.sh rtsp://192.168.8.1:5456/test.avi 5 | ## Go forward by pressing '->' to minish latency 6 | 7 | while [ 1 ] 8 | do 9 | ## -vf scale=240:176 -fs -vf pp=hb/vb/dr/al -rtsp-stream-over-tcp 10 | ## -vfm ffmpeg: Can greatly improve AV sync! but NOT here 11 | ## For'Too many buffered pts': -nocorrect-pts 12 | ## NOSYNC: -autosync 0 -mc 0, SYNC: -autosync 30 -mc 2.0 13 | ## -brightness 12 14 | mplayer -nocorrect-pts ${*} -framedrop -fs -vf scale=240:176 15 | #mplayer -nocorrect-pts ${*} -framedrop -fs -vf rotate=2 16 | sleep 1 17 | done 18 | -------------------------------------------------------------------------------- /ffserver/pullmp3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ############################################################################# 3 | # To play rtsp live mp3 stream with mplayer. 4 | # 5 | # NOTE: 6 | # 1. Most case ~1s latency! sometimes <0.5s. 7 | # 2. It takes too long time to load lavf?? 8 | # libavformat file format detected. ( start to decode.) 9 | # ... waiting ... 10 | # [lavf] stream 0: audio (mp2), -aid 0 (start to play) 11 | # 3.For mplayer, to press '->' to search to 0 position will shorten the latency! 12 | # 13 | # Midas Zhou 14 | ############################################################################### 15 | 16 | while [ 1 ] 17 | do 18 | 19 | ## OPTIONS 20 | # -nortc -vfm ffmpeg 21 | # -cache 1024 -nocache 22 | # -rtsp-stream-over-tcp 23 | # NOSYNC: -autosync 0 -mc 0, SYNC: -autosync 30 -mc 2.0 24 | mplayer -nortc -vfm ffmpeg -ac ffmp2 ${*} 25 | 26 | sleep 1 27 | done 28 | -------------------------------------------------------------------------------- /freetype/Makefile: -------------------------------------------------------------------------------- 1 | 2 | export STAGING_DIR=/home/midas-zhou/openwrt_widora/staging_dir 3 | COMMON_USRDIR=/home/midas-zhou/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/ 4 | 5 | CC= $(STAGING_DIR)/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc 6 | #CC = gcc 7 | 8 | #OBJ = ../egi_symbol.o 9 | 10 | CFLAGS += -I../ -I../utils 11 | CFLAGS += -I$(COMMON_USRDIR)/include 12 | CFLAGS += -I$(COMMON_USRDIR)/include/freetype2 13 | 14 | LDFLAGS += -L$(COMMON_USRDIR)/lib 15 | LDFLAGS += -L../lib 16 | #libblobmsg_json.so libjson_script.so libubox.so 17 | #LIBS += -lubus -lubox -lblobmsg_json -ljson_script -ljson-c 18 | LIBS = -lfreetype -lm -lz -lbz2 19 | LIBS += -lepages -lesound 20 | LIBS += -lpng -lz -lm -pthread -ljpeg -lasound 21 | LIBS += -lcurl -lssl -lcrypto -pthread 22 | LIBS += -lubox -lubus -lblobmsg_json -ljson_script -ljson-c 23 | 24 | 25 | all: test_freetype get_sympgHeight test_asciibook test_wchar test_wbook 26 | 27 | test_freetype: test_freetype.c 28 | $(CC) $(CFLAGS) $(LDFLAGS) -legi $(LIBS) $(OBJ) test_freetype.c -o test_freetype 29 | 30 | test_asciibook: test_asciibook.c 31 | $(CC) $(CFLAGS) $(LDFLAGS) -legi $(LIBS) $(OBJ) test_asciibook.c -o test_asciibook 32 | 33 | get_sympgHeight: get_sympgHeight.c 34 | $(CC) $(CFLAGS) $(LDFLAGS) -legi $(LIBS) $(OBJ) get_sympgHeight.c -o get_sympgHeight 35 | 36 | test_wchar: test_wchar.c 37 | $(CC) $(CFLAGS) $(LDFLAGS) -legi $(LIBS) $(OBJ) test_wchar.c -o test_wchar 38 | 39 | test_wbook: test_wbook.c ../lib/libegi.a # link LIBEGI statically. 40 | $(CC) test_wbook.c $(CFLAGS) $(LDFLAGS) $(OBJS) -Wl,-Bstatic -legi -Wl,-Bdynamic $(LIBS) -o test_wbook 41 | 42 | clean: 43 | rm -rf *.o test_freetype test_asciibook get_sympgHeight test_wchar test_wbook 44 | 45 | 46 | -------------------------------------------------------------------------------- /heweather/Makefile: -------------------------------------------------------------------------------- 1 | 2 | export STAGING_DIR=/home/midas-zhou/openwrt_widora/staging_dir 3 | COMMON_USRDIR=/home/midas-zhou/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr 4 | SRC_PATH = /home/midas-zhou/Ctest/wegi 5 | 6 | CC= $(STAGING_DIR)/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc 7 | 8 | #OBJS = ../egi_log.o ../utils/egi_utils.o ../egi_timer.o 9 | 10 | CFLAGS += -I$(COMMON_USRDIR)/include -I$(SRC_PATH)/. -I$(SRC_PATH)/utils 11 | CFLAGS += -I$(COMMON_USRDIR)/include/freetype2 12 | CFLAGS += -D_GNU_SOURCE # for strdupa 13 | 14 | LDFLAGS += -L$(COMMON_USRDIR)/lib -L$(SRC_PATH)/lib/ 15 | 16 | #LIBS += -lubox -lubus -lblobmsg_json -ljson_script -ljson-c -pthread 17 | LIBS = -ljpeg -lpng -lz #-legi 18 | LIBS += -lcurl -lssl -lcrypto -pthread -ljson-c 19 | LIBS += -lfreetype -lm -lz -lbz2 20 | 21 | all: test_now test_forecast he_weather.o 22 | 23 | #https: https.c 24 | # $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJS) https.c -o https 25 | 26 | test_forecast: test_forecast.c he_weather.o 27 | # $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) he_weather.o test_forecast.c -o test_forecast 28 | $(CC) he_weather.o test_forecast.c -o test_forecast $(CFLAGS) $(LDFLAGS) -Wl,-Bdynamic $(LIBS) \ 29 | -Wl,-Bstatic -legi -Wl,-Bdynamic 30 | #---use static egilib 31 | 32 | 33 | test_now: test_now.c he_weather.o 34 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -legi he_weather.o test_now.c -o test_now 35 | 36 | 37 | he_weather.o: he_weather.c he_weather.h 38 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -legi -c he_weather.c 39 | 40 | 41 | clean: 42 | rm -rf *.o test_now test_forecast 43 | 44 | -------------------------------------------------------------------------------- /heweather/he_weather.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | An example for www.heweahter.com https interface. 7 | 8 | Midas Zhou 9 | -------------------------------------------------------------------*/ 10 | #ifndef __HE_WEATHER__ 11 | #define __HE_WEATHER__ 12 | 13 | #include 14 | #include "egi_image.h" 15 | 16 | #define _SKIP_PEER_VERIFICATION 17 | #define _SKIP_HOSTNAME_VERIFICATION 18 | 19 | #define HEWEATHER_NOW 0 20 | #define HEWEATHER_FORECAST 1 21 | #define HEWEATHER_HOURLY 2 22 | #define HEWEATHER_LIFESTYLE 3 23 | #define HEWEATHER_FORECAST_DAYS 3 24 | 25 | #define HEWEATHER_ICON_PATH "/mmc/heweather" /* png icons */ 26 | 27 | enum heweather_data_type { 28 | data_now=0, 29 | data_forecast, 30 | data_hourly, 31 | data_lifestyle 32 | }; 33 | 34 | /* Use static mem may be GOOD */ 35 | typedef struct heweather_data { 36 | char *location; /* Location */ 37 | 38 | char *cond_code; /* current weather condition code */ 39 | char *cond_code_d; /* forecast day cond_code */ 40 | char *cond_code_n; /* forecast night cond_code */ 41 | 42 | EGI_IMGBUF *eimg; /* weather icon image data loaded from icon_path */ 43 | 44 | char *cond_txt; /* current weather condition txt */ 45 | char *cond_txt_d; /* forecast day cond_txt */ 46 | char *cond_txt_n; /* forecast night cond_txt */ 47 | 48 | char *wind_dir; /* wind direction */ 49 | int wind_deg; /* wind degree 0-360 */ 50 | char *wind_scale; /* wind scale 1-12 */ 51 | int wind_speed; /* wind speed in kilometer/hour */ 52 | 53 | int temp; /* current temperature */ 54 | int temp_max; /* forecast Temp. */ 55 | int temp_min; 56 | 57 | int hum; /* current humidity */ 58 | int hum_max; /* forecast Hum. */ 59 | int hum_min; 60 | }EGI_WEATHER_DATA; 61 | 62 | /*** 63 | * Now: 0; 64 | * Forcast: 65 | * 1=today; 2=tomorrow; 3=the day aft. tomorrow 66 | */ 67 | extern EGI_WEATHER_DATA weather_data[1+HEWEATHER_FORECAST_DAYS]; 68 | 69 | /* function */ 70 | char * heweather_get_objitem(const char *strinput, const char *strsect, const char *strkey); 71 | char * heweather_get_forecast(const char *strinput, int index, const char *strkey); 72 | void heweather_data_clear(EGI_WEATHER_DATA *weather_data); 73 | int heweather_httpget_data(enum heweather_data_type data_type, const char *location); 74 | 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /install/2rotate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/2rotate -------------------------------------------------------------------------------- /install/autorec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/autorec -------------------------------------------------------------------------------- /install/clear_screen: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/clear_screen -------------------------------------------------------------------------------- /install/image_test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/image_test -------------------------------------------------------------------------------- /install/jpgshow: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/jpgshow -------------------------------------------------------------------------------- /install/mjpgshow: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/mjpgshow -------------------------------------------------------------------------------- /install/runbmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/runbmp -------------------------------------------------------------------------------- /install/showpic: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/showpic -------------------------------------------------------------------------------- /install/sq_rotate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/sq_rotate -------------------------------------------------------------------------------- /install/test_base64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/test_base64 -------------------------------------------------------------------------------- /install/test_bigiot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/test_bigiot -------------------------------------------------------------------------------- /install/test_bmpjpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/test_bmpjpg -------------------------------------------------------------------------------- /install/test_color: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/test_color -------------------------------------------------------------------------------- /install/test_geom: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/test_geom -------------------------------------------------------------------------------- /install/test_stock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/test_stock -------------------------------------------------------------------------------- /install/test_sym: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/test_sym -------------------------------------------------------------------------------- /install/test_weather: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/test_weather -------------------------------------------------------------------------------- /install/test_writetxt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/test_writetxt -------------------------------------------------------------------------------- /install/tjpgshow: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/tjpgshow -------------------------------------------------------------------------------- /install/touch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/touch -------------------------------------------------------------------------------- /install/track: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/install/track -------------------------------------------------------------------------------- /iot/Makefile: -------------------------------------------------------------------------------- 1 | 2 | export STAGING_DIR = /home/midas-zhou/openwrt_widora/staging_dir 3 | COMMON_USRDIR = /home/midas-zhou/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/ 4 | 5 | CC= $(STAGING_DIR)/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc 6 | 7 | APP=egi_iotclient 8 | 9 | CFLAGS = -I../ -I../utils 10 | CFLAGS += -I$(COMMON_USRDIR)/include 11 | CFLAGS += -I$(COMMON_USRDIR)/include/json-c 12 | CFLAGS += -I$(COMMON_USRDIR)/include/freetype2 13 | CFLAGS += -Wall 14 | CFLAGS += -D_GNU_SOURCE ## for O_CLOEXEC flag ## 15 | LDFLAGS += -L$(COMMON_USRDIR)/lib 16 | LIBS += -ljson-c -lpthread 17 | 18 | 19 | $(APP): $(APP).c 20 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -c $(APP).c 21 | 22 | clean: 23 | rm -rf $(APP) $(APP).o 24 | 25 | #CFLAGS += $(shell pkg-config --cflags json-c) 26 | #LDFLAGS += $(shell pkg-config --libs json-c) 27 | 28 | -------------------------------------------------------------------------------- /iot/egi_iotclient.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -----------------------------------------------------------------*/ 8 | 9 | #ifndef __EGI_IOTCLIENT__ 10 | #define __EGI_IOTCLIENT__ 11 | 12 | #include "egi.h" 13 | 14 | void egi_iotclient(EGI_PAGE *page); /* a page runner function */ 15 | 16 | 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /lib/libegi.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/lib/libegi.a -------------------------------------------------------------------------------- /lib/libegi.so: -------------------------------------------------------------------------------- 1 | /home/midas-zhou/wegi/lib/libegi.so.1.0.0 -------------------------------------------------------------------------------- /lib/libegi.so.1: -------------------------------------------------------------------------------- 1 | /home/midas-zhou/wegi/lib/libegi.so.1.0.0 -------------------------------------------------------------------------------- /lib/libegi.so.1.0.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/lib/libegi.so.1.0.0 -------------------------------------------------------------------------------- /lib/libepages.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/lib/libepages.a -------------------------------------------------------------------------------- /lib/libesound.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/lib/libesound.a -------------------------------------------------------------------------------- /neo_lcd_wiring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/neo_lcd_wiring.png -------------------------------------------------------------------------------- /nnc/actfs.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | Midas Zhou 8 | -----------------------------------------------------------------------*/ 9 | #ifndef __ACTFS_H__ 10 | #define __ACTFS_H__ 11 | 12 | #define DERIVATIVE_FUNC 1 /* to switch to derivative calculation in a function */ 13 | #define NORMAL_FUNC 0 14 | 15 | double func_step(double x, double f, int token); 16 | double func_sigmoid(double x, double f, int token); 17 | double func_TanSigmoid(double x, double f, int token); 18 | double func_ReLU(double x, double f, int token); 19 | double func_PReLU(double x, double f, int token); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /old/container: -------------------------------------------------------------------------------- 1 | egi.h: * 4. In a type_slider ebox, it is coupled/linked with ebox->x0,y0, they are concentric. 2 | egi.h: 1. initialization job for the ebox and ebox->egi_data. 3 | egi.h: 2. update ebox->egi_data and do some job here ---------. 4 | egi.h: * of those chars should not exceeds ebox->width, ---xxx-- or it may display in 5 | egi.h:// uint16_t font_color; use ebox->tag_color instead /* tag font color, defaul is black */ 6 | egi.h: * if ebox->prmcolor <0 && data_btn->icon ==NULL 7 | egi.h:// EGI_IMGBUF *imgbuf; !!! Apply ebox->frame_img instead !!! 8 | egi_image.h: frame_none=100, /* incoporate with ebox->frame, <100 */ 9 | egi_slider.h: int twidth, int theight, /* for touch area,which is coupled with ebox->x0,y0 */ 10 | -------------------------------------------------------------------------------- /old/egi_font.c: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | A FreeType based font process module. 7 | 8 | 9 | Midas Zhou 10 | ------------------------------------------------------------------------*/ 11 | #if 0 12 | #include 13 | //#include 14 | //#include 15 | #include 16 | #include "egi_common.h" 17 | //#include "egi_image.h" 18 | //#include "egi_utils.h" 19 | 20 | 21 | FT_Library font_library; 22 | FT_Face font_face; 23 | 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /old/egi_font.dep: -------------------------------------------------------------------------------- 1 | egi_font : egi_font.c 2 | -------------------------------------------------------------------------------- /old/egi_font.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/old/egi_font.o -------------------------------------------------------------------------------- /old/egi_list_H: -------------------------------------------------------------------------------- 1 | #ifndef __EGI_LIST_H__ 2 | #define __EGI_LIST_H__ 3 | 4 | #include "egi.h" 5 | 6 | 7 | #define LIST_ITEM_MAXLINES 10 /* MAX number of txt line for each list item */ 8 | #define LIST_DEFAULT_BKCOLOR WEGI_COLOR_GRAY /*default list item bkcolor */ 9 | 10 | typedef struct egi_list EGI_LIST; 11 | 12 | struct egi_list 13 | { 14 | /* left point coordinates */ 15 | int x0; 16 | int y0; 17 | 18 | /* total number of items in a list */ 19 | int inum; 20 | 21 | /* ----- for all txt ebox -------- 22 | in pixel, 23 | width and height for each list item 24 | the height also may be adjusted according to number of txt lines and icon later 25 | */ 26 | // int width; 27 | // int height; 28 | 29 | /* ----- for all txt ebox -------- 30 | in byte, length of each txt line */ 31 | // int llen; 32 | 33 | /* a list of type_txt ebox */ 34 | EGI_EBOX **txt_boxes; 35 | 36 | /* ----- for all txt ebox -------- 37 | frame type, to see egi_ebox.c 38 | -1 no frame 39 | 0 simple 40 | .... 41 | */ 42 | // int frame; 43 | 44 | /* ----- for all txt ebox -------- 45 | sympg font for the txt ebox */ 46 | // struct symbol_page *font; 47 | 48 | /* ----- for all txt ebox -------- 49 | offset of txt from the ebox */ 50 | // int txtoffx; 51 | // int txtoffy; 52 | 53 | /* 54 | sympg icon for each list item 55 | NULL means no icon 56 | */ 57 | struct symbol_page **icons; 58 | int *icon_code; 59 | 60 | /* offset of icon from the ebox */ 61 | int iconoffx; 62 | int iconoffy; 63 | 64 | /* 65 | prime_color/back_color for each list item, 66 | or use first bkcolor as default color 67 | init default color in egi_list_new() 68 | */ 69 | uint16_t *prmcolor; 70 | 71 | /* 72 | color for each txt line in a list item. 73 | if null, use default as black 0. 74 | ALL BLACK now !!!!! 75 | */ 76 | //uint16_t (*txtcolor)[LIST_ITEM_MAXLINES]; 77 | 78 | }; 79 | 80 | 81 | /* functions for list */ 82 | EGI_LIST *egi_list_new ( 83 | int x0, int y0, /* left top point */ 84 | int inum, /* item number of a list */ 85 | int width, /* h/w for each list item - ebox */ 86 | int height, 87 | int frame, /* -1 no frame for ebox, 0 simple .. */ 88 | int nl, /* number of txt lines for each txt ebox */ 89 | int llen, /* in byte, length for each txt line */ 90 | struct symbol_page *font, /* txt font */ 91 | int txtoffx, /* offset of txt from the ebox, all the same */ 92 | int txtoffy, 93 | int iconoffx, /* offset of icon from the ebox, all the same */ 94 | int iconoffy 95 | ); 96 | int egi_list_free(EGI_LIST *list); 97 | int egi_list_activate(EGI_LIST *list); 98 | int egi_list_refresh(EGI_LIST *list); 99 | int egi_list_updateitem(EGI_LIST *list, int n, uint16_t prmcolor, char **data); 100 | 101 | 102 | #endif 103 | -------------------------------------------------------------------------------- /old/fbmp_op.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -----------------------------------------------------------------*/ 8 | 9 | #ifndef ___FBMP_OP_H__ 10 | #define ___FBMP_OP_H__ 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include //stat() 17 | #include 18 | 19 | #define STRBUFF 256 /* length of file path&name in g_BMP_file_name[][STRBUFF] */ 20 | #define MAX_FBMP_NUM 256 /* Max. number of bmp files in g_BMP_file_name[MAX_FBMP_NUM][] */ 21 | #define MIN_CHECK_SIZE 1000 /* for checking integrity of BMP file */ 22 | 23 | /* for BMP files */ 24 | char file_path[256]; 25 | char g_BMP_file_name[MAX_FBMP_NUM][STRBUFF]; /* BMP file directory and name */ 26 | int g_BMP_file_num=0; /* BMP file name index */ 27 | int g_BMP_file_total=0; /* total number of BMP files */ 28 | 29 | 30 | /*------------------------------------------ 31 | get file size 32 | return: 33 | >0 ok 34 | <0 fail 35 | -------------------------------------------*/ 36 | unsigned long get_file_size(const char *fpath) 37 | { 38 | unsigned long filesize=-1; 39 | struct stat statbuff; 40 | if(stat(fpath,&statbuff)<0) 41 | { 42 | return filesize; 43 | } 44 | else 45 | { 46 | filesize = statbuff.st_size; 47 | } 48 | return filesize; 49 | } 50 | 51 | 52 | /* -------------------------------------------- 53 | find out all BMP files in a specified directory 54 | return value: 55 | 0 --- OK 56 | <0 --- fails 57 | ----------------------------------------------*/ 58 | static int Find_BMP_files(char* path) 59 | { 60 | DIR *d; 61 | struct dirent *file; 62 | int fn_len; 63 | 64 | g_BMP_file_total=0; //--reset total file number 65 | g_BMP_file_num=0; //--reset file index 66 | 67 | //----clear g_BMP_file_name[] ------- 68 | bzero(&g_BMP_file_name[0][0],MAX_FBMP_NUM*STRBUFF); 69 | 70 | //-------- if open dir error ------ 71 | if(!(d=opendir(path))) 72 | { 73 | printf("error open dir: %s !\n",path); 74 | return -1; 75 | } 76 | 77 | while((file=readdir(d))!=NULL) 78 | { 79 | //------- find out all bmp files -------- 80 | fn_len=strlen(file->d_name); 81 | if(strncmp(file->d_name+fn_len-4,".bmp",4)!=0 ) 82 | continue; 83 | strncpy(g_BMP_file_name[g_BMP_file_num++],file->d_name,fn_len); 84 | g_BMP_file_total++; 85 | } 86 | 87 | closedir(d); 88 | return 0; 89 | } 90 | 91 | 92 | #endif 93 | 94 | -------------------------------------------------------------------------------- /old/image_test_C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "egi_fbgeom.h" 4 | #include "egi_image.h" 5 | #include "egi_bmpjpg.h" 6 | 7 | 8 | extern void *_binary_buttons_img_start; 9 | 10 | 11 | void main(void) 12 | { 13 | 14 | EGI_IMGBUF imgbuf; 15 | imgbuf.imgbuf=(uint16_t *)_binary_buttons_img_start; 16 | 17 | /* 18 | int egi_imgbuf_windisplay(const EGI_IMGBUF *egi_imgbuf, FBDEV *fb_dev, int xp, int yp, 19 | int xw, int yw, int winw, int winh) 20 | */ 21 | 22 | egi_imgbuf_windisplay( &imgbuf, &gv_fb_dev, 0, 0, 0, 0, 240, 320 ); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /old/jpgshow_C: -------------------------------------------------------------------------------- 1 | /*--------------- jpgshow.c -------------------- 2 | -------------------------------------------------*/ 3 | #include 4 | #include 5 | #include "egi_bmpjpg.h" 6 | 7 | int main(int argc, char **argv) 8 | { 9 | int ret=0; 10 | FBDEV fr_dev; 11 | 12 | /* prepare fb device */ 13 | fr_dev.fdfd=-1; 14 | init_dev(&fr_dev); 15 | 16 | ret=show_jpg(argv[1],&fr_dev,0,0,0);/* 0-BALCK_ON, 1-BLACK_OFF */ 17 | if(ret!=0) 18 | printf("jpgshow() fails!\n"); 19 | 20 | /* delete fb map and close fb dev */ 21 | release_dev(&fr_dev); 22 | 23 | return ret; 24 | } 25 | 26 | -------------------------------------------------------------------------------- /old/mjpgshow_C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | //#include 4 | //#include "spi.h" 5 | //#include "fblines.h" 6 | #include "bmpjpg.h" 7 | 8 | int main(int argc, char **argv) 9 | { 10 | int ret=0; 11 | FBDEV fr_dev; 12 | 13 | /* prepare fb device */ 14 | fr_dev.fdfd=-1; 15 | init_dev(&fr_dev); 16 | 17 | ret=show_jpg(argv[1],&fr_dev,0,100); 18 | if(ret!=0) 19 | printf("jpgshow() fails!\n"); 20 | 21 | /* delete fb map and close fb dev */ 22 | release_dev(&fr_dev); 23 | 24 | return ret; 25 | } 26 | 27 | -------------------------------------------------------------------------------- /old/read_objimg_C: -------------------------------------------------------------------------------- 1 | /*-------------------- read_objimg.c -------------------- 2 | test reading img data embedded in an obj file. 3 | 4 | --------------------------------------------------------*/ 5 | #include 6 | #include 7 | #include "egi_fbgeom.h" 8 | #include "egi_image.h" 9 | #include "egi_bmpjpg.h" 10 | 11 | 12 | extern char _binary_buttons_img_start[]; 13 | 14 | int main(void) 15 | { 16 | EGI_IMGBUF imgbuf; 17 | 18 | /* --- prepare fb device --- */ 19 | gv_fb_dev.fdfd=-1; 20 | init_dev(&gv_fb_dev); 21 | 22 | 23 | 24 | imgbuf.width=240; 25 | imgbuf.height=320; 26 | 27 | 28 | imgbuf.imgbuf=(uint16_t *)_binary_buttons_img_start; 29 | 30 | /* 31 | int egi_imgbuf_windisplay(const EGI_IMGBUF *egi_imgbuf, FBDEV *fb_dev, int xp, int yp, 32 | int xw, int yw, int winw, int winh) 33 | */ 34 | 35 | egi_imgbuf_windisplay( &imgbuf, &gv_fb_dev, 0, 0, 0, 0, 240, 320 ); 36 | 37 | /* close fb dev */ 38 | munmap(gv_fb_dev.map_fb,gv_fb_dev.screensize); 39 | close(gv_fb_dev.fdfd); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /open-gcc: -------------------------------------------------------------------------------- 1 | /home/midas-zhou/openwrt_widora/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc -------------------------------------------------------------------------------- /open_ar: -------------------------------------------------------------------------------- 1 | /home/midas-zhou/openwrt_widora/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-ar -------------------------------------------------------------------------------- /open_nm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/open_nm -------------------------------------------------------------------------------- /open_objcopy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/open_objcopy -------------------------------------------------------------------------------- /open_objdump: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/open_objdump -------------------------------------------------------------------------------- /open_strip: -------------------------------------------------------------------------------- 1 | /home/midas-zhou/openwrt_widora/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-strip -------------------------------------------------------------------------------- /page/Makefile: -------------------------------------------------------------------------------- 1 | export STAGING_DIR=/home/midas-zhou/openwrt_widora/staging_dir 2 | COMMON_USRDIR=/home/midas-zhou/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/ 3 | 4 | CC= $(STAGING_DIR)/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc 5 | AR= $(STAGING_DIR)/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-ar 6 | 7 | SRC_PATH = /home/midas-zhou/Ctest/wegi 8 | 9 | 10 | #### ----- 产生文件列表 ------ 11 | SRC_FILES = $(wildcard *.c) 12 | OBJS = $(patsubst %.c, %.o, $(SRC_FILES)) 13 | 14 | $(warning "----- OBJS:$(OBJS) -----") 15 | 16 | ##--- exclude some objs !!!BEWARE, :NO SPACE ---- 17 | #OBJS := $(OBJS:test_color.o=) 18 | 19 | DEP_FILES = $(patsubst %.c, %.dep, $(SRC_FILES)) 20 | 21 | 22 | #### ----- 编译标志 ----- 23 | ## -Wall for __attribut__ 24 | CFLAGS := -I./ -I../ -I../iot -I../ffmpeg -I../utils -I../heweather 25 | CFLAGS += -I$(COMMON_USRDIR)/include -I$(COMMON_USRDIR)/include/json-c 26 | CFLAGS += -I$(COMMON_USRDIR)/include/freetype2 27 | CFLAGS += -Wall -O2 28 | CFLAGS += -D_GNU_SOURCE ## for O_CLOEXEC flag ## 29 | #### --- for debug, put before LDFLAGS!!!! ---- 30 | #CFLAGS += -g -DEGI_DEBUG 31 | 32 | LDFLAGS += -L./lib -L$(COMMON_USRDIR)/lib 33 | LIBS += -legi -ljpeg -lm -lpthread 34 | 35 | 36 | #### ------ 手动设置特定目标生成规则 ------ 37 | libepages.a: $(OBJS) 38 | $(AR) crv libepages.a $(OBJS) 39 | 40 | # $(CC) -shared -soname libegi.so.1 $(OBJS) -o libegi.so.1.0.0 41 | 42 | install: libepages.a 43 | mv libepages.a $(SRC_PATH)/lib 44 | 45 | #### ----- 目标文件自动生成规则 ----- 46 | %:%.c $(DEP_FILES) 47 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -c -o $@ $@.c 48 | 49 | #### ----- 清除目标 ----- 50 | clean: 51 | rm -rf *.o $(OBJS) $(DEP_FILES) libepages.a 52 | 53 | 54 | include $(DEP_FILES) 55 | $(warning "----- %.dep: %.c -----") 56 | #### ---- 依赖文件自动生成规则 ----- 57 | %.dep: %.c 58 | @set -e; rm -f $@ 59 | @$(CC) -MM $(CFLAGS) $< > $@.123 60 | @sed 's,\($*\)\.o[: ]*,\1 : ,g' < $@.123 > $@ 61 | cat $@.123 62 | 63 | 64 | #------- \1 表示第一个$(*)所代表的内容 65 | @rm -f $@.123 66 | 67 | 68 | #----- 下面这个会被执行两遍 --------- 69 | $(warning "----- end -----") 70 | 71 | #------------------------------------------------------------------------------------------- 72 | # 73 | # 自动依赖的例子: 74 | # midas-zhou@midas-hp:~/apptest$ gcc -MM fbin_r.c | sed 's,\($*\)\.o[: ]*,\1 : ,g' 75 | # fbin_r : fbin_r.c fbin.h 76 | # 77 | # gcc -M fbin_r.c 会将标准库的头文件也包括进来,用 gcc -MM 就不会了。 78 | # 79 | #------------------------------------------------------------------------------------------- 80 | -------------------------------------------------------------------------------- /page/egi_appstock.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | midaszhou@yahoo.com 8 | ------------------------------------------------------------------------------------------------*/ 9 | #ifndef __EGI_APPSTOCK_H__ 10 | #define __EIG_APPSTOCK_H__ 11 | 12 | #include "egi.h" 13 | 14 | #define HTTP_REQUEST_INTERVAL 500 /* request interval time in ms */ 15 | 16 | /* data compression type */ 17 | enum stock_compress_type { 18 | none, /* when new data comes, shift data_point[] to drop data_point[0] 19 | * then save the latest data into data_point[num-1] 20 | */ 21 | interpolation, /* when new data comes, update all data_point[] by interpolation */ 22 | common_avg, /* when new data comes, update all data_point[] by different weights */ 23 | fold_avg, /* avg data_point[0], then [1], then[2].... */ 24 | }; 25 | 26 | void *egi_stockchart(EGI_PAGE *page); 27 | 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /page/egi_pagebook.h: -------------------------------------------------------------------------------- 1 | #ifndef __EGI_PAGEBOOK_H__ 2 | #define __EGI_PAGEBOOK_H__ 3 | 4 | #include "egi.h" 5 | 6 | EGI_PAGE *egi_create_bookpage(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /page/egi_pagehome.h: -------------------------------------------------------------------------------- 1 | #ifndef __EGI_PAGEHOME_H__ 2 | #define __EGI_PAGEHOME_H__ 3 | 4 | #include "egi.h" 5 | 6 | #define HOME_PAGE_MAX 5 /* max home page num. */ 7 | 8 | EGI_PAGE *egi_create_homepage(void); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /page/egi_pagemplay.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -----------------------------------------------------------------*/ 8 | 9 | #ifndef __EGI_PAGEMPLAY__ 10 | #define __EGI_PAGEMPLAY__ 11 | 12 | #include "egi.h" 13 | 14 | EGI_PAGE *egi_create_mplaypage(void); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /page/egi_pageopenwrt.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -----------------------------------------------------------------*/ 8 | 9 | #ifndef __EGI_PAGEOPENWRT_H__ 10 | #define __EGI_PAGEOPENWRT_H__ 11 | 12 | #include "egi.h" 13 | 14 | EGI_PAGE *egi_create_openwrtpage(void); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /page/egi_pageslide.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -----------------------------------------------------------------*/ 8 | 9 | #ifndef __EGI_PAGESLIDE_H__ 10 | #define __EGI_PAGESLIDE_H__ 11 | 12 | #include "egi.h" 13 | 14 | EGI_PAGE *egi_create_slidepage(void); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /page/egi_pagestock.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -----------------------------------------------------------------*/ 8 | 9 | #ifndef __EGI_PAGESTOCK__ 10 | #define __EGI_PAGESTOCK__ 11 | 12 | #include "egi.h" 13 | 14 | EGI_PAGE *egi_create_pagestock(void); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /page/egi_pagetest.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -----------------------------------------------------------------*/ 8 | #ifndef __EGI_PAGETEST_H__ 9 | #define __EGI_PAGETEST_H__ 10 | 11 | #include "egi.h" 12 | 13 | EGI_PAGE *egi_create_testpage(void); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /pclib/libegi.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/pclib/libegi.a -------------------------------------------------------------------------------- /pclib/libegi.so: -------------------------------------------------------------------------------- 1 | /home/midas-zhou/wegi/pclib/libegi.so.1.0.0 -------------------------------------------------------------------------------- /pclib/libegi.so.1: -------------------------------------------------------------------------------- 1 | /home/midas-zhou/wegi/pclib/libegi.so.1.0.0 -------------------------------------------------------------------------------- /pclib/libegi.so.1.0.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/pclib/libegi.so.1.0.0 -------------------------------------------------------------------------------- /pclib/libepages.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/pclib/libepages.a -------------------------------------------------------------------------------- /pclib/libesound.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/pclib/libesound.a -------------------------------------------------------------------------------- /png/Makefile: -------------------------------------------------------------------------------- 1 | 2 | export STAGING_DIR=/home/midas-zhou/openwrt_widora/staging_dir 3 | COMMON_USRDIR=/home/midas-zhou/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr 4 | SRC_PATH=/home/midas-zhou/Ctest/wegi 5 | 6 | CC= $(STAGING_DIR)/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc 7 | 8 | #OBJS += ../utils/egi_utils.o ../utils/egi_fifo.o ../utils/egi_filo.o 9 | 10 | CFLAGS = -I$(COMMON_USRDIR)/include -I../. -I../utils/ 11 | CFLAGS += -I$(COMMON_USRDIR)/include/freetype2 12 | CFLAGS += -Wall -O2 13 | 14 | LDFLAGS += -L$(SRC_PATH)/lib -L$(COMMON_USRDIR)/lib 15 | 16 | 17 | LIBS = -legi 18 | LIBS += -lpng -lz -lm -pthread -ljpeg 19 | #LIBS += -lubox -lubus -lblobmsg_json -ljson_script -ljson-c -pthread 20 | LIBS += -lcurl -lssl -lcrypto -pthread 21 | LIBS += -lfreetype -lm -lz -lbz2 22 | 23 | 24 | APPS = test_png test_blend loop_show 25 | 26 | 27 | all: $(APPS) 28 | 29 | 30 | %:%.c 31 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJS) $@.c -o $@ 32 | 33 | 34 | #loop_show: loop_show.c 35 | # $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJS) loop_show.c -o loop_show 36 | 37 | #test_png: test_png.c 38 | # $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJS) test_png.c -o test_png 39 | 40 | #test_alpha: test_alpha.c 41 | # $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJS) test_alpha.c -o test_alpha 42 | 43 | 44 | clean: 45 | rm -rf *.o $(APPS) 46 | 47 | -------------------------------------------------------------------------------- /png/angel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/png/angel.png -------------------------------------------------------------------------------- /png/loop_show.c: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | A simple test for displaying PNG/JPG files. 7 | 8 | Usage: loop_show path/*.* 9 | 10 | 11 | Midas Zhou 12 | midaszhou@yahoo.com 13 | ----------------------------------------------------------------------------*/ 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include "egi_fbgeom.h" 20 | #include "egi_bjp.h" 21 | #include "egi_image.h" 22 | #include "egi_color.h" 23 | 24 | #define PNG_FIXED_POINT_SUPPORTED /* for read */ 25 | #define PNG_READ_EXPAND_SUPPORTED 26 | 27 | int main(int argc, char **argv) 28 | { 29 | int ret=0; 30 | int n; 31 | 32 | EGI_IMGBUF eimg={0}; 33 | 34 | if( argc<2 ) { 35 | printf("Please enter png file name!\n"); 36 | return -1; 37 | } 38 | 39 | /* --- prepare fb device --- */ 40 | init_fbdev(&gv_fb_dev); 41 | 42 | /* display all png files in input list */ 43 | for(n=1; n>>>>>> */ 58 | printf("Flush pixel data in FILO, start ---> "); 59 | fb_filo_flush(&gv_fb_dev); /* flush and restore old FB pixel data */ 60 | fb_filo_on(&gv_fb_dev); /* start collecting old FB pixel data */ 61 | 62 | /* window_position displaying */ 63 | #if 0 64 | int dw,dh; /* displaying window width and height */ 65 | dw=eimg.width>240?240:eimg.width; 66 | dh=eimg.height>320?320:eimg.height; 67 | egi_imgbuf_windisplay(&eimg, &gv_fb_dev, -1, 0, 0, 0, 0, dw, dh); 68 | // egi_imgbuf_windisplay2(&eimg, &gv_fb_dev, 0, 0, 0, 0, dw, dh); 69 | #elif 1 /* test subimage and subcolor */ 70 | EGI_IMGBOX subimg; 71 | subimg.x0=0; subimg.y0=0; 72 | subimg.w=eimg.width; subimg.h=eimg.height; 73 | eimg.subimgs=&subimg; 74 | eimg.submax=0; 75 | egi_subimg_writeFB(&eimg, &gv_fb_dev, 0, -1, 0, 0); 76 | // egi_subimg_writeFB(&eimg, &gv_fb_dev, 0, WEGI_COLOR_WHITE, 93, 240); 77 | #else 78 | egi_imgbuf_windisplay(&eimg, &gv_fb_dev, -1,0, 0, 70, 220, eimg.width, eimg.height); 79 | #endif 80 | /* <<<<<<< Turn off FILO >>>>>>> */ 81 | fb_filo_off(&gv_fb_dev); 82 | 83 | //sleep(1); 84 | usleep(500000); 85 | egi_imgbuf_cleardata(&eimg); 86 | 87 | /* loop ... */ 88 | if(n==(argc-1)) 89 | n=0; 90 | 91 | } /* end of for() */ 92 | 93 | release_fbdev(&gv_fb_dev); 94 | 95 | return ret; 96 | } 97 | -------------------------------------------------------------------------------- /png/pngtest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/png/pngtest.png -------------------------------------------------------------------------------- /png/test_blend.c: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | A simple test for displaying PNG files with input alpha value for deducing. 7 | 8 | Usage: test_blend path alpha_value 9 | 10 | Midas Zhou 11 | midaszhou@yahoo.com 12 | ----------------------------------------------------------------------------*/ 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include "egi_fbgeom.h" 19 | #include "egi_bjp.h" 20 | #include "egi_image.h" 21 | #include "egi_color.h" 22 | 23 | #define PNG_FIXED_POINT_SUPPORTED /* for read */ 24 | #define PNG_READ_EXPAND_SUPPORTED 25 | 26 | int main(int argc, char **argv) 27 | { 28 | int ret=0; 29 | int py; 30 | int da; /* delta alpha */ 31 | int i; 32 | EGI_IMGBUF *eimg=egi_imgbuf_new(); 33 | 34 | if( argc<2 ) { 35 | printf("Please enter png file name!\n"); 36 | return -1; 37 | } 38 | if( argc > 2) 39 | py=atoi(argv[2]); 40 | else 41 | py=0; 42 | if( argc > 3) 43 | da=atoi(argv[3]); 44 | else 45 | da=0; 46 | 47 | /* --- prepare fb device --- */ 48 | init_fbdev(&gv_fb_dev); 49 | 50 | /* load image data to EGI_IMGBUF */ 51 | if( egi_imgbuf_loadpng(argv[1], eimg ) ==0 ) { 52 | } 53 | else if( egi_imgbuf_loadjpg(argv[1], eimg ) ==0 ) { 54 | } 55 | else { 56 | egi_imgbuf_free(eimg); 57 | return -2; 58 | } 59 | 60 | /* adjust opacity */ 61 | for(i=0; i< (eimg->width * eimg->height); i++) { 62 | if(eimg->alpha[i]!=0) { 63 | if((int)(eimg->alpha)[i] < da) 64 | (eimg->alpha)[i]=0; 65 | else 66 | (eimg->alpha)[i]-=da; 67 | } 68 | } 69 | 70 | /* window_position displaying */ 71 | #if 1 72 | int dw,dh; /* displaying window width and height */ 73 | dw=eimg->width>240?240:eimg->width; 74 | dh=eimg->height>320?320:eimg->height; 75 | egi_imgbuf_windisplay(eimg, &gv_fb_dev, -1, 0, 0, 0, py, dw, dh); 76 | #else 77 | egi_imgbuf_windisplay(eimg, &gv_fb_dev, 0, 0, 70, 220, eimg->width, eimg->height); 78 | #endif 79 | 80 | 81 | egi_imgbuf_free(eimg); 82 | release_fbdev(&gv_fb_dev); 83 | 84 | return ret; 85 | } 86 | -------------------------------------------------------------------------------- /prototype.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/prototype.jpg -------------------------------------------------------------------------------- /sound/Makefile: -------------------------------------------------------------------------------- 1 | export STAGING_DIR=/home/midas-zhou/openwrt_widora/staging_dir 2 | COMMON_USRDIR=/home/midas-zhou/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/ 3 | 4 | CC= $(STAGING_DIR)/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc 5 | AR= $(STAGING_DIR)/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-ar 6 | 7 | SRC_PATH = /home/midas-zhou/wegi 8 | 9 | APP = test_pcmbuf recmp3 test_snd test_tone test_recplay 10 | #shine_test2 11 | #autorecord4 12 | 13 | #OBJS = egi_pcm.o 14 | 15 | CFLAGS = -I./ 16 | CFLAGS += -I$(SRC_PATH) -I$(SRC_PATH)/utils -I$(SRC_PATH)/iot -I$(SRC_PATH)/sound 17 | CFLAGS += -I$(COMMON_USRDIR)/include 18 | CFLAGS += -I$(COMMON_USRDIR)/include/freetype2 19 | CFLAGS += -I$(COMMON_USRDIR)/include/json-c 20 | 21 | #CFLAGS += -I/home/midas-zhou/openwrt_widora/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/alsa-lib-1.0.2/include 22 | CFLAGS += -Wall -O2 23 | CFLAGS += -D_FILE_OFFSET_BITS=64 24 | 25 | LDFLAGS += -L. 26 | LDFLAGS += -L../lib -L$(COMMON_USRDIR)/lib 27 | #LDFLAGS += -I/home/midas-zhou/openwrt_widora/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/alsa-lib-1.0.2/ipkg-install/usr/lib 28 | 29 | LIBS += -lasound -lshine -lsndfile 30 | LIBS += -lpng -ljpeg -lz 31 | LIBS += -lcurl -lssl -lcrypto 32 | LIBS += -lm -lz -pthread -lbz2 33 | LIBS += -lfreetype 34 | #LIBS += -legi 35 | LIBS += -lgif 36 | 37 | 38 | all: $(APP) 39 | #all: libesound.a 40 | 41 | 42 | autorec: autorec.c 43 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -o autorec autorec.c 44 | 45 | recmp3: recmp3.c 46 | # $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -o recmp3 recmp3.c #--use shared egilib 47 | $(CC) recmp3.c -o recmp3 $(CFLAGS) $(LDFLAGS) -Wl,-Bdynamic $(LIBS) \ 48 | -Wl,-Bstatic -lesound -legi -Wl,-Bdynamic 49 | #---use static egilib !!!! -lesound needs -legi, which needs LIBS !!!! 50 | 51 | test_minimad: test_minimad.c 52 | $(CC) test_minimad.c -o test_minimad $(CFLAGS) $(LDFLAGS) -Wl,-Bdynamic $(LIBS) \ 53 | -Wl,-Bstatic -lesound -legi -Wl,-Bdynamic -lmad 54 | 55 | test_pcmbuf: test_pcmbuf.c 56 | $(CC) -o test_pcmbuf test_pcmbuf.c $(CFLAGS) $(LDFLAGS) -Wl,-Bdynamic $(LIBS) -Wl,-Bstatic -lesound -legi \ 57 | -Wl,-Bdynamic 58 | 59 | test_snd: test_snd.c 60 | $(CC) -o test_snd test_snd.c $(CFLAGS) $(LDFLAGS) $(LIBS) -lesound 61 | 62 | sndfile-to-text: sndfile-to-text.c 63 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -o sndfile-to-text sndfile-to-text.c 64 | 65 | test_tone: test_tone.c 66 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -o test_tone test_tone.c 67 | 68 | test_recplay: test_recplay.c 69 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -o test_recplay test_recplay.c 70 | 71 | libesound.a: egi_pcm.o 72 | $(AR) crv $@ egi_pcm.o 73 | 74 | egi_pcm.o: egi_pcm.c egi_pcm.h 75 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -c egi_pcm.c 76 | 77 | install: 78 | cp -rf libesound.a $(SRC_PATH)/lib 79 | rm libesound.a 80 | 81 | clean: 82 | rm -rf $(APP) *.o libesound.a 83 | 84 | -------------------------------------------------------------------------------- /sound/PC_Makefile: -------------------------------------------------------------------------------- 1 | SRC_PATH = /home/midas-zhou/wegi 2 | 3 | CFLAGS = -I./ 4 | CFLAGS += -I$(SRC_PATH) -I$(SRC_PATH)/utils -I$(SRC_PATH)/iot -I$(SRC_PATH)/sound 5 | ## for alsa/asoundlib.h 6 | CFLAGS += -I/home/midas-zhou/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include 7 | CFLAGS += -I/home/midas-zhou/shine-3.1.0/finish/include 8 | 9 | CFLAGS += -I/usr/local/include/freetype2 10 | CFLAGS += -I/usr/local/include/libpng12 11 | CFLAGS += -I/usr/local/include 12 | 13 | CFLAGS += -Wall -O2 14 | 15 | LDFLAGS += -L$(SRC_PATH)/pclib 16 | LDFLAGS += -L/usr/local/lib/ 17 | LDFLAGS += -L/usr/lib 18 | LDFLAGS += -L/lib 19 | LDFLAGS += -L/lib/i386-linux-gnu 20 | #LDFLAGS += -L/lib/x86_64-linux-gnu 21 | #LDFLAGS += -L/usr/lib/i386-linux-gnu 22 | #LDFLAGS += -L/usr/lib/x86_64-linux-gnu 23 | LDFLAGS += -L/home/midas-zhou/shine-3.1.0/finish/lib 24 | 25 | 26 | 27 | ## in LETS_NOTE: ln -s libasound.so.2.0.0 libasound.so 28 | LIBS += -lasound -lshine -lsndfile 29 | LIBS += -lpng12 30 | LIBS += -lz -lm -pthread -ljpeg 31 | LIBS += -lfreetype 32 | #LIBS += -lcurl -lssl -lcrypto 33 | #LIBS += -lbz2 34 | #LIBS += -legi 35 | #LIBS += -lgif 36 | 37 | 38 | all: $(APP) libesound.a 39 | 40 | recmp3: recmp3.c 41 | # $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -o recmp3 recmp3.c #--use shared egilib 42 | $(CC) recmp3.c -o recmp3 $(CFLAGS) $(LDFLAGS) -Wl,-Bdynamic $(LIBS) \ 43 | -Wl,-Bstatic -lesound -legi -Wl,-Bdynamic $(LIBS) 44 | #---use static egilib !!!! -lesound needs -legi, with needs LIBS !!!! 45 | 46 | test_pcmbuf: test_pcmbuf.c 47 | $(CC) -o test_pcmbuf test_pcmbuf.c $(CFLAGS) $(LDFLAGS) $(LIBS) -lesound -pthread 48 | 49 | test_snd: test_snd.c 50 | $(CC) -o test_snd test_snd.c $(CFLAGS) $(LDFLAGS) $(LIBS) -lesound 51 | 52 | sndfile-to-text: sndfile-to-text.c 53 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -o sndfile-to-text sndfile-to-text.c 54 | 55 | test_tone: test_tone.c 56 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -o test_tone test_tone.c 57 | 58 | test_recplay: test_recplay.c 59 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -o test_recplay test_recplay.c 60 | 61 | libesound.a: egi_pcm.o 62 | $(AR) crv $@ egi_pcm.o 63 | 64 | egi_pcm.o: egi_pcm.c egi_pcm.h 65 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -c egi_pcm.c 66 | 67 | install: 68 | cp -rf libesound.a $(SRC_PATH)/pclib 69 | rm libesound.a 70 | 71 | clean: 72 | rm -rf $(APP) *.o libesound.a 73 | 74 | -------------------------------------------------------------------------------- /sound/pcm2wav.h: -------------------------------------------------------------------------------- 1 | 2 | /*-------------------------------------------------------------------------- 3 | Quote from : http://blog.csdn.net/leixiaohua1020/article/details/50534316 4 | 5 | ------- Convert PCM16LE raw data to WAVE format ---------- 6 | 7 | ----------------------------------------------------------------------------*/ 8 | 9 | #ifndef __PCM2WAV_H__ 10 | #define __PCM2WAV_H__ 11 | 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | typedef struct WAVE_HEADER{ 18 | char fccID[4]; 19 | unsigned long dwSize; 20 | char fccType[4]; 21 | }WAVE_HEADER; 22 | 23 | typedef struct WAVE_FMT{ 24 | char fccID[4]; 25 | unsigned long dwSize; 26 | unsigned short wFormatTag; 27 | unsigned short wChannels; 28 | unsigned long dwSamplesPerSec; 29 | unsigned long dwAvgBytesPerSec; 30 | unsigned short wBlockAlign; 31 | unsigned short uiBitsPerSample; 32 | }WAVE_FMT; 33 | 34 | typedef struct WAVE_DATA{ 35 | char fccID[4]; 36 | unsigned long dwSize; 37 | }WAVE_DATA; 38 | 39 | /** 40 | * Convert PCM16LE raw data to WAVE format 41 | * @pcm pcm raw data 42 | * @wavepath input PCM file 43 | * @channels channel number 44 | * @sample_rate sample rate 45 | * @pcm_size pcm data size 46 | */ 47 | int simplest_pcm16le_to_wave(const unsigned char *pcm,const char *wavepath,int channels,int sample_rate, unsigned long pcm_size) 48 | { 49 | 50 | /* set default */ 51 | if(channels==0||sample_rate==0){ 52 | channels = 2; 53 | sample_rate = 44100; 54 | } 55 | 56 | int bits = 16; /* sample depth */ 57 | WAVE_HEADER pcmHEADER; 58 | WAVE_FMT pcmFMT; 59 | WAVE_DATA pcmDATA; 60 | 61 | unsigned short m_pcmData; 62 | FILE *fpout; 63 | 64 | fpout=fopen(wavepath, "wb+"); 65 | if(fpout == NULL) { 66 | printf("create wav file error\n"); 67 | return -1; 68 | } 69 | 70 | /* WAVE_HEADER */ 71 | memcpy(pcmHEADER.fccID,"RIFF",strlen("RIFF")); 72 | memcpy(pcmHEADER.fccType,"WAVE",strlen("WAVE")); 73 | pcmHEADER.dwSize=44+pcm_size; 74 | fwrite(&pcmHEADER,sizeof(WAVE_HEADER),1,fpout); 75 | 76 | /*WAVE_FMT*/ 77 | pcmFMT.dwSamplesPerSec=sample_rate; 78 | pcmFMT.dwAvgBytesPerSec=pcmFMT.dwSamplesPerSec*sizeof(m_pcmData); 79 | pcmFMT.uiBitsPerSample=bits; 80 | memcpy(pcmFMT.fccID,"fmt ",strlen("fmt ")); 81 | pcmFMT.dwSize=16; 82 | pcmFMT.wBlockAlign=2; 83 | pcmFMT.wChannels=channels; 84 | pcmFMT.wFormatTag=1; 85 | fwrite(&pcmFMT,sizeof(WAVE_FMT),1,fpout); 86 | 87 | /* WAVE_DATA */ 88 | memcpy(pcmDATA.fccID,"data",strlen("data")); 89 | pcmDATA.dwSize=pcm_size; 90 | fwrite(&pcmDATA,sizeof(WAVE_DATA),1,fpout); 91 | 92 | /* write PCM DATA */ 93 | fwrite(pcm, pcm_size, 1, fpout); 94 | 95 | fclose(fpout); 96 | 97 | return 0; 98 | } 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /sound/test_pcmbuf.c: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | test EGI_PCMBUF functions. 7 | 8 | Midas Zhou 9 | ----------------------------------------------------------------------*/ 10 | #include 11 | #include 12 | #include "egi_common.h" 13 | #include "egi_pcm.h" 14 | 15 | static void * thread_play_pcmbuf(void *arg); 16 | 17 | int main(int argc, char** argv) 18 | { 19 | 20 | 21 | // mallopt(M_MMAP_THRESHOLD,512*1024); 22 | 23 | #if 1 /* ------------------ LOOP TEST --------------------- */ 24 | EGI_PCMBUF *pcmbuf=NULL; 25 | if(argc<2) { 26 | printf("Usage: %s wav_file\n",argv[0]); 27 | exit(1); 28 | } 29 | while(1) { 30 | printf("pcmbuf readfile...\n"); 31 | pcmbuf=egi_pcmbuf_readfile(argv[1]); 32 | if(pcmbuf==NULL) 33 | exit(1); 34 | 35 | printf("pcmbuf playback...\n"); 36 | /* const char* dev_name, const EGI_PCMBUF *pcmbuf, int vstep, 37 | unsigned int nf , int nloop, bool *sigstop, bool *sigsynch, bool* sigtrigger */ 38 | egi_pcmbuf_playback("default", pcmbuf, 0, 2048, 0, NULL, NULL, NULL); 39 | 40 | egi_pcmbuf_free(&pcmbuf); 41 | 42 | usleep(100000); 43 | } 44 | #endif /* ------- END LOOP TEST ------- */ 45 | 46 | 47 | #if 0 /* ------------------ THREAD TEST --------------------- */ 48 | int i; 49 | EGI_PCMBUF *pcmbuf[2]={NULL,NULL}; 50 | pthread_t thread_pcm[2]; 51 | 52 | if(argc<3) { 53 | printf("Usage: %s wav_file1 wav_file2\n",argv[0]); 54 | exit(1); 55 | } 56 | 57 | /* Read wav file into EGI_PCMBUF */ 58 | for(i=0; i<2; i++) { 59 | pcmbuf[i]=egi_pcmbuf_readfile(argv[1+i]); 60 | if(pcmbuf==NULL) 61 | exit(1); 62 | } 63 | 64 | /* create thread */ 65 | //int pthread_create(pthread_t *thread, const pthread_attr_t *attr, 66 | // void *(*start_routine) (void *), void *arg); 67 | for(i=0; i<2; i++) { 68 | if( pthread_create( &thread_pcm[i], NULL, thread_play_pcmbuf, (void *)pcmbuf[i] ) !=0 ) 69 | exit(1); 70 | } 71 | 72 | /* joint threads */ 73 | for(i=0; i<2; i++) { 74 | pthread_join(thread_pcm[i],NULL); 75 | } 76 | 77 | #endif /* ------- END THREAD TEST ------- */ 78 | 79 | 80 | return 0; 81 | } 82 | 83 | 84 | 85 | 86 | static void * thread_play_pcmbuf(void *arg) 87 | { 88 | EGI_PCMBUF *pcmbuf=(EGI_PCMBUF *)arg; 89 | 90 | while(1) { 91 | /* const char* dev_name, const EGI_PCMBUF *pcmbuf, int vstep, 92 | unsigned int nf , int nloop, bool *sigstop, bool *sigsynch, bool* sigtrigger */ 93 | 94 | egi_pcmbuf_playback("default", (const EGI_PCMBUF *)pcmbuf, 0, 512, 0, NULL, NULL, NULL); 95 | usleep(10000); 96 | } 97 | 98 | return (void *)0; 99 | } 100 | 101 | -------------------------------------------------------------------------------- /spi.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------- 2 | Based on: 3 | www.cnblogs.com/subo_peng/p/4848260.html 4 | Author: lzy 5 | 6 | Modified by: 7 | Midas Zhou 8 | -------------------------------------------------*/ 9 | #ifndef __SPI_H__ 10 | #define __SPI_H__ 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | /* turn on/off SPI DEBUG */ 25 | #define SPI_DEBUG 0 26 | 27 | extern const char *spi_fdev; 28 | 29 | /* FUCNTION DECLARATION */ 30 | void pabort(const char *s); 31 | int SPI_Transfer( const uint8_t *TxBuf, uint8_t *RxBuf, int len,int ns); 32 | int SPI_Write(const uint8_t *TxBuf, int len); 33 | int SPI_Write_Command_Data(const uint8_t *cmd, int ncmd, const uint8_t *dat, int ndat); 34 | int SPI_Write_then_Read(const uint8_t *TxBuf, int n_tx, uint8_t *RxBuf, int n_rx); 35 | int SPI_Write_then_Write(const uint8_t *TxBuf1, int n_tx1, uint8_t *TxBuf2, int n_tx2); 36 | int SPI_Read(uint8_t *RxBuf, int len); 37 | int SPI_Open(void); 38 | int SPI_Close(void); 39 | int SPI_LookBackTest(void); 40 | 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /sqlite/Makefile: -------------------------------------------------------------------------------- 1 | export STAGING_DIR=/home/midas-zhou/openwrt_widora/staging_dir 2 | COMMON_USRDIR=/home/midas-zhou/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr 3 | 4 | SRC_PATH=/home/midas-zhou/Ctest/wegi 5 | 6 | CC= $(STAGING_DIR)/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc 7 | 8 | # !!!--- to be created and cleaned ---!!! 9 | #OBJ_IOT = ../iot/egi_iotclient.o 10 | 11 | CFLAGS = -I$(SRC_PATH) -I$(SRC_PATH)/utils -I$(SRC_PATH)/iot -I$(SRC_PATH)/sound 12 | CFLAGS += -I$(COMMON_USRDIR)/include 13 | CFLAGS += -I$(COMMON_USRDIR)/include/freetype2 14 | CFLAGS += -I$(COMMON_USRDIR)/include/json-c 15 | 16 | #-I$(SRC_PATH)/page 17 | CFLAGS += -Wall -O2 18 | CFLAGS += -D_GNU_SOURCE 19 | #CFLAGS += -DENABLE_BACK_BUFFER 20 | 21 | LDFLAGS += -L$(SRC_PATH)/lib -L$(COMMON_USRDIR)/lib 22 | 23 | #LIBS = -lepages 24 | #LIBS += -lesound 25 | #LIBS += -lpng -pthread -ljpeg -lasound -lsndfile 26 | ##LIBS += -lcurl -lssl -lcrypto -pthread 27 | ##LIBS += -lubox -lubus -lblobmsg_json -ljson_script -ljson-c 28 | LIBS += -lfreetype 29 | LIBS += -lm -lz -lbz2 30 | LIBS += -lsqlite3 31 | 32 | #--- use static or dynamic libs ----- 33 | EGILIB=dynamic 34 | 35 | #### --- use dynamic and static libs in compilatoin!!! --- 36 | # 1. Exclude dynamic -legi first. 37 | # 2. Use -Wl,Bdynamic and -Wl,Bstatic to switch to dynamic/static libs 38 | # 3. At last, we must switch back to dynamic libs, as default for Linux system runtime setup. 39 | # 4. Source/obj files must be put before all -Wl. 40 | 41 | 42 | ### ----- A template for making test app ----- 43 | ### Usage example: make test TEST_NAME=test_resizeimg EGILIB=static 44 | ### 45 | test: $(TEST_NAME).c 46 | ifeq ($(EGILIB),static) 47 | $(CC) $(TEST_NAME).c -o $(TEST_NAME) $(CFLAGS) $(LDFLAGS) -Wl,-Bdynamic $(LIBS) \ 48 | #-Wl,-Bstatic -legi -Wl,-Bdynamic 49 | else 50 | $(CC) -o $(TEST_NAME) $(TEST_NAME).c $(CFLAGS) $(LDFLAGS) $(LIBS) #-legi -lesound 51 | endif 52 | 53 | ### ------ template end ----- 54 | 55 | 56 | all: $(APPS) 57 | 58 | 59 | test_etouch: test_etouch.c 60 | ifeq ($(EGILIB),static) 61 | $(CC) test_etouch.c -o test_etouch $(CFLAGS) $(LDFLAGS) -Wl,-Bdynamic $(LIBS) \ 62 | -Wl,-Bstatic -legi -lesound -Wl,-Bdynamic 63 | else 64 | $(CC) -o test_etouch test_etouch.c $(CFLAGS) $(LDFLAGS) $(LIBS) -legi -lesound 65 | endif 66 | 67 | 68 | #test_txt: test_txt.c 69 | #ifeq ($(EGILIB),static) 70 | # $(CC) test_txt.c -o test_txt $(CFLAGS) $(LDFLAGS) -Wl,-Bdynamic $(LIBS) \ 71 | #-Wl,-Bstatic -legi -lesound -Wl,-Bdynamic 72 | #else 73 | # $(CC) -o test_txt test_txt.c $(CFLAGS) $(LDFLAGS) $(LIBS) -legi -lesound 74 | #endif 75 | 76 | #test_img: test_img.c 77 | #ifeq ($(EGILIB),static) 78 | # $(CC) test_img.c -o test_img $(CFLAGS) $(LDFLAGS) -Wl,-Bdynamic $(LIBS) \ 79 | #-Wl,-Bstatic -legi -lesound -Wl,-Bdynamic 80 | #else 81 | # $(CC) -o test_img test_img.c $(CFLAGS) $(LDFLAGS) $(LIBS) -legi -lesound 82 | #endif 83 | 84 | 85 | 86 | 87 | ### !!! NOTE: put '-o $@ $@.c' ahead of FLAGS and LIBS !!!! 88 | %:%.c 89 | $(CC) -o $@ $@.c $(CFLAGS) $(LDFLAGS) $(LIBS) -legi 90 | # $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $@.c -o $@ 91 | 92 | clean: 93 | rm -rf *.o $(APPS) $(OBJ_IOT) 94 | 95 | -------------------------------------------------------------------------------- /sqlite/sqlite_exec.c: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------------------------- 2 | https://www.sqlite.org/quickstart.html 3 | See also the Introduction To The SQLite C/C++ Interface for an introductory overview 4 | and roadmap to the dozens of SQLite interface functions. 5 | ---------------------------------------------------------------------------------------*/ 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | static int callback(void *NotUsed, int argc, char **argv, char **azColName) 12 | { 13 | int i; 14 | static bool token=false; 15 | 16 | // for(i=0; i 7 | #include 8 | #include 9 | 10 | static int callback(void *NotUsed, int argc, char **argv, char **azColName) { 11 | int i; 12 | for(i = 0; i 7 | #include 8 | #include 9 | 10 | static int callback(void *NotUsed, int argc, char **argv, char **azColName) { 11 | int i; 12 | for(i = 0; i 7 | #include 8 | #include 9 | 10 | static int callback(void *data, int argc, char **argv, char **azColName){ 11 | int i; 12 | fprintf(stderr, "%s: ", (const char*)data); 13 | 14 | for(i = 0; i 12 | #include "egi_matrix.h" 13 | 14 | int main(void) 15 | { 16 | 17 | #if 0 18 | float matAB[3*4]= // row 3, column 4 19 | { 20 | 1,1,1,6, 21 | 3,1,-1,10, 22 | 2,2,5,15 23 | }; 24 | struct float_Matrix mat_AB; 25 | mat_AB.nr=3; mat_AB.nc=4; mat_AB.pmat=matAB; 26 | 27 | printf("matAB:\n"); 28 | Matrix_Print(&mat_AB); 29 | 30 | EGI_MATRIX *matX=init_float_Matrix(3,1); 31 | #else 32 | 33 | float matAB[4*5]= /* 4 rows, 5 columns */ 34 | { 35 | 2,3,4,-5,-6, 36 | 6,7,-8,9,96, 37 | 10,11,12,13,312, 38 | 14,15,16,17,416 39 | }; 40 | struct float_Matrix mat_AB; 41 | mat_AB.nr=4; mat_AB.nc=5; mat_AB.pmat=matAB; 42 | 43 | printf(" ---- matAB : A*X=B ---- \n"); 44 | Matrix_Print(&mat_AB); 45 | 46 | EGI_MATRIX *matX=init_float_Matrix(4,1); 47 | #endif 48 | 49 | 50 | Matrix_SolveEquations(&mat_AB, matX); 51 | printf(" ---- Result : X ----\n"); 52 | Matrix_Print(matX); 53 | 54 | release_float_Matrix(matX); 55 | 56 | 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /test/pc_udpcam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/test/pc_udpcam -------------------------------------------------------------------------------- /test/pc_udpfile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/test/pc_udpfile -------------------------------------------------------------------------------- /test/pc_usbcam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/test/pc_usbcam -------------------------------------------------------------------------------- /test/pcmaketest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | make -f PC_Makefile EGILIB=static TEST_NAME=$1 4 | -------------------------------------------------------------------------------- /test/pridata.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/widora/wegi/294bef82e12ddd940b501f8fc569d04f4cb4522e/test/pridata.o -------------------------------------------------------------------------------- /test/read_conf.c: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | Test EGI CSTRING functions 8 | 9 | Midas Zhou 10 | -----------------------------------------------------------------*/ 11 | 12 | #include 13 | #include "egi_timer.h" 14 | #include "egi_cstring.h" 15 | 16 | int main(void) 17 | { 18 | char value[64]={0}; 19 | 20 | /* --- start egi tick --- */ 21 | tm_start_egitick(); 22 | 23 | while(1) 24 | { 25 | /* IOT_CLIENT */ 26 | if( egi_get_config_value("IOT_CLIENT", "server_ip", value)==0) 27 | printf("Found KEY server ip:%s\n",value); 28 | else 29 | printf("[IOT_CLIENT]: Key [server_ip] value is NOT found in config file!\n"); 30 | 31 | /* MPLAYER */ 32 | if( egi_get_config_value("EGI_MPLAYER", "playlist", value)==0) 33 | printf("Found KEY playlist:%s\n",value); 34 | else 35 | printf("[EGI_MPLAYER]: Key [playlist] value is NOT found in config file!\n"); 36 | 37 | /* FFPLAY */ 38 | if( egi_get_config_value("EGI_FFPLAY", "video_dir", value)==0) 39 | printf("Found KEY video_dir:%s\n",value); 40 | else 41 | printf("[EGI_FFPLAY]: Key [video_dir] value is NOT found in config file!\n"); 42 | 43 | tm_delayms(500); 44 | } 45 | 46 | 47 | return 0; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /test/surf/Makefile: -------------------------------------------------------------------------------- 1 | include ../Makefile 2 | -------------------------------------------------------------------------------- /test/surf/PC_Makefile: -------------------------------------------------------------------------------- 1 | include ../PC_Makefile 2 | -------------------------------------------------------------------------------- /test/surf/makeall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | all_apps="test_surfman test_surfuser surfman_guider surf_wetradio surf_madplay surf_editor surf_wallpaper surf_book surf_wifiscan surf_tetris" 4 | 5 | if [ ${*} == "clean" ] 6 | then 7 | echo "Clean $all_apps" 8 | rm $all_apps 9 | exit 10 | fi 11 | 12 | for app in $all_apps 13 | do 14 | make test TEST_NAME=$app EGILIB=static 15 | done 16 | -------------------------------------------------------------------------------- /test/surf/maketest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | make test TEST_NAME=$1 EGILIB=static 4 | -------------------------------------------------------------------------------- /test/surf/pc_makeall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | all_apps="test_surfman test_surfuser surfman_guider surf_wetradio surf_madplay surf_editor surf_wallpaper surf_book surf_wifiscan surf_tetris" 4 | 5 | if [ ${*} == "install" ] 6 | then 7 | mv $all_apps ./pc_install 8 | exit 9 | fi 10 | 11 | if [ ${*} == "clean" ] 12 | then 13 | echo "Clean $all_apps" 14 | rm $all_apps 15 | exit 16 | fi 17 | 18 | 19 | for app in $all_apps 20 | do 21 | make -f PC_Makefile test EGILIB=static TEST_NAME=$app 22 | done 23 | -------------------------------------------------------------------------------- /test/surf/pcmaketest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | make -f PC_Makefile test EGILIB=static TEST_NAME=$1 4 | #make -f PC_Makefile test TEST_NAME=$1 5 | -------------------------------------------------------------------------------- /test/test_bigiot.c: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | A program to test BIGIOT client app. 7 | 8 | Midas Zhou 9 | midaszhou@yahoo.com(Not in use since 2022_03_01) 10 | ------------------------------------------------------------------------------------------------*/ 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include "egi_iotclient.h" 16 | #include "egi_timer.h" 17 | #include "egi_fbgeom.h" 18 | #include "egi_symbol.h" 19 | #include "egi_log.h" 20 | 21 | 22 | 23 | /*------------------------------------ 24 | MAIN FUNCTION 25 | ------------------------------------*/ 26 | int main(void) 27 | { 28 | int i,k; 29 | 30 | /* --- init logger --- */ 31 | #if 1 32 | if(egi_init_log("/mmc/log_iot") != 0) 33 | { 34 | printf("Fail to init logger,quit.\n"); 35 | return -1; 36 | } 37 | #endif 38 | 39 | /* --- start egi tick --- */ 40 | // tm_start_egitick(); /* WARNING: log thread tm_delayms() disable!!! */ 41 | 42 | /* --- prepare fb device --- */ 43 | // gv_fb_dev.fdfd=-1; 44 | // init_dev(&gv_fb_dev); 45 | 46 | /* --- load all symbol pages --- */ 47 | // symbol_load_allpages(); 48 | 49 | 50 | /* <<<<<<<<<<<<<<<<<<<<< TEST BIGIOT Client <<<<<<<<<<<<<<<<<<*/ 51 | 52 | egi_iotclient(NULL); 53 | 54 | 55 | /* <<<<<<<<<<<<<<<<<<<<< END TEST <<<<<<<<<<<<<<<<<<*/ 56 | 57 | /* quit logger */ 58 | egi_quit_log(); 59 | 60 | /* close fb dev */ 61 | // munmap(gv_fb_dev.map_fb,gv_fb_dev.screensize); 62 | // close(gv_fb_dev.fdfd); 63 | 64 | return 0; 65 | } 66 | 67 | -------------------------------------------------------------------------------- /test/test_bjp.c: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Test EGI BMPJPG unctions 7 | 8 | Midas Zhou 9 | -------------------------------------------------------------------*/ 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include "egi_timer.h" 16 | #include "egi_fbgeom.h" 17 | #include "egi_color.h" 18 | #include "egi_log.h" 19 | #include "egi.h" 20 | #include "egi_bjp.h" 21 | 22 | int main(int argc, char **argv) 23 | { 24 | char path[128]={0}; 25 | FBDEV fb_dev={ .devname="/dev/fb0", .fbfd=-1, }; 26 | 27 | /* --- init logger --- */ 28 | /* 29 | if(egi_init_log("/mmc/log_color") != 0) 30 | { 31 | printf("Fail to init logger,quit.\n"); 32 | return -1; 33 | } 34 | */ 35 | /* --- start egi tick --- */ 36 | // tm_start_egitick(); 37 | 38 | /* --- prepare fb device --- */ 39 | if(init_fbdev(&fb_dev)!=0) { 40 | printf("Fail to init fbdev!\n"); 41 | exit(EXIT_FAILURE); 42 | } 43 | 44 | /* Set sys FB mode */ 45 | fb_set_directFB(&fb_dev,false); 46 | fb_position_rotate(&fb_dev,0); 47 | 48 | 49 | #if 1 /* -------------- TEST: egi_save_FBpng() ------------- */ 50 | /* get time stamp */ 51 | time_t t=time(NULL); 52 | struct tm *tm=localtime(&t); 53 | 54 | if(argc>1) 55 | sprintf(path,argv[1]); 56 | else { 57 | //sprintf(path,"/tmp/FB%d-%02d-%02d_%02d:%02d:%02d.png", 58 | sprintf(path,"/tmp/FB%d-%02d-%02d_%02d_%02d_%02d.png", 59 | tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour, tm->tm_min,tm->tm_sec); 60 | } 61 | 62 | /* set pos_rotate, WARNING!!! Make sure that screen image is posed the same way! */ 63 | //fb_dev.pos_rotate=1; 64 | egi_save_FBpng(&fb_dev, path); /* imgbuf will rotated as per pos_rotate */ 65 | 66 | exit(0); 67 | #endif 68 | 69 | 70 | #if 0 71 | /* -------------- TEST: egi_save_FBbmp() ------------- */ 72 | /* get time stamp */ 73 | time_t t=time(NULL); 74 | struct tm *tm=localtime(&t); 75 | 76 | if(argc>1) 77 | sprintf(path,argv[1]); 78 | else { 79 | sprintf(path,"/tmp/FB%d-%02d-%02d_%02d:%02d:%02d.bmp", 80 | tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour, tm->tm_min,tm->tm_sec); 81 | } 82 | egi_save_FBbmp(&fb_dev, path); 83 | 84 | // show bmp 85 | // show_bmp(argv[1],&fb_dev,0,0,0);/* 0-BALCK_ON, 1-BLACK_OFF, 0,0-x0y0 */ 86 | // return 0; 87 | exit(0); 88 | #endif /* -------- END TEST ------- */ 89 | 90 | 91 | #if 0 /* -------------- TEST: egi_raompic_inwin() ------------- */ 92 | if( argc < 2 ) { 93 | printf("Usage: %s file\n", argv[0]); 94 | exit(-1); 95 | } 96 | else { 97 | egi_roampic_inwin( argv[1], &fb_dev, /* fpath, fb */ 98 | 10, 100000, 0, 0, 240, 320 ); /* step, ntrip, xw, yw, winw, winh */ 99 | 100 | } 101 | #endif 102 | 103 | 104 | /* quit logger */ 105 | // egi_quit_log(); 106 | 107 | /* close fb dev */ 108 | release_fbdev(&fb_dev); 109 | 110 | return 0; 111 | } 112 | 113 | -------------------------------------------------------------------------------- /test/test_cstring.c: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -----------------------------------------------------------------*/ 8 | 9 | #include 10 | #include 11 | #include "egi_utils.h" 12 | #include "egi_timer.h" 13 | #include "egi_cstring.h" 14 | 15 | 16 | 17 | int main(void) 18 | { 19 | 20 | /* --- start egi tick --- */ 21 | tm_start_egitick(); 22 | 23 | #if 0 ////////////////// 1. TEST: egi_alloc_search_file() ////////////// 24 | 25 | int i; 26 | char (*path)[EGI_PATH_MAX+EGI_NAME_MAX]; 27 | int total; 28 | 29 | while(1) 30 | { 31 | path=egi_alloc_search_files("/mmc/","mp3, wav, png", &total); 32 | printf("Find %d files.\n", total); 33 | for(i=0;i 14 | #include 15 | #include 16 | #include "egi_https.h" 17 | #include "egi_timer.h" 18 | 19 | int main(int argc, char **argv) 20 | { 21 | 22 | 23 | 24 | #if 0 ////////////////// https_easy_getFileSize() //////////////// 25 | long fsize; 26 | 27 | while(1) { 28 | 29 | fsize=https_easy_getFileSize(argv[1]); 30 | printf("Remote file size: %ldBytes\n\n", fsize); 31 | 32 | usleep(200000); 33 | } 34 | #endif ////////////////////////////////////////////////////////////// 35 | 36 | 37 | #if 1 ////////////////// https_easy_mThreadDownload() //////////////// 38 | 39 | struct timeval tms,tme; 40 | int opt; 41 | int nthreads=2; 42 | int timeout=30; 43 | char *url=NULL; 44 | while( (opt=getopt(argc,argv,"hn:t:"))!=-1 ) { 45 | switch(opt) { 46 | case 'h': 47 | printf("%s: -hn:t:\n", argv[0]); 48 | exit(0); 49 | break; 50 | case 'n': 51 | nthreads=atoi(optarg); 52 | break; 53 | case 's': 54 | timeout=atoi(optarg); 55 | break; 56 | } 57 | } 58 | if( optind < argc ) { 59 | url=argv[optind]; 60 | } else { 61 | printf("No URL!\n"); 62 | exit(1); 63 | } 64 | 65 | gettimeofday(&tms, NULL); 66 | //int https_easy_mThreadDownload(int opt, unsigned int nthreads, unsigned int trys, unsigned int timeout, 67 | // const char *file_url, const char *file_save ); 68 | 69 | 70 | https_easy_mThreadDownload( HTTPS_SKIP_PEER_VERIFICATION | HTTPS_SKIP_HOSTNAME_VERIFICATION, nthreads, 0, timeout, 71 | url, "/tmp/multTD.ts" ); 72 | gettimeofday(&tme, NULL); 73 | fprintf(stderr, "Cost time: %ldms\n", tm_diffus(tms,tme)/1000); 74 | 75 | #endif ////////////////////////////////////////////////////////////// 76 | 77 | return 0; 78 | } 79 | -------------------------------------------------------------------------------- /test/test_elf.c: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | An example to convert a normal file to an OBJ file, then compile with 7 | that OBJ file to retrieve the original file. 8 | 9 | Steps: 10 | 1. Convert a JPG file to an OBJ file pridata.o: 11 | xxx_objcopy -I binary -O elf32-tradlittlemips -B mips lake.jpg pridata.o 12 | ( xxx as cross_compile toochain mipsel-openwrt-linux ) 13 | 14 | !!!Note: Put the file in current directory, or the symbol name will be too long !!! 15 | ../open_objcopy -I binary -O elf32-tradlittlemips -B mips ../data/lake.jpg pridata.o 16 | Result in: 17 | 0000000 g .data 00000000 _binary____data_lake_jpg_start 18 | 00003728 g .data 00000000 _binary____data_lake_jpg_end 19 | 00003728 g *ABS* 00000000 _binary____data_lake_jpg_size 20 | 21 | 22 | 2. Compile with above OBJ file: 23 | xxx_gcc -o test_elf test_elf.c pridata.o 24 | 25 | 3. Run test_elf in Windora_NEO to retrieve the original JPG file. 26 | 27 | 28 | Midas Zhou 29 | ---------------------------------------------------------------------------*/ 30 | #include 31 | #include 32 | //#include 33 | //#include 34 | 35 | #if 1 ///////////////////////////////////////////////////////// 36 | /* Note: All symbol value are parsed as address after ld */ 37 | extern char _binary_lake_jpg_start[]; 38 | extern char _binary_lake_jpg_end[]; 39 | extern const char _binary_lake_jpg_size[]; 40 | 41 | int main(void) 42 | { 43 | FILE *fp; 44 | unsigned long size; 45 | 46 | printf("offset: _binary_lake_jpg_start=%p \n", _binary_lake_jpg_start ); 47 | printf("offset: _binary_lake_jpg_end=%p \n", _binary_lake_jpg_end ); 48 | printf("_binary_lake_jpg_size=%p \n", _binary_lake_jpg_size ); 49 | printf("size=%d, or 0x%x \n", (int)_binary_lake_jpg_size, (int)_binary_lake_jpg_size); 50 | 51 | size=(int)_binary_lake_jpg_size; 52 | 53 | 54 | fp=fopen("/tmp/lake.jpg", "w"); 55 | if(fp == NULL ) { 56 | perror("open file"); 57 | exit(-1); 58 | } 59 | 60 | 61 | fwrite( (char *)_binary_lake_jpg_start, size, 1, fp); 62 | 63 | fclose(fp); 64 | 65 | return 0; 66 | } 67 | 68 | #else ////////////////////////////////////////////////////////// 69 | 70 | extern char privdata[]; 71 | 72 | int main(void) 73 | { 74 | FILE *fp; 75 | unsigned long size; 76 | 77 | printf("offset: privdata=%p \n", privdata ); 78 | 79 | size=14120; 80 | 81 | fp=fopen("/tmp/lake.jpg", "w"); 82 | if(fp == NULL ) { 83 | perror("open file"); 84 | exit(-1); 85 | } 86 | 87 | 88 | fwrite( (char *)privdata, size, 1, fp); 89 | 90 | fclose(fp); 91 | 92 | return 0; 93 | } 94 | 95 | #endif /////////////////////////////////////////////////// 96 | -------------------------------------------------------------------------------- /test/test_etouch.c: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | A general EGI touch program, start from Home Page. 7 | 8 | TODO: Polling touch data/status by a thread is inefficient, turn to 9 | I/O event driven approach. 10 | 11 | 12 | Midas Zhou 13 | -------------------------------------------------------------------*/ 14 | #include "egi_common.h" 15 | #include "page/egi_pagehome.h" 16 | #include "egi_FTsymbol.h" 17 | 18 | 19 | int main(int argc, char **argv) 20 | { 21 | EGI_PAGE *page_home; 22 | pthread_t thread_loopread; 23 | 24 | /* <<<<< EGI general init >>>>>> */ 25 | printf("tm_start_egitick()...\n"); 26 | tm_start_egitick(); /* start sys tick */ 27 | printf("egi_init_log()...\n"); 28 | if(egi_init_log("/mmc/egi_log") != 0) { /* start logger */ 29 | printf("Fail to init logger,quit.\n"); 30 | return -1; 31 | } 32 | printf("symbol_load_allpages()...\n"); 33 | if(symbol_load_allpages() !=0 ) { /* load sys ASCII fonts */ 34 | printf("Fail to load sym pages,quit.\n"); 35 | return -2; 36 | } 37 | printf("FTsymbol_load_allpages()...\n"); /* load FreeType sys ASCII fonts */ 38 | if( FTsymbol_load_allpages() !=0 ) { 39 | printf("Fail to load FT symbol pages!\n"); 40 | return -3; 41 | } 42 | #if 1 43 | if(FTsymbol_load_sysfonts() !=0 ) { /* load FT fonts LIBS */ 44 | printf("Fail to load FT appfonts, quit.\n"); 45 | return -4; 46 | } 47 | #endif 48 | #if 1 49 | if(FTsymbol_load_appfonts() !=0 ) { /* load FT fonts LIBS */ 50 | printf("Fail to load FT appfonts, quit.\n"); 51 | return -4; 52 | } 53 | #endif 54 | printf("init_fbdev()...\n"); 55 | if( init_fbdev(&gv_fb_dev) ) /* init sys FB device */ 56 | return -5; 57 | /* <<<<< END EGI general init >>>>>> */ 58 | 59 | /* ---- start touch thread ---- */ 60 | SPI_Open(); /* open SPI device for LCD TOUCH */ 61 | if( pthread_create(&thread_loopread, NULL, (void *)egi_touch_loopread, NULL) !=0 ) 62 | { 63 | printf(" pthread_create(... egi_touch_loopread() ... ) fails!\n"); 64 | return -6; 65 | } 66 | 67 | /* ----- start homepage ----- */ 68 | page_home=egi_create_homepage(); 69 | egi_page_activate(page_home); 70 | page_home->routine(page_home); /* get into routine loop */ 71 | 72 | /* <<<<< EGI general release >>>>> */ 73 | printf("FTsymbol_release_allfonts()...\n"); 74 | FTsymbol_release_allfonts(); 75 | printf("symbol_release_allpages()...\n"); 76 | symbol_release_allpages(); 77 | printf("FTsymbol_release_allpages()...\n"); 78 | FTsymbol_release_allpages(); 79 | printf("release_fbdev()...\n"); 80 | fb_filo_flush(&gv_fb_dev); 81 | release_fbdev(&gv_fb_dev); 82 | printf("egi_quit_log()...\n"); 83 | egi_quit_log(); 84 | printf("<------- END ------>\n"); 85 | 86 | return 0; 87 | } 88 | -------------------------------------------------------------------------------- /test/test_filo.c: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | Test EGI FILO 8 | 9 | Midas Zhou 10 | -----------------------------------------------------------------*/ 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include "egi_timer.h" 16 | #include "egi_filo.h" 17 | #include "egi_log.h" 18 | 19 | 20 | EGI_FILO *filo=NULL; 21 | 22 | int main(void) 23 | { 24 | int k; 25 | int data; 26 | 27 | /* init logger */ 28 | if(egi_init_log("/mmc/log_filo") != 0) 29 | { 30 | printf("Fail to init logger,quit.\n"); 31 | return -1; 32 | } 33 | 34 | /* --- start egi tick --- */ 35 | tm_start_egitick(); 36 | 37 | while(1) 38 | { 39 | //egi_malloc_filo(int buff_size, int item_size, int realloc) 40 | /* init filo */ 41 | filo=egi_malloc_filo( 1<<1, sizeof(int), 0b01|0b10 ); /* enable double/halve realloc */ 42 | if(filo==NULL) 43 | { 44 | printf("Fail to init filo, quit.\n"); 45 | return -1; 46 | } 47 | 48 | printf(" start push...\n"); 49 | for(k=0;k<(1<<12);k++) { 50 | printf("push data=%d\n",k); 51 | egi_filo_push(filo,(void *)&k); 52 | } 53 | 54 | printf("TEST egi_filo_read() and egi_filo_totalitem() ....\n"); 55 | for(k=0;k<10;k++) { 56 | if(egi_filo_read(filo, 10*k, &data)!=0) 57 | printf("------ egi_filo_read() ERROR! -------\n"); 58 | printf("pn=%d, data=%d\n",10*k, data); 59 | egi_filo_pop(filo,NULL); 60 | printf("total item=%d after %d pop_outs.\n",egi_filo_itemtotal(filo),k+1); 61 | } 62 | tm_delayms(1000); 63 | 64 | printf(" start pop...\n"); 65 | for(k=0;k<(1<<12);k++) { 66 | egi_filo_pop(filo, (void *)&data); 67 | printf("pop data=%d\n",data); 68 | if(data!=(1<<12)-1-k) 69 | printf("data[%d]=%d, ----- ERROR! ----- \n", k, data); 70 | } 71 | printf(" --------- push and pop results OK ---------\n"); 72 | 73 | 74 | 75 | /* free filo */ 76 | egi_free_filo(filo); 77 | 78 | tm_delayms(1000); 79 | } 80 | 81 | 82 | /* quit logger */ 83 | egi_quit_log(); 84 | 85 | return 0; 86 | } 87 | 88 | -------------------------------------------------------------------------------- /test/test_float.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include /* toolchain gcc/gcc/ginclude/float.h */ 3 | #include 4 | 5 | #include 6 | /* Minimum for largest signed integral type. */ 7 | //# define INTMAX_MIN (-LONG_LONG_MAX-1) 8 | /* Maximum for largest signed integral type. */ 9 | //# define INTMAX_MAX (LONG_LONG_MAX) 10 | 11 | #include 12 | /* Minimum and maximum values a `signed int' can hold. */ 13 | //# define INT_MIN (-INT_MAX - 1) 14 | //# define INT_MAX 2147483647 15 | 16 | 17 | 18 | int main(void) 19 | { 20 | printf("__WORDSIZE: %d, as sizeof(long int): %ldBytes\n", __WORDSIZE, sizeof(long int)); 21 | printf("LONG_MAX: %ld LONG_MIN: %ld\n", LONG_MAX, LONG_MIN); 22 | printf("INT32_MIN: %d INT32_MAX: %d\n", INT32_MIN, INT32_MAX); 23 | printf("INT_MIN: %d INT_MAX: %d\n", INT_MIN, INT_MAX); 24 | printf("\n =============== Float Limits =============\n"); 25 | printf("Number of bits in the mantissa of a float: %d\n", FLT_MANT_DIG); 26 | printf("Min. number of significant decimal digits for a float: %d\n", FLT_DIG); 27 | printf("Min. base-10 negative exponent for a float with a full set of significant figures: %d\n",FLT_MIN_10_EXP); 28 | printf("Max. base-10 positive exponent for a float: %d\n",FLT_MAX_10_EXP); 29 | 30 | printf("Min. value for a positive float retaining full precision: %f =%e\n", FLT_MIN, FLT_MIN); 31 | /* Note: for 32bits system, = 1*2^(0-127+1) = 2^(-126)= 1.175494e-38 */ 32 | printf("Max. value for a positive float: %f =%e\n", FLT_MAX,FLT_MAX); 33 | /* Note: for 32bits system, = 1*2^(255-127)=2^128=3.402823669×e+38 */ 34 | 35 | printf("Diff. between 1.00 and the leaset float value greater than 1.00: %f=%e\n",FLT_EPSILON,FLT_EPSILON); 36 | printf(" 1/(2^(FLT_MANT_DIG-1)) = %0.12f\n",1.0/pow(2,FLT_MANT_DIG-1)); 37 | printf(" ============================================\n\n"); 38 | 39 | printf("\n =============== Double Limits =============\n"); 40 | printf("Number of bits in the mantissa of a double: %d\n", DBL_MANT_DIG); 41 | printf("Min. number of significant decimal digits for a double: %d\n", DBL_DIG); 42 | printf("Min. base-10 negative exponent for a double with a full set of significant figures: %d\n",DBL_MIN_10_EXP); 43 | printf("Max. base-10 positive exponent for a double: %d\n",DBL_MAX_10_EXP); 44 | printf("Min. value for a positive double retaining full precision: %.20f =%e\n", DBL_MIN, DBL_MIN); 45 | printf("Max. value for a positive double: %.20f =%e\n", DBL_MAX,DBL_MAX); 46 | printf("Diff. between 1.00 and the leaset double value greater than 1.00: %.20f=%e\n",DBL_EPSILON,DBL_EPSILON); 47 | printf(" 1/(2^(DBL_MANT_DIG-1)) = %0.20f\n",1.0/pow(2,DBL_MANT_DIG-1)); 48 | printf(" ============================================\n\n"); 49 | 50 | 51 | //int a=0b0 10000010 10010000000000000000000; 52 | int a=0b01000001010010000000000000000000; 53 | float b=*(float *)&a; 54 | 55 | printf("int a=%d\n",a); 56 | printf("float b=%f \n",b); 57 | 58 | 59 | unsigned int i=1; 60 | if( -1 > i) 61 | printf("-1 > %d \n",i); 62 | 63 | if( -1 > 0x44 ) 64 | printf(" -1 > 012 \n" ); 65 | 66 | 67 | return 0; 68 | } 69 | -------------------------------------------------------------------------------- /test/test_mem.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | int main(void) 9 | { 10 | struct mallinfo minfo; 11 | 12 | /* print malloc info */ 13 | minfo=mallinfo(); 14 | printf("number of free chunks: %d\n", minfo.ordblks); /* 512-128K */ 15 | printf("number of fastbin blocks: %d\n", minfo.smblks); /* 80-512 bytes */ 16 | printf("space available in freed fastbin blocks: %d\n", minfo.fsmblks); /* 0-80 bytes */ 17 | 18 | /* print malloc status */ 19 | malloc_stats(NULL); 20 | 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /test/test_primer.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | void print_tmdiff(struct timeval t_start, struct timeval t_end); 8 | 9 | int main(void) 10 | { 11 | uint64_t num; 12 | uint64_t div; 13 | bool IsPrimer=true; 14 | struct timeval tm_start, tm_end; 15 | 16 | for( ; printf("Please enter a number:"), scanf("%"PRIu64"", &num)==1; ) 17 | { 18 | gettimeofday(&tm_start, NULL); 19 | // for( div=2; div*div < num; div++) { // div*div will overflow ! // 20 | for( div=2; div < num/div; div++) { 21 | if( num%div == 0) { 22 | IsPrimer=false; 23 | if(div*div==num) 24 | printf("%"PRIu64" is divisible by %"PRIu64"\n", num, div); 25 | else { 26 | printf("%"PRIu64" divisible by %"PRIu64" and %"PRIu64" \n", 27 | num, div, num/div); 28 | } 29 | } 30 | } 31 | if(IsPrimer) 32 | printf("%"PRIu64" is a primer\n", num); 33 | 34 | gettimeofday(&tm_end, NULL); 35 | 36 | print_tmdiff(tm_start, tm_end); 37 | 38 | } 39 | 40 | return 0; 41 | } 42 | 43 | 44 | 45 | void print_tmdiff(struct timeval t_start, struct timeval t_end) 46 | { 47 | int ds=t_end.tv_sec-t_start.tv_sec; 48 | int dus=t_end.tv_usec-t_start.tv_usec; 49 | 50 | if(dus<0 && ds>0) { 51 | ds--; 52 | dus += 1000000; 53 | } 54 | 55 | printf("Time cost: %ds %dms\n", ds, dus/1000); 56 | 57 | } 58 | 59 | -------------------------------------------------------------------------------- /test/test_ringbuff.c: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | Journal: 8 | 2021-11-15: Create the file. 9 | 10 | Midas Zhou 11 | midaszhou@yahoo.com(Not in use since 2022_03_01) 12 | https://github.com/widora/wegi 13 | ------------------------------------------------------------------*/ 14 | #include 15 | #include 16 | #include "egi_ringbuffer.h" 17 | 18 | int main(void) 19 | { 20 | char data[100]; 21 | int inBytes=100; /* 每次写入数据量 */ 22 | int outBytes=50; /* 每次读出数据量 */ 23 | int ret; 24 | 25 | EGI_RINGBUFFER *ringbuff=NULL; 26 | ringbuff=egi_ringbuffer_create(4096); 27 | 28 | while(1) { 29 | 30 | /* Write into the ringbuffer */ 31 | if( (ret=egi_ringbuffer_write(ringbuff, data, inBytes)) datasize, ringbuff->pw, ringbuff->pr); 49 | } 50 | 51 | egi_ringbuffer_free(&ringbuff); 52 | return 0; 53 | } 54 | -------------------------------------------------------------------------------- /test/test_touch.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "egi_common.h" 3 | #include "egi_FTsymbol.h" 4 | 5 | int main(void) 6 | { 7 | /* <<<<< EGI general init >>>>>> */ 8 | printf("tm_start_egitick()...\n"); 9 | tm_start_egitick(); /* start sys tick */ 10 | #if 0 11 | printf("egi_init_log()...\n"); 12 | if(egi_init_log("/mmc/log_test") != 0) { /* start logger */ 13 | printf("Fail to init logger,quit.\n"); 14 | return -1; 15 | } 16 | 17 | printf("symbol_load_allpages()...\n"); 18 | if(symbol_load_allpages() !=0 ) { /* load sys fonts */ 19 | printf("Fail to load sym pages,quit.\n"); 20 | return -2; 21 | } 22 | if(FTsymbol_load_appfonts() !=0 ) { /* load FT fonts LIBS */ 23 | printf("Fail to load FT appfonts, quit.\n"); 24 | return -2; 25 | } 26 | 27 | printf("init_fbdev()...\n"); 28 | if( init_fbdev(&gv_fb_dev) ) /* init sys FB */ 29 | return -1; 30 | 31 | #endif 32 | 33 | printf("start touchread thread...\n"); 34 | egi_start_touchread(); /* start touch read thread */ 35 | 36 | /* <<<<< End EGI Init >>>>> */ 37 | 38 | printf("Finish EGI init.\n"); 39 | 40 | while(1) { 41 | if( egi_touch_timeWait_press(5)==0 ) { 42 | printf(" Touch down!\n"); 43 | } 44 | else { 45 | printf(" Time out!\n"); 46 | } 47 | tm_delayms(500); 48 | } 49 | 50 | 51 | 52 | /* <<<<< EGI general release >>>>> */ 53 | printf("FTsymbol_release_allfonts()...\n"); 54 | FTsymbol_release_allfonts(); 55 | printf("symbol_release_allpages()...\n"); 56 | symbol_release_allpages(); 57 | printf("release_fbdev()...\n"); 58 | fb_filo_flush(&gv_fb_dev); /* Flush FB filo if necessary */ 59 | release_fbdev(&gv_fb_dev); 60 | printf("egi_end_touchread()...\n"); 61 | egi_end_touchread(); 62 | printf("egi_quit_log()...\n"); 63 | egi_quit_log(); 64 | printf("<------- END ------>\n"); 65 | 66 | 67 | return 0; 68 | } 69 | -------------------------------------------------------------------------------- /test/test_ts.c: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | An example of extracting audio data from Transport Stream. 7 | 8 | Reference: 9 | 1. https://blog.csdn.net/leek5533/article/details/104993932 10 | 2. ISO/IEC13818-1 Information technology — Generic coding of moving 11 | pictures and associated audio information: Systems 12 | 13 | 14 | Abbreviations 15 | PAT --- Program Association Table, list Program_Number and related PMT PID. 16 | PMT --- Program Map Table, list Elementary Stream type and PID. 17 | If ONLY one program, then PMT maybe omitted!??? <-------- 18 | CAT --- Condition Access Table 19 | NIT --- Network Information Table 20 | 21 | PSI --- Program Specific Information. (PAT,PMT,CAT,...etc) 22 | PES --- Packetized Elementary Stream 23 | 24 | Journal: 25 | 2022-06-30: Create the file. 26 | 2022-07-01/02: 27 | 1. Extract ES and save to fout. 28 | 2. Transfer egi_extract_aac_from_ts() to egi_utils.c 29 | 30 | Midas Zhou 31 | 知之者不如好之者好之者不如乐之者 32 | ------------------------------------------------------------------*/ 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | 43 | /*---------------------------- 44 | Main 45 | -----------------------------*/ 46 | int main(int argc, char **argv) 47 | { 48 | 49 | egi_extract_AV_from_ts(argv[1], "/tmp/ts.aac", "/tmp/ts.h264"); 50 | 51 | return 0; 52 | } 53 | 54 | 55 | -------------------------------------------------------------------------------- /utils/OLD_Makefile: -------------------------------------------------------------------------------- 1 | #VPATH ../:../iot:../utils 2 | 3 | export STAGING_DIR = /home/midas-zhou/openwrt_widora/staging_dir 4 | COMMON_USRDIR = /home/midas-zhou/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr 5 | 6 | CC= $(STAGING_DIR)/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc 7 | 8 | APP=egi_fifo 9 | 10 | OBJS= egi_utils.o egi_fifo.o egi_filo.o egi_iwinfo.o egi_cstring.o ../egi_log.o ../egi_timer.o 11 | 12 | ## Shall also include all sys libs head file dir 13 | CFLAGS += -Wall -I../ -I../utils -I$(COMMON_USRDIR)/include 14 | CFLAGS += -D_GNU_SOURCE ## for O_CLOEXEC flag ## 15 | LDFLAGS += -L$(COMMON_USRDIR)/lib 16 | LIBS += -lpthread 17 | LIBS += -lcurl -lssl -lcrypto 18 | 19 | read_conf: read_conf.c $(OBJS) 20 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJS) read_conf.c -o read_conf 21 | 22 | test_fifo: test_fifo.c $(OBJS) 23 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJS) test_fifo.c -o test_fifo 24 | 25 | test_filo: test_filo.c $(OBJS) 26 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJS) test_filo.c -o test_filo 27 | 28 | test_cstring: test_cstring.c $(OBJS) 29 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJS) test_cstring.c -o test_cstring 30 | 31 | egi_cstring.o: egi_cstring.c 32 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -c egi_cstring.c 33 | 34 | egi_fifo.o: egi_fifo.h egi_fifo.c 35 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -c egi_fifo.c 36 | 37 | egi_filo.o: egi_filo.c 38 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -c egi_filo.c 39 | 40 | egi_utils.o: egi_utils.h egi_utils.c 41 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -c egi_utils.c 42 | 43 | egi_iwinfo.o: egi_iwinfo.h egi_iwinfo.c 44 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -c egi_iwinfo.c 45 | 46 | egi_https.o: egi_https.h egi_https.c 47 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -c egi_https.c 48 | 49 | egi_fftdemo.o: egi_fftdemo.h egi_fftdemo.c 50 | $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -c egi_fftdemo.c 51 | 52 | 53 | 54 | 55 | .PHONY: clean 56 | clean: 57 | rm -rf $(APP) $(APP).o *.o 58 | rm -rf test_fifo test_filo test_cstring read_conf 59 | 60 | #CFLAGS += $(shell pkg-config --cflags json-c) 61 | #LDFLAGS += $(shell pkg-config --libs json-c) 62 | 63 | -------------------------------------------------------------------------------- /utils/egi_aes.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | Midas Zhou 8 | midaszhou@yahoo.com(Not in use since 2022_03_01) 9 | ------------------------------------------------------------------*/ 10 | #ifndef __EGI_AES_H__ 11 | #define __EGI_AES_H__ 12 | 13 | #include 14 | 15 | /* OpenSSL */ 16 | #include 17 | int AES_cbc128_encrypt(unsigned char *indata, size_t insize, unsigned char *outdata, size_t *outsize, 18 | const unsigned char *ukey, const unsigned char *uiv, int encode); 19 | 20 | /* EGi */ 21 | void aes_PrintState(const uint8_t *state); 22 | int aes_DataToState(const uint8_t *data, uint8_t *state); 23 | int aes_StateToData(const uint8_t *state, uint8_t *data); 24 | int aes_ShiftRows(uint8_t *state); 25 | int aes_InvShiftRows(uint8_t *state); 26 | int aes_ExpRoundKeys(uint8_t Nr, uint8_t Nk, const uint8_t *inkey, uint32_t *keywords); 27 | int aes_AddRoundKey(uint8_t Nr, uint8_t Nk, uint8_t round, uint8_t *state, const uint32_t *keywords); 28 | int aes_EncryptState(uint8_t Nr, uint8_t Nk, uint32_t *keywords, uint8_t *state); 29 | int aes_DecryptState(uint8_t Nr, uint8_t Nk, uint32_t *keywords, uint8_t *state); 30 | 31 | int egi_AES128CBC_encrypt(uint8_t *indata, size_t insize, uint8_t *outdata, size_t *outsize, 32 | const uint8_t ukey[16], const uint8_t uiv[16], int encode); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /utils/egi_fifo.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | A EGI FIFO buffer 8 | 9 | Midas Zhou 10 | -----------------------------------------------------------------*/ 11 | #ifndef __EGI_FIFO__ 12 | #define __EGI_FIFO__ 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | /* DO NOT REFER EGI_FIFO MEMBER DIRECTLY IN MULT_THREAD CONDITION, THEY ARE UNSTABLE !!! */ 19 | typedef struct 20 | { 21 | int item_size; /* size of each item data, in byte. */ 22 | int buff_size; /* total item number that the buff is capable of holding */ 23 | unsigned char **buff; /* data buffer [buff_size][item_size] */ 24 | 25 | uint32_t pin; /* data pusher's position, as buff[pin]. 26 | * after push_in, pin++ to move to next slot position !!!!!! */ 27 | 28 | uint32_t pout; /* data puller's position!!!, as buff[pout] 29 | * after pull_out, pout++ to move to next slot position !!!!!! */ 30 | 31 | int ahead; /* +1 when pin runs ahead of pout && cross start line [0] 32 | * one more time then pout, -1 when pout cross start line 33 | * one more time. In most case ahead will be 0 or 1, and rarely it 34 | * may be -1 or 2. 35 | */ 36 | 37 | pthread_mutex_t lock; /* thread mutex lock */ 38 | 39 | int pin_wait; /* 1.Set pin_wait==0: It keeps pushing data, pin never waits for pout, 40 | * some data will be overwritten and lost before pout can get them. 41 | * 2.Set pin_wait!=0: When pin catches up pout from a loop back, it will 42 | * stop and wait for pin to catch up, so all data will be picked up 43 | * by pout. 44 | */ 45 | }EGI_FIFO; 46 | 47 | 48 | EGI_FIFO * egi_malloc_fifo(int buff_size, int item_size, int pin_wait); 49 | void egi_free_fifo(EGI_FIFO *efifo ); 50 | int egi_push_fifo(EGI_FIFO *fifo, unsigned char *data, int size, int *in, int *out, int *ahd ); 51 | int egi_pull_fifo(EGI_FIFO *fifo, unsigned char *data, int size, int *in, int *out, int *ahd ); 52 | 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /utils/egi_filo.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | Midas Zhou 7 | -----------------------------------------------------------------*/ 8 | 9 | #ifndef __EGI_FILO_H__ 10 | #define __EGI_FILO_H__ 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | #define FILO_AUTO_DOUBLE 0b01 21 | #define FILO_AUTO_HALVE 0b10 22 | 23 | /* 1. WARNING: No mutex lock applied, It is supposed there is only one pusher and one puller, 24 | * and they should NOT write/read the buff at the same time. 25 | * 2. When you set auto double/halve flag, make sure that buff_size is 26 | * N power of 2,or buff_size=1< 14 | #include 15 | 16 | typedef struct { 17 | char* buffer; /* Mem. space allocated */ 18 | size_t buffsize; /* Size of the ring buffer */ 19 | size_t datasize; /* Size of available data buffered */ 20 | off_t pw; /* Offset to write position (Write pointer) */ 21 | off_t pr; /* Offset to read position (Read pointer) */ 22 | 23 | pthread_mutex_t ring_mutex; 24 | } EGI_RINGBUFFER; 25 | 26 | EGI_RINGBUFFER *egi_ringbuffer_create(size_t buffsize); 27 | void egi_ringbuffer_free(EGI_RINGBUFFER **ringbuf); 28 | bool egi_ringbuffer_IsFull(const EGI_RINGBUFFER *ringbuf); 29 | size_t egi_ringbuffer_write(EGI_RINGBUFFER *ringbuf, void *src, size_t len); 30 | size_t egi_ringbuffer_read(EGI_RINGBUFFER *ringbuf, void *dest, size_t len); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /utils/egi_shmem.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | Midas Zhou 8 | ------------------------------------------------------------------*/ 9 | #ifndef __EGI_SHMEM__ 10 | #define __EGI_SHMEM__ 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | typedef struct { 20 | const char* shm_name; 21 | char* shm_map; 22 | size_t shm_size; 23 | 24 | /* DATA shm_map, struct pointer to shm_map */ 25 | struct { 26 | //pthread_mutex_t shm_mutex; /* Ensure no race in first mutex create */ 27 | bool active; /* status to indicate that data is being processed. 28 | * The process occupying the data may quit abnormally, so other processes shall confirm 29 | * this status by other means. 30 | */ 31 | bool sigstop; /* siganl to stop data processing */ 32 | int signum; /* signal number */ 33 | char msg[64]; 34 | void* data; /* more data, pointer value, !!! AS FOR VALUE, NOT FOR ADDR !!! */ 35 | }* msg_data; 36 | 37 | /* Offset to somewhere in mem block */ 38 | unsigned int offset; /* data block offset from shm_map */ 39 | 40 | } EGI_SHMEM; 41 | 42 | 43 | int egi_shmem_open(EGI_SHMEM *shmem); 44 | int egi_shmem_close(EGI_SHMEM *shmem); 45 | int egi_shmem_remove(const char *name); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /utils/egi_test.conf: -------------------------------------------------------------------------------- 1 | ############################################################### 2 | # This is A test Config File 3 | # 1. Test space strip, spaces beside all SECT/KEY/NAME strings. 4 | # 2. Test NULL key. 5 | # 3. Test NULL value. 6 | # 4. Test comments lines 7 | # 5. Test all_space lines 8 | # 6. Test repeative SECTION neglect 9 | # 7. Test SECTION boundary '[' 10 | 11 | Midas Zhou 12 | ################################################################ 13 | [EGI_FFPLAY] 14 | music_dir=/mmc/ 15 | video_dir=/mmc/ 16 | 17 | [IOT_CLIENT ] 18 | i 19 | o 20 | ### Test Space Strip #### 21 | [ IOT _CLIENT ] 22 | server_ip = 121.42.180.30 23 | server_port=8181 24 | device_id = 421 25 | device_key = f80ea043e 26 | 27 | ###This is test for egi_book conf### 28 | [EGI_BOOK ] 29 | book_dir =/home/ 30 | ### Test NULL Key Value ### 31 | book_name = 32 | 33 | ####################### 34 | # MPLAYER Config 35 | ###################### 36 | [EGI_MPLAYER] 37 | playlist = /home/radio.list 38 | 39 | -------------------------------------------------------------------------------- /xpt2046.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------ 2 | This program is free software; you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License version 2 as 4 | published by the Free Software Foundation. 5 | 6 | 7 | XPT2046 touch pad 8 | 9 | Midas Zhou 10 | -------------------------------------------------------------------*/ 11 | #ifndef __XPT2046_H__ 12 | #define __XPT2046_H__ 13 | 14 | 15 | /*-------------- 8BITS CONTROL COMMAND FOR XPT2046 ------------------- 16 | [7] S -- 1: new control bits, 17 | 0: ignore data on pins 18 | 19 | [6-4] A2-A0 -- 101: X-position (differenctial) 20 | 001: Y-position (differenctial) 21 | 011: z1? (differenctial) 22 | 100: z2? (differenctial) 23 | 000: temp0? (non_differenctial) 24 | 111: temp1? (non_differenctial) 25 | 010: vabtt? (non_differenctial) 26 | 110: vaux? (non_differenctial) 27 | [3] MODE -- 1: 8bits resolution 28 | 0: 12bits resolution 29 | 30 | [2] SER/(-)DFR -- 1: normal mode (non_differenctial) 31 | 0: differential mode 32 | 33 | [1-0] PD1-PD0 -- 11: normal power(ADC + vREF on + penIRQ) 34 | 01: ADC on 35 | 10: vREF on + penIRQ 36 | 00: power saving mode 37 | ---------------------------------------------------------------*/ 38 | #define XPT_CMD_READXP 0xD0 //0xD0 //1101,0000 /* read X position data */ 39 | #define XPT_CMD_READYP 0x90 //0x90 //1001,0000 /* read Y position data */ 40 | 41 | /* ----- XPT bias and limit value ----- */ 42 | #define XPT_XP_MIN 7 43 | #define XPT_XP_MAX 116 //actual 116 44 | 45 | #define XPT_YP_MIN 17 46 | #define XPT_YP_MAX 116 //actual 116 47 | 48 | /* ------ touch read sample number ------*/ 49 | #define XPT_SAMPLE_EXPNUM 4 /* 2^4=2*2*2*2 */ 50 | #define XPT_SAMPLE_NUMBER 1<