From add995c32e86f9de8fa8fc05172435332c25a895 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 19 Dec 2011 19:24:09 +0000 Subject: [PATCH] Completes coding of the PWM module git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4200 7fd9a85b-ad96-42d3-883c-3090e2eb8679 --- apps/ChangeLog.txt | 148 + apps/Make.defs | 41 + apps/Makefile | 132 + apps/README.txt | 146 + apps/examples/Makefile | 118 + apps/examples/README.txt | 1140 + apps/examples/adc/Makefile | 105 + apps/examples/adc/adc.h | 116 + apps/examples/adc/adc_main.c | 215 + apps/examples/buttons/Makefile | 105 + apps/examples/buttons/main.c | 505 + apps/examples/dhcpd/Makefile | 106 + apps/examples/dhcpd/Makefile.host | 62 + apps/examples/dhcpd/host.c | 58 + apps/examples/dhcpd/target.c | 142 + apps/examples/ftpc/Makefile | 105 + apps/examples/ftpc/ftpc.h | 112 + apps/examples/ftpc/ftpc_cmds.c | 398 + apps/examples/ftpc/ftpc_main.c | 426 + apps/examples/hello/Makefile | 93 + apps/examples/hello/main.c | 64 + apps/examples/helloxx/Makefile | 122 + apps/examples/helloxx/main.cxx | 129 + apps/examples/hidkbd/Makefile | 93 + apps/examples/hidkbd/hidkbd_main.c | 231 + apps/examples/igmp/Makefile | 93 + apps/examples/igmp/igmp.c | 142 + apps/examples/igmp/igmp.h | 61 + apps/examples/lcdrw/Makefile | 105 + apps/examples/lcdrw/lcdrw_main.c | 262 + apps/examples/mm/Makefile | 93 + apps/examples/mm/mm_main.c | 300 + apps/examples/mount/Makefile | 93 + apps/examples/mount/mount.h | 96 + apps/examples/mount/mount_main.c | 754 + apps/examples/mount/ramdisk.c | 141 + apps/examples/nettest/Makefile | 142 + apps/examples/nettest/host.c | 63 + apps/examples/nettest/nettest.c | 121 + apps/examples/nettest/nettest.h | 95 + apps/examples/nettest/nettest_client.c | 205 + apps/examples/nettest/nettest_server.c | 235 + apps/examples/nsh/Makefile | 93 + apps/examples/nsh/nsh_main.c | 136 + apps/examples/null/Makefile | 93 + apps/examples/null/null_main.c | 67 + apps/examples/nx/Makefile | 108 + apps/examples/nx/nx_events.c | 337 + apps/examples/nx/nx_internal.h | 317 + apps/examples/nx/nx_kbdin.c | 467 + apps/examples/nx/nx_main.c | 908 + apps/examples/nx/nx_server.c | 152 + apps/examples/nxffs/Makefile | 93 + apps/examples/nxffs/nxffs_main.c | 947 + apps/examples/nxflat/Makefile | 98 + apps/examples/nxflat/nxflat_main.c | 224 + apps/examples/nxflat/tests/Makefile | 103 + apps/examples/nxflat/tests/errno/Makefile | 78 + apps/examples/nxflat/tests/errno/errno.c | 83 + apps/examples/nxflat/tests/hello++/Makefile | 180 + .../nxflat/tests/hello++/hello++1.cpp | 60 + .../nxflat/tests/hello++/hello++2.cpp | 123 + .../nxflat/tests/hello++/hello++3.cpp | 132 + .../nxflat/tests/hello++/hello++4.cpp | 150 + apps/examples/nxflat/tests/hello/Makefile | 78 + apps/examples/nxflat/tests/hello/hello.c | 78 + apps/examples/nxflat/tests/longjmp/Makefile | 78 + apps/examples/nxflat/tests/longjmp/longjmp.c | 128 + apps/examples/nxflat/tests/mkdirlist.sh | 35 + apps/examples/nxflat/tests/mksymtab.sh | 39 + apps/examples/nxflat/tests/mutex/Makefile | 78 + apps/examples/nxflat/tests/mutex/mutex.c | 149 + apps/examples/nxflat/tests/pthread/Makefile | 78 + apps/examples/nxflat/tests/pthread/pthread.c | 143 + apps/examples/nxflat/tests/signal/Makefile | 78 + apps/examples/nxflat/tests/signal/signal.c | 308 + apps/examples/nxflat/tests/struct/Makefile | 80 + apps/examples/nxflat/tests/struct/struct.h | 89 + .../nxflat/tests/struct/struct_dummy.c | 65 + .../nxflat/tests/struct/struct_main.c | 109 + apps/examples/nxflat/tests/task/Makefile | 79 + apps/examples/nxflat/tests/task/task.c | 143 + apps/examples/nxhello/Makefile | 105 + apps/examples/nxhello/nxhello.h | 196 + apps/examples/nxhello/nxhello_bkgd.c | 443 + apps/examples/nxhello/nxhello_main.c | 294 + apps/examples/nximage/Makefile | 105 + apps/examples/nximage/nximage.h | 219 + apps/examples/nximage/nximage_bitmap.c | 3711 ++++ apps/examples/nximage/nximage_bkgd.c | 397 + apps/examples/nximage/nximage_main.c | 289 + apps/examples/nxlines/Makefile | 105 + apps/examples/nxlines/nxlines.h | 197 + apps/examples/nxlines/nxlines_bkgd.c | 335 + apps/examples/nxlines/nxlines_main.c | 280 + apps/examples/nxtext/Makefile | 109 + apps/examples/nxtext/nxtext_bkgd.c | 467 + apps/examples/nxtext/nxtext_internal.h | 330 + apps/examples/nxtext/nxtext_main.c | 512 + apps/examples/nxtext/nxtext_popup.c | 408 + apps/examples/nxtext/nxtext_putc.c | 598 + apps/examples/nxtext/nxtext_server.c | 194 + apps/examples/ostest/Makefile | 133 + apps/examples/ostest/barrier.c | 208 + apps/examples/ostest/cancel.c | 333 + apps/examples/ostest/cond.c | 294 + apps/examples/ostest/dev_null.c | 92 + apps/examples/ostest/main.c | 514 + apps/examples/ostest/mqueue.c | 394 + apps/examples/ostest/mutex.c | 142 + apps/examples/ostest/ostest.h | 174 + apps/examples/ostest/posixtimer.c | 262 + apps/examples/ostest/prioinherit.c | 541 + apps/examples/ostest/rmutex.c | 166 + apps/examples/ostest/roundrobin.c | 232 + apps/examples/ostest/sem.c | 246 + apps/examples/ostest/sighand.c | 267 + apps/examples/ostest/timedmqueue.c | 387 + apps/examples/ostest/timedwait.c | 195 + apps/examples/pashello/Makefile | 93 + apps/examples/pashello/README.txt | 34 + apps/examples/pashello/device.c | 110 + apps/examples/pashello/hello.h | 23 + apps/examples/pashello/hello.pas | 5 + apps/examples/pashello/hello.pex | Bin 0 -> 232 bytes apps/examples/pashello/mkhello.sh | 141 + apps/examples/pashello/pashello.c | 133 + apps/examples/pashello/pashello.h | 55 + apps/examples/pipe/Makefile | 93 + apps/examples/pipe/interlock_test.c | 224 + apps/examples/pipe/pipe.h | 74 + apps/examples/pipe/pipe_main.c | 189 + apps/examples/pipe/redirect_test.c | 326 + apps/examples/pipe/transfer_test.c | 242 + apps/examples/poll/Makefile | 94 + apps/examples/poll/Makefile.host | 54 + apps/examples/poll/host.c | 166 + apps/examples/poll/net_listener.c | 428 + apps/examples/poll/net_reader.c | 317 + apps/examples/poll/poll_internal.h | 128 + apps/examples/poll/poll_listener.c | 262 + apps/examples/poll/poll_main.c | 221 + apps/examples/poll/select_listener.c | 193 + apps/examples/rgmp/Makefile | 93 + apps/examples/rgmp/main.c | 66 + apps/examples/romfs/Makefile | 111 + apps/examples/romfs/romfs_main.c | 498 + apps/examples/romfs/romfs_testdir.h | 89 + apps/examples/romfs/testdir.tar.gz | Bin 0 -> 387 bytes apps/examples/romfs/testdir.txt | 105 + apps/examples/sendmail/Makefile | 96 + apps/examples/sendmail/Makefile.host | 77 + apps/examples/sendmail/host.c | 103 + apps/examples/sendmail/hostdefs.h | 69 + apps/examples/sendmail/target.c | 157 + apps/examples/serloop/Makefile | 95 + apps/examples/serloop/main.c | 100 + apps/examples/thttpd/Makefile | 98 + apps/examples/thttpd/content/Makefile | 104 + apps/examples/thttpd/content/hello/Makefile | 78 + apps/examples/thttpd/content/hello/hello.c | 79 + apps/examples/thttpd/content/index.html | 30 + apps/examples/thttpd/content/mksymtab.sh | 39 + apps/examples/thttpd/content/netstat/Makefile | 78 + .../examples/thttpd/content/netstat/netstat.c | 134 + apps/examples/thttpd/content/style.css | 80 + apps/examples/thttpd/content/tasks/Makefile | 78 + apps/examples/thttpd/content/tasks/tasks.c | 176 + apps/examples/thttpd/main.c | 267 + apps/examples/tiff/Makefile | 106 + apps/examples/tiff/tiff_main.c | 174 + apps/examples/touchscreen/Makefile | 105 + apps/examples/touchscreen/tc.h | 137 + apps/examples/touchscreen/tc_main.c | 214 + apps/examples/udp/Makefile | 124 + apps/examples/udp/host.c | 63 + apps/examples/udp/target.c | 91 + apps/examples/udp/udp-client.c | 133 + apps/examples/udp/udp-internal.h | 90 + apps/examples/udp/udp-server.c | 173 + apps/examples/uip/Makefile | 94 + apps/examples/uip/main.c | 207 + apps/examples/usbserial/Makefile | 95 + apps/examples/usbserial/Makefile.host | 67 + apps/examples/usbserial/host.c | 293 + apps/examples/usbserial/main.c | 461 + apps/examples/usbstorage/Makefile | 111 + apps/examples/usbstorage/usbstrg.h | 166 + apps/examples/usbstorage/usbstrg_main.c | 596 + apps/examples/usbterm/Makefile | 106 + apps/examples/usbterm/usbterm.h | 148 + apps/examples/usbterm/usbterm_main.c | 315 + apps/examples/wget/Makefile | 95 + apps/examples/wget/Makefile.host | 77 + apps/examples/wget/host.c | 100 + apps/examples/wget/hostdefs.h | 69 + apps/examples/wget/target.c | 150 + apps/examples/wlan/Makefile | 95 + apps/examples/wlan/wlan_main.c | 306 + apps/graphics/Makefile | 72 + apps/graphics/tiff/Makefile | 93 + apps/graphics/tiff/README.txt | 15 + apps/graphics/tiff/tiff_addstrip.c | 239 + apps/graphics/tiff/tiff_finalize.c | 439 + apps/graphics/tiff/tiff_initialize.c | 910 + apps/graphics/tiff/tiff_internal.h | 211 + apps/graphics/tiff/tiff_utils.c | 381 + apps/include/apps.h | 148 + apps/include/ftpc.h | 224 + apps/include/netutils/dhcpc.h | 85 + apps/include/netutils/dhcpd.h | 71 + apps/include/netutils/httpd.h | 54 + apps/include/netutils/ipmsfilter.h | 101 + apps/include/netutils/resolv.h | 65 + apps/include/netutils/smtp.h | 66 + apps/include/netutils/telnetd.h | 70 + apps/include/netutils/tftp.h | 73 + apps/include/netutils/thttpd.h | 101 + apps/include/netutils/uiplib.h | 129 + apps/include/netutils/webclient.h | 149 + apps/include/nsh.h | 97 + apps/include/tiff.h | 465 + apps/interpreters/Makefile | 70 + apps/interpreters/README.txt | 67 + apps/interpreters/ficl/Makefile | 118 + apps/interpreters/ficl/README.txt | 42 + apps/interpreters/ficl/configure.sh | 47 + apps/interpreters/ficl/src/nuttx.c | 65 + apps/interpreters/ficl/src/nuttx.h | 19 + apps/namedapp/Makefile | 106 + apps/namedapp/binfs.c | 596 + apps/namedapp/exec_namedapp.c | 122 + apps/namedapp/namedapp.c | 96 + apps/namedapp/namedapp.h | 78 + apps/netutils/Makefile | 64 + apps/netutils/README.txt | 40 + apps/netutils/dhcpc/Makefile | 97 + apps/netutils/dhcpc/dhcpc.c | 607 + apps/netutils/dhcpd/Makefile | 97 + apps/netutils/dhcpd/dhcpd.c | 1433 ++ apps/netutils/ftpc/Makefile | 113 + apps/netutils/ftpc/README.txt | 81 + apps/netutils/ftpc/ftpc_cdup.c | 87 + apps/netutils/ftpc/ftpc_chdir.c | 91 + apps/netutils/ftpc/ftpc_chmod.c | 107 + apps/netutils/ftpc/ftpc_cmd.c | 238 + apps/netutils/ftpc/ftpc_config.h | 72 + apps/netutils/ftpc/ftpc_connect.c | 250 + apps/netutils/ftpc/ftpc_disconnect.c | 102 + apps/netutils/ftpc/ftpc_filesize.c | 112 + apps/netutils/ftpc/ftpc_filetime.c | 134 + apps/netutils/ftpc/ftpc_getfile.c | 429 + apps/netutils/ftpc/ftpc_getreply.c | 268 + apps/netutils/ftpc/ftpc_help.c | 100 + apps/netutils/ftpc/ftpc_idle.c | 122 + apps/netutils/ftpc/ftpc_internal.h | 281 + apps/netutils/ftpc/ftpc_listdir.c | 412 + apps/netutils/ftpc/ftpc_login.c | 215 + apps/netutils/ftpc/ftpc_mkdir.c | 105 + apps/netutils/ftpc/ftpc_noop.c | 85 + apps/netutils/ftpc/ftpc_putfile.c | 481 + apps/netutils/ftpc/ftpc_quit.c | 92 + apps/netutils/ftpc/ftpc_rename.c | 134 + apps/netutils/ftpc/ftpc_response.c | 84 + apps/netutils/ftpc/ftpc_rmdir.c | 103 + apps/netutils/ftpc/ftpc_rpwd.c | 151 + apps/netutils/ftpc/ftpc_socket.c | 370 + apps/netutils/ftpc/ftpc_transfer.c | 517 + apps/netutils/ftpc/ftpc_unlink.c | 96 + apps/netutils/ftpc/ftpc_utils.c | 266 + apps/netutils/resolv/Makefile | 97 + apps/netutils/resolv/resolv.c | 440 + apps/netutils/smtp/Makefile | 97 + apps/netutils/smtp/smtp.c | 376 + apps/netutils/telnetd/Makefile | 97 + apps/netutils/telnetd/README.txt | 7 + apps/netutils/telnetd/shell.c | 139 + apps/netutils/telnetd/shell.h | 97 + apps/netutils/telnetd/telnetd.c | 459 + apps/netutils/tftpc/Makefile | 99 + apps/netutils/tftpc/tftpc_get.c | 337 + apps/netutils/tftpc/tftpc_internal.h | 173 + apps/netutils/tftpc/tftpc_packets.c | 330 + apps/netutils/tftpc/tftpc_put.c | 477 + apps/netutils/thttpd/Makefile | 129 + apps/netutils/thttpd/cgi-src/Makefile | 140 + apps/netutils/thttpd/cgi-src/phf.c | 77 + apps/netutils/thttpd/cgi-src/redirect.c | 269 + apps/netutils/thttpd/cgi-src/ssi.c | 957 + apps/netutils/thttpd/config.h | 253 + apps/netutils/thttpd/fdwatch.c | 371 + apps/netutils/thttpd/fdwatch.h | 111 + apps/netutils/thttpd/libhttpd.c | 3525 +++ apps/netutils/thttpd/libhttpd.h | 342 + apps/netutils/thttpd/mime_types.h | 279 + apps/netutils/thttpd/tdate_parse.c | 341 + apps/netutils/thttpd/tdate_parse.h | 41 + apps/netutils/thttpd/thttpd.c | 861 + apps/netutils/thttpd/thttpd_alloc.c | 199 + apps/netutils/thttpd/thttpd_alloc.h | 78 + apps/netutils/thttpd/thttpd_cgi.c | 1080 + apps/netutils/thttpd/thttpd_cgi.h | 61 + apps/netutils/thttpd/thttpd_strings.c | 179 + apps/netutils/thttpd/thttpd_strings.h | 123 + apps/netutils/thttpd/timers.c | 365 + apps/netutils/thttpd/timers.h | 136 + apps/netutils/uiplib/Makefile | 106 + apps/netutils/uiplib/uip_gethostaddr.c | 106 + apps/netutils/uiplib/uip_getmacaddr.c | 104 + apps/netutils/uiplib/uip_ipmsfilter.c | 116 + apps/netutils/uiplib/uip_parsehttpurl.c | 149 + apps/netutils/uiplib/uip_server.c | 184 + apps/netutils/uiplib/uip_setdraddr.c | 117 + apps/netutils/uiplib/uip_sethostaddr.c | 117 + apps/netutils/uiplib/uip_setmacaddr.c | 114 + apps/netutils/uiplib/uip_setnetmask.c | 116 + apps/netutils/uiplib/uiplib.c | 95 + apps/netutils/webclient/Makefile | 97 + apps/netutils/webclient/webclient.c | 583 + apps/netutils/webserver/Makefile | 97 + apps/netutils/webserver/httpd.c | 498 + apps/netutils/webserver/httpd.h | 118 + apps/netutils/webserver/httpd_cgi.c | 170 + apps/netutils/webserver/httpd_cgi.h | 69 + apps/netutils/webserver/httpd_fs.c | 155 + apps/netutils/webserver/httpd_fsdata.c | 614 + apps/netutils/webserver/httpd_fsdata.h | 79 + apps/netutils/webserver/makefsdata | 75 + apps/nshlib/Makefile | 124 + apps/nshlib/README.txt | 1049 + apps/nshlib/nsh.h | 497 + apps/nshlib/nsh_apps.c | 120 + apps/nshlib/nsh_dbgcmds.c | 355 + apps/nshlib/nsh_ddcmd.c | 640 + apps/nshlib/nsh_envcmds.c | 336 + apps/nshlib/nsh_fscmds.c | 1341 ++ apps/nshlib/nsh_mmcmds.c | 95 + apps/nshlib/nsh_netcmds.c | 863 + apps/nshlib/nsh_netinit.c | 170 + apps/nshlib/nsh_parse.c | 1336 ++ apps/nshlib/nsh_proccmds.c | 309 + apps/nshlib/nsh_romfsetc.c | 124 + apps/nshlib/nsh_romfsimg.h | 89 + apps/nshlib/nsh_serial.c | 508 + apps/nshlib/nsh_telnetd.c | 853 + apps/nshlib/nsh_test.c | 437 + apps/nshlib/nsh_timcmds.c | 330 + apps/nshlib/rcS.template | 5 + apps/system/Makefile | 70 + apps/system/free/Makefile | 110 + apps/system/free/README.txt | 6 + apps/system/free/free.c | 112 + apps/system/i2c/Makefile | 103 + apps/system/i2c/README.txt | 397 + apps/system/i2c/i2c_bus.c | 99 + apps/system/i2c/i2c_common.c | 216 + apps/system/i2c/i2c_dev.c | 235 + apps/system/i2c/i2c_get.c | 257 + apps/system/i2c/i2c_main.c | 454 + apps/system/i2c/i2c_set.c | 275 + apps/system/i2c/i2c_verf.c | 249 + apps/system/i2c/i2ctool.h | 210 + apps/system/install/Makefile | 114 + apps/system/install/README.txt | 26 + apps/system/install/install.c | 412 + apps/vsn/Makefile | 71 + apps/vsn/hello/Makefile | 114 + apps/vsn/hello/README.txt | 5 + apps/vsn/hello/hello.c | 75 + apps/vsn/poweroff/Makefile | 114 + apps/vsn/poweroff/README.txt | 5 + apps/vsn/poweroff/poweroff.c | 54 + apps/vsn/ramtron/Makefile | 114 + apps/vsn/ramtron/README.txt | 7 + apps/vsn/ramtron/ramtron.c | 99 + apps/vsn/sdcard/Makefile | 114 + apps/vsn/sdcard/README.txt | 7 + apps/vsn/sdcard/sdcard.c | 134 + apps/vsn/sysinfo/Makefile | 114 + apps/vsn/sysinfo/README.txt | 6 + apps/vsn/sysinfo/sysinfo.c | 69 + misc/LICENSING.txt | 46 + misc/buildroot/.defconfig | 64 + misc/buildroot/ChangeLog | 111 + misc/buildroot/Config.in | 371 + misc/buildroot/Makefile | 224 + misc/buildroot/ReleaseNotes | 89 + misc/buildroot/configs/README.txt | 340 + misc/buildroot/configs/arm-defconfig | 112 + .../configs/arm7tdmi-defconfig-4.2.4 | 115 + .../configs/arm7tdmi-defconfig-4.3.3 | 116 + .../buildroot/configs/arm920t-defconfig-4.2.4 | 115 + .../buildroot/configs/arm920t-defconfig-4.3.3 | 119 + .../configs/arm920t-eabi-defconfig-4.5.2 | 121 + .../buildroot/configs/arm926t-defconfig-4.2.4 | 116 + .../buildroot/configs/arm926t-defconfig-4.3.3 | 117 + .../configs/arm926t-defconfig-nxflat | 110 + misc/buildroot/configs/avr-defconfig-4.3.3 | 99 + misc/buildroot/configs/avr-defconfig-4.5.2 | 99 + misc/buildroot/configs/bfin-defconfig-4.2.4 | 92 + .../configs/cortexm3-defconfig-4.3.3 | 116 + .../configs/cortexm3-defconfig-nxflat | 106 + .../configs/gdb-6_8-cygwin-1_7.patch | 19 + misc/buildroot/configs/h8300_defconfig | 92 + misc/buildroot/configs/i486-defconfig-4.3.3 | 103 + misc/buildroot/configs/m32c-defconfig-4.2.4 | 93 + misc/buildroot/configs/m32c-defconfig-4.3.3 | 93 + misc/buildroot/configs/m68hc11-config | 92 + misc/buildroot/configs/m68hc12-config-3.4.6 | 93 + misc/buildroot/configs/m68hc12-config-4.3.3 | 94 + misc/buildroot/configs/m68k-defconfig | 92 + misc/buildroot/configs/m9s12x-config-3.3.6 | 96 + misc/buildroot/configs/sh-defconfig | 99 + misc/buildroot/package/Makefile.in | 111 + .../package/config/Kconfig-language.txt | 282 + misc/buildroot/package/config/Makefile | 134 + misc/buildroot/package/config/conf.c | 583 + misc/buildroot/package/config/confdata.c | 397 + misc/buildroot/package/config/expr.c | 1099 + misc/buildroot/package/config/expr.h | 195 + .../package/config/lex.zconf.c_shipped | 3688 ++++ misc/buildroot/package/config/lkc.h | 123 + misc/buildroot/package/config/lkc_proto.h | 40 + .../package/config/lxdialog/BIG.FAT.WARNING | 4 + .../package/config/lxdialog/checklist.c | 372 + .../package/config/lxdialog/colors.h | 161 + .../package/config/lxdialog/dialog.h | 199 + .../package/config/lxdialog/inputbox.c | 240 + .../package/config/lxdialog/menubox.c | 438 + .../package/config/lxdialog/msgbox.c | 85 + .../package/config/lxdialog/textbox.c | 556 + misc/buildroot/package/config/lxdialog/util.c | 375 + .../buildroot/package/config/lxdialog/yesno.c | 118 + misc/buildroot/package/config/mconf.c | 973 + misc/buildroot/package/config/menu.c | 390 + misc/buildroot/package/config/symbol.c | 809 + misc/buildroot/package/config/util.c | 108 + misc/buildroot/package/config/zconf.l | 366 + .../package/config/zconf.tab.c_shipped | 2130 ++ .../package/config/zconf.tab.h_shipped | 125 + misc/buildroot/package/config/zconf.y | 690 + misc/buildroot/package/gnuconfig/ChangeLog | 1813 ++ misc/buildroot/package/gnuconfig/Makefile | 15 + .../package/gnuconfig/README.buildroot | 16 + misc/buildroot/package/gnuconfig/config.guess | 1517 ++ misc/buildroot/package/gnuconfig/config.sub | 1627 ++ misc/buildroot/package/gnuconfig/gnuconfig.mk | 3 + .../gnuconfig/patches/config.sub.ps2.patch | 50 + .../gnuconfig/patches/config.sub.sh.patch | 39 + .../gnuconfig/testsuite/config-guess.data | 23 + .../gnuconfig/testsuite/config-guess.sh | 47 + .../gnuconfig/testsuite/config-sub.data | 92 + .../package/gnuconfig/testsuite/config-sub.sh | 35 + .../package/gnuconfig/testsuite/uname.in | 9 + misc/buildroot/package/gnuconfig/uname | 9 + misc/buildroot/toolchain/Config.in | 46 + misc/buildroot/toolchain/Makefile.in | 21 + .../binutils/2.17/110-arm-eabi-conf.patch | 24 + .../2.17/300-001_ld_makefile_patch.patch | 50 + .../2.17/300-006_better_file_error.patch | 43 + .../2.17/300-012_check_ldrunpath_length.patch | 47 + .../2.17/400-makeinfo-version-check.patch | 12 + .../2.17/400-mips-ELF_MAXPAGESIZE-4K.patch | 26 + .../binutils/2.18/100-s12x-20100504.patch | 8646 ++++++++ .../binutils/2.19.1/110-arm-eabi-conf.patch | 24 + .../binutils/2.19.1/120-sh-conf.patch | 42 + .../2.19.1/300-001_ld_makefile_patch.patch | 24 + .../300-012_check_ldrunpath_length.patch | 21 + .../binutils/2.19.1/400-thumb-cputype.patch | 16 + .../binutils/2.19/110-arm-eabi-conf.patch | 24 + .../toolchain/binutils/2.19/120-sh-conf.patch | 42 + .../2.19/300-001_ld_makefile_patch.patch | 24 + .../2.19/300-012_check_ldrunpath_length.patch | 21 + .../binutils/2.21/110-arm-eabi-conf.patch | 24 + .../toolchain/binutils/2.21/120-sh-conf.patch | 42 + .../2.21/300-001_ld_makefile_patch.patch | 24 + .../2.21/300-012_check_ldrunpath_length.patch | 21 + misc/buildroot/toolchain/binutils/Config.in | 47 + misc/buildroot/toolchain/binutils/binutils.mk | 125 + .../toolchain/dependencies/dependencies.mk | 25 + .../toolchain/dependencies/dependencies.sh | 269 + .../toolchain/gcc/3.3.6/120-softfloat.patch | 14 + .../toolchain/gcc/3.3.6/500-loop.patch | 10 + .../gcc/3.3.6/800-arm-bigendian.patch | 68 + .../toolchain/gcc/3.3.6/810-mips-xgot.patch | 6 + .../gcc/3.3.6/820-no-mips-empic-relocs.patch | 59 + .../gcc/3.3.6/830-gcc-bug-num-22167.patch | 16 + .../gcc/3.3.6/900-sx12-20101109.patch | 17940 ++++++++++++++++ .../toolchain/gcc/3.3.6/910-create-mode.patch | 11 + .../gcc/3.4.6/300-libstdc++-pic.patch | 47 + .../toolchain/gcc/3.4.6/304-index_macro.patch | 24 + .../3.4.6/600-gcc34-arm-ldm-peephole.patch | 65 + .../3.4.6/601-gcc34-arm-ldm-peephole2.patch | 42 + .../gcc/3.4.6/601-gcc34-arm-ldm.patch | 119 + .../3.4.6/602-sdk-libstdc++-includes.patch | 22 + .../toolchain/gcc/3.4.6/700-pr15068-fix.patch | 44 + .../gcc/3.4.6/71_all_sh-pr16665-fix.patch | 43 + .../3.4.6/72_all_sh-no-reorder-blocks.patch | 13 + .../gcc/3.4.6/73_all_sh-pr20617.patch | 28 + .../gcc/3.4.6/800-arm-bigendian.patch | 68 + .../toolchain/gcc/3.4.6/810-mips-xgot.patch | 6 + .../toolchain/gcc/3.4.6/900-nios2.patch | 10211 +++++++++ .../gcc/3.4.6/910-gcc-3.4.6-ocreatmode.patch | 12 + .../gcc/3.4.6/arm-softfloat.patch.conditional | 270 + .../gcc/4.2.4/300-libstdc++-pic.patch | 50 + .../toolchain/gcc/4.2.4/304-index_macro.patch | 24 + .../4.2.4/305-libmudflap-susv3-legacy.patch | 49 + .../gcc/4.2.4/307-locale_facets.patch | 26 + .../4.2.4/402-libbackend_dep_gcov-iov.h.patch | 13 + .../gcc/4.2.4/800-arm-bigendian.patch | 67 + .../4.2.4/904-flatten-switch-stmt-00.patch | 153 + .../toolchain/gcc/4.2.4/910-soft-float.patch | 26 + .../toolchain/gcc/4.2.4/920-soft-float.patch | 21 + .../gcc/4.2.4/930-nuttx-nolibc.patch | 30 + .../gcc/4.2.4/940-nuttx-nolibstdc.patch | 13 + .../4.3.3/300-libmudflap-susv3-legacy.patch | 49 + .../gcc/4.3.3/310-arm-softfloat-libgcc.patch | 29 + .../500-backport-fix-for-bug-39076.patch | 11 + .../510-backport-fix-for-bug-32044.patch | 188 + .../600-arm_insn-opinit-RTX_CODE-fixup.patch | 41 + .../4.3.3/610-gcc-4.3.0-fix-header.00.patch | 15 + .../620-gcc-4.3.2-armeabi-aapcs-linux.patch | 18 + ....3.0-cris-pragma-pack-warning-remove.patch | 13 + .../gcc/4.3.3/700-gcc-4.3.3-arm7arch.patch | 16 + .../gcc/4.3.3/900-nuttx-nolibc.patch | 30 + .../gcc/4.3.3/910-nuttx-nolibstdc.patch | 13 + .../gcc/4.3.3/920-gcc-4.3.3-objext.patch | 22 + .../4.5.2/305-libmudflap-susv3-legacy.patch | 49 + .../gcc/4.5.2/810-arm-softfloat-libgcc.patch | 38 + .../gcc/4.5.2/820-arm-unbreak-armv4t.patch | 14 + .../toolchain/gcc/4.5.2/830-arm-pr43440.patch | 345 + .../toolchain/gcc/4.5.2/850-arm-pr44392.patch | 70 + .../gcc/4.5.2/900-nuttx-nolibstdc.patch | 13 + misc/buildroot/toolchain/gcc/Config.in | 106 + misc/buildroot/toolchain/gcc/Makefile.in | 62 + misc/buildroot/toolchain/gcc/gcc-nuttx-3.x.mk | 226 + misc/buildroot/toolchain/gcc/gcc-nuttx-4.x.mk | 208 + .../toolchain/gcc/i386-gcc-soft-float.patch | 61 + .../gdb/6.3/400-mips-coredump.patch-2.4.23-29 | 28 + .../gdb/6.3/500-thread-timeout.patch | 34 + .../6.3/600-debian_10.selected-frame.patch | 552 + .../gdb/6.3/620-debian_static-thread-db.patch | 156 + .../6.3/630-debian_24.tracepoint-segv.patch | 15 + ...-debian_dwarf2-frame-signal-unwinder.patch | 120 + .../6.3/650-debian_vsyscall-gdb-support.patch | 245 + .../6.3/660-debian_dwarf-cfa-restore.patch | 23 + .../gdb/6.3/680-debian_sim-destdir.patch | 53 + .../6.3/690-debian_member-field-symtab.patch | 35 + .../6.3/700-debian_cp-pass-by-reference.patch | 464 + ...-debian_thread-db-multiple-libraries.patch | 593 + .../6.3/720-debian_static-threads-test.patch | 36 + .../730-debian_gdb-fix-tracefork-check.patch | 225 + .../6.3/740-debian_make-cv-type-crash.patch | 132 + .../gdb/6.3/750-debian_sparc-singlestep.patch | 37 + ...760-debian_vsyscall-bfd-close-result.patch | 20 + .../6.3/770-debian_vfork-done-spelling.patch | 31 + .../6.3/780-debian_gdbserver-rdynamic.patch | 675 + .../6.3/790-debian_dwarf2-cfi-warning.patch | 39 + ...800-debian_linux-use-underscore-exit.patch | 22 + .../6.3/810-debian_bfd-no-kylix-crash.patch | 47 + ...0-debian_disable-linux-fork-messages.patch | 46 + .../gdb/6.4/400-mips-coredump.patch-2.4.23-29 | 28 + .../gdb/6.4/500-thread-timeout.patch | 34 + .../6.4/600-fix-compile-flag-mismatch.patch | 87 + .../gdb/6.4/700-m68hc1x-20060122.patch | 5682 +++++ .../6.8/600-fix-compile-flag-mismatch.patch | 31 + misc/buildroot/toolchain/gdb/Config.in | 48 + misc/buildroot/toolchain/gdb/gdb.mk | 224 + .../400-mips-coredump.patch-2.4.23-29 | 30 + .../gdb/snapshot/400-mips-nptl-support.patch | 143 + .../gdb/snapshot/500-thread-timeout.patch | 34 + .../gdb/snapshot/680-debian_sim-destdir.patch | 14 + .../690-debian_member-field-symtab.patch | 20 + misc/buildroot/toolchain/genromfs/Config.in | 8 + .../toolchain/genromfs/genromfs-0.5.2.tar.gz | Bin 0 -> 21069 bytes misc/buildroot/toolchain/genromfs/genromfs.mk | 38 + misc/buildroot/toolchain/nxflat/Config.in | 9 + misc/buildroot/toolchain/nxflat/Makefile | 74 + misc/buildroot/toolchain/nxflat/arm/Makefile | 50 + misc/buildroot/toolchain/nxflat/arm/arch.h | 303 + misc/buildroot/toolchain/nxflat/arm/disarm.c | 1004 + .../toolchain/nxflat/arm/dyncall_skeleton.def | 216 + misc/buildroot/toolchain/nxflat/ldnxflat.c | 2336 ++ misc/buildroot/toolchain/nxflat/mknxflat.c | 769 + misc/buildroot/toolchain/nxflat/nxflat.h | 202 + misc/buildroot/toolchain/nxflat/nxflat.mk | 69 + misc/buildroot/toolchain/nxflat/readnxflat.c | 717 + .../buildroot/toolchain/nxflat/reloc-macros.h | 140 + .../toolchain/nxflat/thumb2/Makefile | 50 + misc/buildroot/toolchain/nxflat/thumb2/arch.h | 303 + .../toolchain/nxflat/thumb2/disthumb2.c | 16 + .../nxflat/thumb2/dyncall_skeleton.def | 222 + misc/buildroot/toolchain/patch-kernel.sh | 54 + misc/buildroot/toolchain/sstrip/Config.in | 11 + misc/buildroot/toolchain/sstrip/sstrip.c | 468 + misc/buildroot/toolchain/sstrip/sstrip.mk | 69 + misc/buildroot/zipme.sh | 80 + misc/drivers/INSTALL.sh | 101 + misc/drivers/rtl8187x/INSTALL.sh | 134 + misc/drivers/rtl8187x/rtl8187x.c | 4213 ++++ misc/drivers/rtl8187x/rtl8187x.h | 475 + misc/pascal/ChangeLog | 31 + misc/pascal/Configure | 188 + misc/pascal/Make.config.h | 78 + misc/pascal/Make.defs | 50 + misc/pascal/Makefile | 115 + misc/pascal/README | 25 + misc/pascal/Reconfigure | 89 + misc/pascal/ReleaseNotes | 40 + misc/pascal/config.info | 64 + misc/pascal/doc/PascalGrammar.txt | 455 + misc/pascal/doc/PascalNotes.txt | 135 + misc/pascal/include/keywords.h | 82 + misc/pascal/include/paslib.h | 90 + misc/pascal/include/pdefs.h | 115 + misc/pascal/include/pedefs.h | 280 + misc/pascal/include/perr.h | 56 + misc/pascal/include/pfdefs.h | 93 + misc/pascal/include/pinsn.h | 82 + misc/pascal/include/podefs.h | 204 + misc/pascal/include/poff.h | 429 + misc/pascal/include/pofflib.h | 313 + misc/pascal/include/pxdefs.h | 232 + misc/pascal/insn16/Makefile | 82 + .../pascal/insn16/doc/PascalOptimizations.txt | 239 + misc/pascal/insn16/doc/PascalTestStatus.txt | 208 + misc/pascal/insn16/include/pdbg.h | 52 + misc/pascal/insn16/include/pexec.h | 156 + misc/pascal/insn16/include/pinsn16.h | 408 + misc/pascal/insn16/libinsn/Makefile | 76 + misc/pascal/insn16/libinsn/paddopcode.c | 100 + misc/pascal/insn16/libinsn/paddtmpopcode.c | 100 + misc/pascal/insn16/libinsn/pdasm.c | 569 + misc/pascal/insn16/libinsn/pgen.c | 312 + misc/pascal/insn16/libinsn/pgetopcode.c | 140 + misc/pascal/insn16/libinsn/preloc.c | 149 + misc/pascal/insn16/plist/Makefile | 90 + misc/pascal/insn16/plist/plist.c | 360 + misc/pascal/insn16/popt/Makefile | 92 + misc/pascal/insn16/popt/pcopt.c | 906 + misc/pascal/insn16/popt/pcopt.h | 53 + misc/pascal/insn16/popt/pfopt.c | 473 + misc/pascal/insn16/popt/pfopt.h | 54 + misc/pascal/insn16/popt/pjopt.c | 450 + misc/pascal/insn16/popt/pjopt.h | 52 + misc/pascal/insn16/popt/plopt.c | 250 + misc/pascal/insn16/popt/plopt.h | 54 + misc/pascal/insn16/popt/polocal.c | 301 + misc/pascal/insn16/popt/polocal.h | 74 + misc/pascal/insn16/popt/popt.c | 289 + misc/pascal/insn16/popt/popt.h | 52 + misc/pascal/insn16/popt/psopt.c | 387 + misc/pascal/insn16/popt/psopt.h | 54 + misc/pascal/insn16/prun/Make.defs | 38 + misc/pascal/insn16/prun/Makefile | 87 + misc/pascal/insn16/prun/pdbg.c | 748 + misc/pascal/insn16/prun/pexec.c | 2375 ++ misc/pascal/insn16/prun/pload.c | 176 + misc/pascal/insn16/prun/prun.c | 278 + misc/pascal/insn32/Makefile | 92 + misc/pascal/insn32/doc/insn32.txt | 119 + misc/pascal/insn32/include/builtins.h | 450 + misc/pascal/insn32/include/pexec.h | 160 + misc/pascal/insn32/include/pinsn32.h | 426 + misc/pascal/insn32/include/rinsn32.h | 226 + misc/pascal/insn32/libinsn/Makefile | 76 + misc/pascal/insn32/libinsn/paddopcode.c | 99 + misc/pascal/insn32/libinsn/paddtmpopcode.c | 99 + misc/pascal/insn32/libinsn/pdasm.c | 436 + misc/pascal/insn32/libinsn/pgen.c | 383 + misc/pascal/insn32/libinsn/pgetopcode.c | 128 + misc/pascal/insn32/libinsn/preloc.c | 149 + .../insn32/libinsn/presettmpopcodewrite.c | 99 + misc/pascal/insn32/plist/Makefile | 90 + misc/pascal/insn32/plist/plist.c | 388 + misc/pascal/insn32/popt/Makefile | 93 + misc/pascal/insn32/popt/pcopt.c | 840 + misc/pascal/insn32/popt/pcopt.h | 47 + misc/pascal/insn32/popt/pfopt.c | 544 + misc/pascal/insn32/popt/pfopt.h | 54 + misc/pascal/insn32/popt/pjopt.c | 449 + misc/pascal/insn32/popt/pjopt.h | 44 + misc/pascal/insn32/popt/plopt.c | 215 + misc/pascal/insn32/popt/plopt.h | 43 + misc/pascal/insn32/popt/polocal.c | 271 + misc/pascal/insn32/popt/polocal.h | 73 + misc/pascal/insn32/popt/popt.c | 327 + misc/pascal/insn32/popt/popt.h | 52 + misc/pascal/insn32/popt/psopt.c | 385 + misc/pascal/insn32/popt/psopt.h | 54 + misc/pascal/insn32/regm/Makefile | 94 + misc/pascal/insn32/regm/regm.c | 342 + misc/pascal/insn32/regm/regm.h | 67 + misc/pascal/insn32/regm/regm_pass1.c | 281 + misc/pascal/insn32/regm/regm_pass1.h | 58 + misc/pascal/insn32/regm/regm_pass2.c | 1526 ++ misc/pascal/insn32/regm/regm_pass2.h | 68 + misc/pascal/insn32/regm/regm_registers2.c | 542 + misc/pascal/insn32/regm/regm_registers2.h | 319 + misc/pascal/insn32/regm/regm_tree.c | 338 + misc/pascal/insn32/regm/regm_tree.h | 122 + misc/pascal/libpas/Make.defs | 38 + misc/pascal/libpas/Makefile | 67 + misc/pascal/libpas/pextension.c | 133 + misc/pascal/libpas/psignextend16.c | 58 + misc/pascal/libpas/pswap.c | 60 + misc/pascal/libpoff/Make.defs | 48 + misc/pascal/libpoff/Makefile | 47 + misc/pascal/libpoff/pfdbgcontainer.c | 106 + misc/pascal/libpoff/pfdbgdiscard.c | 94 + misc/pascal/libpoff/pfdbginfo.c | 158 + misc/pascal/libpoff/pfdhdr.c | 182 + misc/pascal/libpoff/pfdreloc.c | 108 + misc/pascal/libpoff/pfdsymbol.c | 117 + misc/pascal/libpoff/pfhandle.c | 195 + misc/pascal/libpoff/pfiprog.c | 93 + misc/pascal/libpoff/pfirodata.c | 103 + misc/pascal/libpoff/pflabel.c | 285 + misc/pascal/libpoff/pflineno.c | 334 + misc/pascal/libpoff/pfprivate.h | 190 + misc/pascal/libpoff/pfproghandle.c | 127 + misc/pascal/libpoff/pfrdbgfunc.c | 131 + misc/pascal/libpoff/pfread.c | 361 + misc/pascal/libpoff/pfrelease.c | 94 + misc/pascal/libpoff/pfrfname.c | 117 + misc/pascal/libpoff/pfrhdr.c | 118 + misc/pascal/libpoff/pfrlineno.c | 128 + misc/pascal/libpoff/pfrprog.c | 91 + misc/pascal/libpoff/pfrrawlineno.c | 111 + misc/pascal/libpoff/pfrrawreloc.c | 108 + misc/pascal/libpoff/pfrseek.c | 116 + misc/pascal/libpoff/pfrstring.c | 91 + misc/pascal/libpoff/pfrsymbol.c | 108 + misc/pascal/libpoff/pfswap.c | 252 + misc/pascal/libpoff/pfsymhandle.c | 127 + misc/pascal/libpoff/pftprog.c | 225 + misc/pascal/libpoff/pftsymbol.c | 189 + misc/pascal/libpoff/pfwdbgfunc.c | 174 + misc/pascal/libpoff/pfwfname.c | 146 + misc/pascal/libpoff/pfwhdr.c | 116 + misc/pascal/libpoff/pfwlineno.c | 165 + misc/pascal/libpoff/pfwprog.c | 128 + misc/pascal/libpoff/pfwreloc.c | 162 + misc/pascal/libpoff/pfwrite.c | 541 + misc/pascal/libpoff/pfwrodata.c | 193 + misc/pascal/libpoff/pfwstring.c | 218 + misc/pascal/libpoff/pfwsymbol.c | 152 + misc/pascal/libpoff/pfxprog.c | 96 + misc/pascal/libpoff/pfxrodata.c | 95 + misc/pascal/libpoff/pofferr.c | 94 + misc/pascal/nuttx/INSTALL.sh | 166 + misc/pascal/nuttx/Makefile | 138 + misc/pascal/nuttx/README.txt | 43 + misc/pascal/nuttx/keywords.h | 67 + misc/pascal/pascal/Makefile | 85 + misc/pascal/pascal/pas.c | 538 + misc/pascal/pascal/pas.h | 116 + misc/pascal/pascal/pasdefs.h | 284 + misc/pascal/pascal/pblck.c | 2263 ++ misc/pascal/pascal/pblck.h | 57 + misc/pascal/pascal/pcexpr.c | 576 + misc/pascal/pascal/pcfunc.c | 341 + misc/pascal/pascal/perr.c | 191 + misc/pascal/pascal/pexpr.c | 2737 +++ misc/pascal/pascal/pexpr.h | 98 + misc/pascal/pascal/pffunc.c | 452 + misc/pascal/pascal/pfunc.h | 57 + misc/pascal/pascal/pgen.c | 641 + misc/pascal/pascal/pgen.h | 89 + misc/pascal/pascal/pprgm.c | 265 + misc/pascal/pascal/pprgm.h | 47 + misc/pascal/pascal/pproc.c | 736 + misc/pascal/pascal/pproc.h | 49 + misc/pascal/pascal/pstm.c | 1683 ++ misc/pascal/pascal/pstm.h | 47 + misc/pascal/pascal/ptbl.c | 692 + misc/pascal/pascal/ptbl.h | 79 + misc/pascal/pascal/ptdefs.h | 209 + misc/pascal/pascal/ptkn.c | 899 + misc/pascal/pascal/ptkn.h | 65 + misc/pascal/pascal/punit.c | 599 + misc/pascal/pascal/punit.h | 51 + misc/pascal/plink/Makefile | 83 + misc/pascal/plink/plink.c | 551 + misc/pascal/plink/plink.h | 52 + misc/pascal/plink/plreloc.c | 255 + misc/pascal/plink/plreloc.h | 60 + misc/pascal/plink/plsym.c | 469 + misc/pascal/plink/plsym.h | 62 + misc/pascal/tests/501-uses.sh | 84 + misc/pascal/tests/debug.sh | 104 + misc/pascal/tests/list.sh | 73 + misc/pascal/tests/src/001-beginend.pas | 11 + misc/pascal/tests/src/002-writeln.pas | 17 + misc/pascal/tests/src/003-for.inp | 2 + misc/pascal/tests/src/003-for.pas | 16 + misc/pascal/tests/src/004-repeat.inp | 2 + misc/pascal/tests/src/004-repeat.pas | 18 + misc/pascal/tests/src/005-while.inp | 2 + misc/pascal/tests/src/005-while.pas | 19 + misc/pascal/tests/src/006-optconst.pas | 43 + misc/pascal/tests/src/007-function.pas | 16 + misc/pascal/tests/src/101-cosine.inp | 2 + misc/pascal/tests/src/101-cosine.pas | 29 + misc/pascal/tests/src/102-cen2fahr.pas | 22 + misc/pascal/tests/src/103-sumharm.inp | 2 + misc/pascal/tests/src/103-sumharm.pas | 46 + misc/pascal/tests/src/104-primes.pas | 43 + misc/pascal/tests/src/105-inflation.pas | 27 + misc/pascal/tests/src/201-strcat.pas | 36 + misc/pascal/tests/src/202-strcmp.pas | 47 + misc/pascal/tests/src/501-unit-cosine.pas | 36 + misc/pascal/tests/src/501-unit-data.pas | 21 + misc/pascal/tests/src/501-unit-sine.pas | 24 + misc/pascal/tests/src/501-uses.inp | 1 + misc/pascal/tests/src/501-uses.pas | 20 + misc/pascal/tests/src/801-cgihello.pas | 20 + misc/pascal/tests/src/802-cgiinfo.pas | 67 + misc/pascal/tests/src/803-redirect.pas | 137 + misc/pascal/tests/src/804-cgiform.pas | 322 + misc/pascal/tests/src/805-cgimail.pas | 553 + misc/pascal/tests/src/806-cgicook.pas | 771 + misc/pascal/tests/src/901-pageutils.pas | 5651 +++++ misc/pascal/tests/src/README | 38 + misc/pascal/tests/testall.sh | 124 + misc/pascal/tests/testone.sh | 166 + misc/pascal/zipme | 71 + misc/sims/README.txt | 35 + misc/sims/z80sim/README.txt | 24 + misc/sims/z80sim/example/Makefile | 44 + misc/sims/z80sim/example/example.asm | 84 + misc/sims/z80sim/src/Makefile | 39 + misc/sims/z80sim/src/main.c | 485 + misc/tools/genromfs-0.5.2.tar.gz | Bin 0 -> 21069 bytes nuttx/COPYING | 158 + nuttx/ChangeLog | 2285 ++ nuttx/Documentation/NXGraphicsSubsystem.html | 4155 ++++ nuttx/Documentation/NXOrganization.gif | Bin 0 -> 34880 bytes nuttx/Documentation/NuttShell.html | 2521 +++ nuttx/Documentation/NuttX.html | 2867 +++ nuttx/Documentation/NuttX.png | Bin 0 -> 4961 bytes nuttx/Documentation/NuttX2-a.png | Bin 0 -> 1533 bytes nuttx/Documentation/NuttX2-b.png | Bin 0 -> 1559 bytes nuttx/Documentation/NuttX2.png | Bin 0 -> 3441 bytes nuttx/Documentation/NuttX320.png | Bin 0 -> 4151 bytes nuttx/Documentation/NuttXBanner.html | 32 + nuttx/Documentation/NuttXCommercial.html | 74 + nuttx/Documentation/NuttXDemandPaging.html | 675 + nuttx/Documentation/NuttXDocumentation.html | 78 + nuttx/Documentation/NuttXLinks.html | 79 + nuttx/Documentation/NuttXNxFlat.html | 722 + nuttx/Documentation/NuttXRelated.html | 71 + nuttx/Documentation/NuttXScreenShot.jpg | Bin 0 -> 5872 bytes nuttx/Documentation/NuttxPortingGuide.html | 5232 +++++ nuttx/Documentation/NuttxUserGuide.html | 8061 +++++++ nuttx/Documentation/README.html | 231 + nuttx/Documentation/UsbTrace.html | 332 + nuttx/Documentation/award2_151_50.png | Bin 0 -> 10757 bytes nuttx/Documentation/backgd.gif | Bin 0 -> 1097 bytes nuttx/Documentation/editor_pick_2.png | Bin 0 -> 4951 bytes nuttx/Documentation/favicon.ico | Bin 0 -> 3126 bytes nuttx/Documentation/freeports.gif | Bin 0 -> 5087 bytes nuttx/Documentation/freeports.html | 24 + nuttx/Documentation/index.html | 20 + nuttx/Documentation/pm.png | Bin 0 -> 32504 bytes nuttx/Documentation/rss.gif | Bin 0 -> 451 bytes nuttx/Makefile | 512 + nuttx/README.txt | 527 + nuttx/ReleaseNotes | 2425 +++ nuttx/TODO | 1542 ++ nuttx/arch/8051/include/arch.h | 85 + nuttx/arch/8051/include/irq.h | 206 + nuttx/arch/8051/include/limits.h | 79 + nuttx/arch/8051/include/syscall.h | 82 + nuttx/arch/8051/include/types.h | 98 + nuttx/arch/8051/src/Makefile | 233 + nuttx/arch/8051/src/up_allocateheap.c | 89 + nuttx/arch/8051/src/up_assert.c | 141 + nuttx/arch/8051/src/up_blocktask.c | 172 + nuttx/arch/8051/src/up_debug.c | 255 + nuttx/arch/8051/src/up_delay.c | 93 + nuttx/arch/8051/src/up_exit.c | 105 + nuttx/arch/8051/src/up_head.S | 471 + nuttx/arch/8051/src/up_idle.c | 96 + nuttx/arch/8051/src/up_initialize.c | 144 + nuttx/arch/8051/src/up_initialstate.c | 119 + nuttx/arch/8051/src/up_internal.h | 152 + nuttx/arch/8051/src/up_interruptcontext.c | 70 + nuttx/arch/8051/src/up_irq.c | 152 + nuttx/arch/8051/src/up_irqtest.c | 273 + nuttx/arch/8051/src/up_putc.c | 81 + nuttx/arch/8051/src/up_releasepending.c | 135 + nuttx/arch/8051/src/up_reprioritizertr.c | 185 + nuttx/arch/8051/src/up_restorecontext.c | 296 + nuttx/arch/8051/src/up_savecontext.c | 362 + nuttx/arch/8051/src/up_timerisr.c | 147 + nuttx/arch/8051/src/up_unblocktask.c | 166 + nuttx/arch/README.txt | 332 + nuttx/arch/arm/include/arch.h | 122 + nuttx/arch/arm/include/arm/irq.h | 231 + nuttx/arch/arm/include/arm/syscall.h | 243 + nuttx/arch/arm/include/armv7-m/irq.h | 392 + nuttx/arch/arm/include/armv7-m/syscall.h | 243 + nuttx/arch/arm/include/c5471/irq.h | 105 + nuttx/arch/arm/include/dm320/irq.h | 134 + nuttx/arch/arm/include/imx/irq.h | 164 + nuttx/arch/arm/include/irq.h | 100 + nuttx/arch/arm/include/kinetis/irq.h | 343 + nuttx/arch/arm/include/limits.h | 81 + nuttx/arch/arm/include/lm3s/irq.h | 462 + nuttx/arch/arm/include/lpc17xx/irq.h | 285 + nuttx/arch/arm/include/lpc214x/irq.h | 130 + nuttx/arch/arm/include/lpc2378/irq.h | 151 + nuttx/arch/arm/include/lpc31xx/irq.h | 118 + nuttx/arch/arm/include/sam3u/irq.h | 297 + nuttx/arch/arm/include/serial.h | 58 + nuttx/arch/arm/include/stm32/chip.h | 433 + nuttx/arch/arm/include/stm32/irq.h | 115 + .../arch/arm/include/stm32/stm32f10xxx_irq.h | 218 + .../arch/arm/include/stm32/stm32f40xxx_irq.h | 185 + nuttx/arch/arm/include/str71x/irq.h | 151 + nuttx/arch/arm/include/syscall.h | 90 + nuttx/arch/arm/include/types.h | 101 + nuttx/arch/arm/include/watchdog.h | 61 + nuttx/arch/arm/src/Makefile | 161 + nuttx/arch/arm/src/arm/arm.h | 451 + nuttx/arch/arm/src/arm/pg_macros.h | 522 + nuttx/arch/arm/src/arm/up_allocpage.c | 243 + nuttx/arch/arm/src/arm/up_assert.c | 325 + nuttx/arch/arm/src/arm/up_blocktask.c | 167 + nuttx/arch/arm/src/arm/up_cache.S | 74 + nuttx/arch/arm/src/arm/up_checkmapping.c | 123 + nuttx/arch/arm/src/arm/up_copystate.c | 82 + nuttx/arch/arm/src/arm/up_dataabort.c | 201 + nuttx/arch/arm/src/arm/up_doirq.c | 114 + .../arch/arm/src/arm/up_fullcontextrestore.S | 118 + nuttx/arch/arm/src/arm/up_head.S | 638 + nuttx/arch/arm/src/arm/up_initialstate.c | 146 + nuttx/arch/arm/src/arm/up_nommuhead.S | 167 + nuttx/arch/arm/src/arm/up_pginitialize.c | 96 + nuttx/arch/arm/src/arm/up_prefetchabort.c | 154 + nuttx/arch/arm/src/arm/up_releasepending.c | 132 + nuttx/arch/arm/src/arm/up_reprioritizertr.c | 187 + nuttx/arch/arm/src/arm/up_saveusercontext.S | 119 + nuttx/arch/arm/src/arm/up_schedulesigaction.c | 204 + nuttx/arch/arm/src/arm/up_sigdeliver.c | 139 + nuttx/arch/arm/src/arm/up_syscall.c | 96 + nuttx/arch/arm/src/arm/up_unblocktask.c | 159 + nuttx/arch/arm/src/arm/up_undefinedinsn.c | 81 + nuttx/arch/arm/src/arm/up_va2pte.c | 121 + nuttx/arch/arm/src/arm/up_vectoraddrexcptn.S | 83 + nuttx/arch/arm/src/arm/up_vectors.S | 446 + nuttx/arch/arm/src/arm/up_vectortab.S | 103 + nuttx/arch/arm/src/armv7-m/exc_return.h | 90 + nuttx/arch/arm/src/armv7-m/mpu.h | 509 + nuttx/arch/arm/src/armv7-m/nvic.h | 497 + nuttx/arch/arm/src/armv7-m/psr.h | 87 + nuttx/arch/arm/src/armv7-m/svcall.h | 94 + nuttx/arch/arm/src/armv7-m/up_assert.c | 334 + nuttx/arch/arm/src/armv7-m/up_blocktask.c | 167 + nuttx/arch/arm/src/armv7-m/up_copystate.c | 86 + nuttx/arch/arm/src/armv7-m/up_doirq.c | 123 + nuttx/arch/arm/src/armv7-m/up_fpu.S | 236 + .../arm/src/armv7-m/up_fullcontextrestore.S | 95 + nuttx/arch/arm/src/armv7-m/up_hardfault.c | 144 + nuttx/arch/arm/src/armv7-m/up_initialstate.c | 157 + nuttx/arch/arm/src/armv7-m/up_memfault.c | 110 + nuttx/arch/arm/src/armv7-m/up_mpu.c | 176 + .../arch/arm/src/armv7-m/up_releasepending.c | 130 + .../arch/arm/src/armv7-m/up_reprioritizertr.c | 181 + .../arch/arm/src/armv7-m/up_saveusercontext.S | 104 + .../arm/src/armv7-m/up_schedulesigaction.c | 208 + nuttx/arch/arm/src/armv7-m/up_sigdeliver.c | 142 + nuttx/arch/arm/src/armv7-m/up_svcall.c | 360 + nuttx/arch/arm/src/armv7-m/up_switchcontext.S | 97 + nuttx/arch/arm/src/armv7-m/up_unblocktask.c | 157 + nuttx/arch/arm/src/c5471/Make.defs | 49 + nuttx/arch/arm/src/c5471/c5471_ethernet.c | 2178 ++ nuttx/arch/arm/src/c5471/c5471_irq.c | 246 + nuttx/arch/arm/src/c5471/c5471_lowputc.S | 129 + nuttx/arch/arm/src/c5471/c5471_serial.c | 871 + nuttx/arch/arm/src/c5471/c5471_timerisr.c | 128 + nuttx/arch/arm/src/c5471/c5471_vectors.S | 485 + nuttx/arch/arm/src/c5471/c5471_watchdog.c | 398 + nuttx/arch/arm/src/c5471/chip.h | 371 + nuttx/arch/arm/src/common/up_allocateheap.c | 83 + nuttx/arch/arm/src/common/up_arch.h | 105 + nuttx/arch/arm/src/common/up_checkstack.c | 147 + nuttx/arch/arm/src/common/up_createstack.c | 197 + nuttx/arch/arm/src/common/up_etherstub.c | 86 + nuttx/arch/arm/src/common/up_exit.c | 174 + nuttx/arch/arm/src/common/up_idle.c | 91 + nuttx/arch/arm/src/common/up_initialize.c | 168 + nuttx/arch/arm/src/common/up_internal.h | 373 + .../arch/arm/src/common/up_interruptcontext.c | 70 + nuttx/arch/arm/src/common/up_lowputs.c | 74 + nuttx/arch/arm/src/common/up_mdelay.c | 90 + nuttx/arch/arm/src/common/up_modifyreg16.c | 85 + nuttx/arch/arm/src/common/up_modifyreg32.c | 85 + nuttx/arch/arm/src/common/up_modifyreg8.c | 85 + nuttx/arch/arm/src/common/up_puts.c | 75 + nuttx/arch/arm/src/common/up_releasestack.c | 79 + nuttx/arch/arm/src/common/up_udelay.c | 129 + nuttx/arch/arm/src/common/up_usestack.c | 155 + nuttx/arch/arm/src/dm320/Make.defs | 54 + nuttx/arch/arm/src/dm320/chip.h | 61 + nuttx/arch/arm/src/dm320/dm320_ahb.h | 59 + nuttx/arch/arm/src/dm320/dm320_allocateheap.c | 83 + nuttx/arch/arm/src/dm320/dm320_boot.c | 237 + nuttx/arch/arm/src/dm320/dm320_busc.h | 58 + nuttx/arch/arm/src/dm320/dm320_clkc.h | 81 + nuttx/arch/arm/src/dm320/dm320_decodeirq.c | 129 + nuttx/arch/arm/src/dm320/dm320_emif.h | 108 + nuttx/arch/arm/src/dm320/dm320_framebuffer.c | 1438 ++ nuttx/arch/arm/src/dm320/dm320_gio.h | 175 + nuttx/arch/arm/src/dm320/dm320_intc.h | 101 + nuttx/arch/arm/src/dm320/dm320_irq.c | 250 + nuttx/arch/arm/src/dm320/dm320_lowputc.S | 130 + nuttx/arch/arm/src/dm320/dm320_memorymap.h | 263 + nuttx/arch/arm/src/dm320/dm320_osd.h | 114 + nuttx/arch/arm/src/dm320/dm320_restart.S | 138 + nuttx/arch/arm/src/dm320/dm320_serial.c | 839 + nuttx/arch/arm/src/dm320/dm320_timer.h | 108 + nuttx/arch/arm/src/dm320/dm320_timerisr.c | 157 + nuttx/arch/arm/src/dm320/dm320_uart.h | 176 + nuttx/arch/arm/src/dm320/dm320_usb.h | 249 + nuttx/arch/arm/src/dm320/dm320_usbdev.c | 2569 +++ nuttx/arch/arm/src/imx/Make.defs | 54 + nuttx/arch/arm/src/imx/chip.h | 65 + nuttx/arch/arm/src/imx/imx_aitc.h | 119 + nuttx/arch/arm/src/imx/imx_allocateheap.c | 118 + nuttx/arch/arm/src/imx/imx_boot.c | 225 + nuttx/arch/arm/src/imx/imx_cspi.h | 210 + nuttx/arch/arm/src/imx/imx_decodeirq.c | 136 + nuttx/arch/arm/src/imx/imx_dma.h | 250 + nuttx/arch/arm/src/imx/imx_eim.h | 85 + nuttx/arch/arm/src/imx/imx_gpio.c | 122 + nuttx/arch/arm/src/imx/imx_gpio.h | 562 + nuttx/arch/arm/src/imx/imx_i2c.h | 69 + nuttx/arch/arm/src/imx/imx_irq.c | 145 + nuttx/arch/arm/src/imx/imx_lowputc.S | 130 + nuttx/arch/arm/src/imx/imx_memorymap.h | 258 + nuttx/arch/arm/src/imx/imx_rtc.h | 85 + nuttx/arch/arm/src/imx/imx_serial.c | 1244 ++ nuttx/arch/arm/src/imx/imx_spi.c | 1157 + nuttx/arch/arm/src/imx/imx_system.h | 187 + nuttx/arch/arm/src/imx/imx_timer.h | 104 + nuttx/arch/arm/src/imx/imx_timerisr.c | 164 + nuttx/arch/arm/src/imx/imx_uart.h | 227 + nuttx/arch/arm/src/imx/imx_usbd.h | 320 + nuttx/arch/arm/src/imx/imx_wdog.h | 81 + nuttx/arch/arm/src/kinetis/Make.defs | 94 + nuttx/arch/arm/src/kinetis/chip.h | 853 + nuttx/arch/arm/src/kinetis/kinetis_adc.h | 313 + nuttx/arch/arm/src/kinetis/kinetis_aips.h | 208 + nuttx/arch/arm/src/kinetis/kinetis_axbs.h | 251 + .../arm/src/kinetis/kinetis_clockconfig.c | 379 + nuttx/arch/arm/src/kinetis/kinetis_clrpend.c | 104 + nuttx/arch/arm/src/kinetis/kinetis_cmp.h | 190 + nuttx/arch/arm/src/kinetis/kinetis_cmt.h | 138 + nuttx/arch/arm/src/kinetis/kinetis_config.h | 235 + nuttx/arch/arm/src/kinetis/kinetis_crc.h | 117 + nuttx/arch/arm/src/kinetis/kinetis_dac.h | 235 + nuttx/arch/arm/src/kinetis/kinetis_dma.h | 775 + nuttx/arch/arm/src/kinetis/kinetis_dmamux.h | 111 + nuttx/arch/arm/src/kinetis/kinetis_dspi.h | 321 + nuttx/arch/arm/src/kinetis/kinetis_enet.c | 1565 ++ nuttx/arch/arm/src/kinetis/kinetis_enet.h | 609 + nuttx/arch/arm/src/kinetis/kinetis_ewm.h | 90 + nuttx/arch/arm/src/kinetis/kinetis_flexbus.h | 213 + nuttx/arch/arm/src/kinetis/kinetis_flexcan.h | 318 + nuttx/arch/arm/src/kinetis/kinetis_fmc.h | 389 + nuttx/arch/arm/src/kinetis/kinetis_ftfl.h | 159 + nuttx/arch/arm/src/kinetis/kinetis_ftm.h | 528 + nuttx/arch/arm/src/kinetis/kinetis_gpio.h | 142 + nuttx/arch/arm/src/kinetis/kinetis_i2c.h | 185 + nuttx/arch/arm/src/kinetis/kinetis_i2s.h | 297 + nuttx/arch/arm/src/kinetis/kinetis_idle.c | 104 + nuttx/arch/arm/src/kinetis/kinetis_internal.h | 847 + nuttx/arch/arm/src/kinetis/kinetis_irq.c | 517 + .../arch/arm/src/kinetis/kinetis_k40pinmux.h | 518 + .../arch/arm/src/kinetis/kinetis_k60pinmux.h | 481 + nuttx/arch/arm/src/kinetis/kinetis_llwu.h | 252 + nuttx/arch/arm/src/kinetis/kinetis_lowputc.c | 452 + nuttx/arch/arm/src/kinetis/kinetis_lptmr.h | 133 + nuttx/arch/arm/src/kinetis/kinetis_mcg.h | 186 + nuttx/arch/arm/src/kinetis/kinetis_mcm.h | 151 + .../arch/arm/src/kinetis/kinetis_memorymap.h | 343 + nuttx/arch/arm/src/kinetis/kinetis_mmcau.h | 138 + nuttx/arch/arm/src/kinetis/kinetis_mpu.h | 398 + nuttx/arch/arm/src/kinetis/kinetis_osc.h | 84 + nuttx/arch/arm/src/kinetis/kinetis_pdb.h | 255 + nuttx/arch/arm/src/kinetis/kinetis_pin.c | 261 + nuttx/arch/arm/src/kinetis/kinetis_pindma.c | 146 + nuttx/arch/arm/src/kinetis/kinetis_pingpio.c | 151 + nuttx/arch/arm/src/kinetis/kinetis_pinirq.c | 438 + nuttx/arch/arm/src/kinetis/kinetis_pinmux.h | 75 + nuttx/arch/arm/src/kinetis/kinetis_pit.h | 124 + nuttx/arch/arm/src/kinetis/kinetis_pmc.h | 111 + nuttx/arch/arm/src/kinetis/kinetis_port.h | 431 + nuttx/arch/arm/src/kinetis/kinetis_rngb.h | 161 + nuttx/arch/arm/src/kinetis/kinetis_rtc.h | 207 + nuttx/arch/arm/src/kinetis/kinetis_sdhc.c | 2934 +++ nuttx/arch/arm/src/kinetis/kinetis_sdhc.h | 388 + nuttx/arch/arm/src/kinetis/kinetis_serial.c | 1350 ++ nuttx/arch/arm/src/kinetis/kinetis_sim.h | 545 + nuttx/arch/arm/src/kinetis/kinetis_slcd.h | 420 + nuttx/arch/arm/src/kinetis/kinetis_smc.h | 122 + nuttx/arch/arm/src/kinetis/kinetis_start.c | 158 + nuttx/arch/arm/src/kinetis/kinetis_timerisr.c | 157 + nuttx/arch/arm/src/kinetis/kinetis_tsi.h | 311 + nuttx/arch/arm/src/kinetis/kinetis_uart.h | 511 + nuttx/arch/arm/src/kinetis/kinetis_usbdcd.h | 141 + nuttx/arch/arm/src/kinetis/kinetis_usbotg.h | 328 + nuttx/arch/arm/src/kinetis/kinetis_vectors.S | 741 + nuttx/arch/arm/src/kinetis/kinetis_vrefv1.h | 92 + nuttx/arch/arm/src/kinetis/kinetis_wdog.c | 117 + nuttx/arch/arm/src/kinetis/kinetis_wdog.h | 135 + nuttx/arch/arm/src/lm3s/Make.defs | 54 + nuttx/arch/arm/src/lm3s/chip.h | 123 + nuttx/arch/arm/src/lm3s/lm3s_dumpgpio.c | 167 + nuttx/arch/arm/src/lm3s/lm3s_ethernet.c | 1466 ++ nuttx/arch/arm/src/lm3s/lm3s_ethernet.h | 203 + nuttx/arch/arm/src/lm3s/lm3s_flash.h | 128 + nuttx/arch/arm/src/lm3s/lm3s_gpio.c | 854 + nuttx/arch/arm/src/lm3s/lm3s_gpio.h | 395 + nuttx/arch/arm/src/lm3s/lm3s_gpioirq.c | 433 + nuttx/arch/arm/src/lm3s/lm3s_i2c.h | 247 + nuttx/arch/arm/src/lm3s/lm3s_internal.h | 516 + nuttx/arch/arm/src/lm3s/lm3s_irq.c | 462 + nuttx/arch/arm/src/lm3s/lm3s_lowputc.c | 308 + nuttx/arch/arm/src/lm3s/lm3s_memorymap.h | 319 + nuttx/arch/arm/src/lm3s/lm3s_serial.c | 1068 + nuttx/arch/arm/src/lm3s/lm3s_ssi.c | 1573 ++ nuttx/arch/arm/src/lm3s/lm3s_ssi.h | 235 + nuttx/arch/arm/src/lm3s/lm3s_start.c | 152 + nuttx/arch/arm/src/lm3s/lm3s_syscontrol.c | 314 + nuttx/arch/arm/src/lm3s/lm3s_syscontrol.h | 486 + nuttx/arch/arm/src/lm3s/lm3s_timerisr.c | 143 + nuttx/arch/arm/src/lm3s/lm3s_uart.h | 347 + nuttx/arch/arm/src/lm3s/lm3s_vectors.S | 720 + nuttx/arch/arm/src/lpc17xx/Make.defs | 99 + nuttx/arch/arm/src/lpc17xx/chip.h | 226 + nuttx/arch/arm/src/lpc17xx/lpc17_adc.c | 279 + nuttx/arch/arm/src/lpc17xx/lpc17_adc.h | 182 + .../arch/arm/src/lpc17xx/lpc17_allocateheap.c | 229 + nuttx/arch/arm/src/lpc17xx/lpc17_can.c | 435 + nuttx/arch/arm/src/lpc17xx/lpc17_can.h | 505 + .../arch/arm/src/lpc17xx/lpc17_clockconfig.c | 208 + nuttx/arch/arm/src/lpc17xx/lpc17_clrpend.c | 97 + nuttx/arch/arm/src/lpc17xx/lpc17_dac.c | 199 + nuttx/arch/arm/src/lpc17xx/lpc17_dac.h | 97 + nuttx/arch/arm/src/lpc17xx/lpc17_emacram.h | 242 + nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.c | 2502 +++ nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.h | 597 + nuttx/arch/arm/src/lpc17xx/lpc17_gpdma.c | 226 + nuttx/arch/arm/src/lpc17xx/lpc17_gpdma.h | 417 + nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c | 648 + nuttx/arch/arm/src/lpc17xx/lpc17_gpio.h | 196 + nuttx/arch/arm/src/lpc17xx/lpc17_gpiodbg.c | 169 + nuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c | 431 + nuttx/arch/arm/src/lpc17xx/lpc17_i2c.c | 545 + nuttx/arch/arm/src/lpc17xx/lpc17_i2c.h | 208 + nuttx/arch/arm/src/lpc17xx/lpc17_i2s.h | 191 + nuttx/arch/arm/src/lpc17xx/lpc17_idle.c | 104 + nuttx/arch/arm/src/lpc17xx/lpc17_internal.h | 795 + nuttx/arch/arm/src/lpc17xx/lpc17_irq.c | 477 + nuttx/arch/arm/src/lpc17xx/lpc17_lowputc.c | 392 + nuttx/arch/arm/src/lpc17xx/lpc17_mcpwm.h | 280 + nuttx/arch/arm/src/lpc17xx/lpc17_memorymap.h | 136 + nuttx/arch/arm/src/lpc17xx/lpc17_ohciram.h | 263 + nuttx/arch/arm/src/lpc17xx/lpc17_pinconn.h | 635 + nuttx/arch/arm/src/lpc17xx/lpc17_pwm.h | 223 + nuttx/arch/arm/src/lpc17xx/lpc17_qei.h | 190 + nuttx/arch/arm/src/lpc17xx/lpc17_rit.h | 92 + nuttx/arch/arm/src/lpc17xx/lpc17_rtc.h | 270 + nuttx/arch/arm/src/lpc17xx/lpc17_serial.c | 1447 ++ nuttx/arch/arm/src/lpc17xx/lpc17_serial.h | 127 + nuttx/arch/arm/src/lpc17xx/lpc17_spi.c | 601 + nuttx/arch/arm/src/lpc17xx/lpc17_spi.h | 141 + nuttx/arch/arm/src/lpc17xx/lpc17_ssp.c | 921 + nuttx/arch/arm/src/lpc17xx/lpc17_ssp.h | 174 + nuttx/arch/arm/src/lpc17xx/lpc17_start.c | 151 + nuttx/arch/arm/src/lpc17xx/lpc17_syscon.h | 494 + nuttx/arch/arm/src/lpc17xx/lpc17_timer.h | 250 + nuttx/arch/arm/src/lpc17xx/lpc17_timerisr.c | 151 + nuttx/arch/arm/src/lpc17xx/lpc17_uart.h | 339 + nuttx/arch/arm/src/lpc17xx/lpc17_usb.h | 778 + nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c | 3431 +++ nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c | 2700 +++ nuttx/arch/arm/src/lpc17xx/lpc17_vectors.S | 394 + nuttx/arch/arm/src/lpc17xx/lpc17_wdt.h | 108 + nuttx/arch/arm/src/lpc214x/Make.defs | 57 + nuttx/arch/arm/src/lpc214x/README.txt | 61 + nuttx/arch/arm/src/lpc214x/chip.h | 349 + nuttx/arch/arm/src/lpc214x/lpc214x_apb.h | 72 + .../arch/arm/src/lpc214x/lpc214x_decodeirq.c | 177 + nuttx/arch/arm/src/lpc214x/lpc214x_head.S | 634 + nuttx/arch/arm/src/lpc214x/lpc214x_i2c.h | 141 + nuttx/arch/arm/src/lpc214x/lpc214x_irq.c | 224 + nuttx/arch/arm/src/lpc214x/lpc214x_lowputc.S | 209 + nuttx/arch/arm/src/lpc214x/lpc214x_pinsel.h | 259 + nuttx/arch/arm/src/lpc214x/lpc214x_pll.h | 105 + nuttx/arch/arm/src/lpc214x/lpc214x_power.h | 90 + nuttx/arch/arm/src/lpc214x/lpc214x_serial.c | 844 + nuttx/arch/arm/src/lpc214x/lpc214x_spi.h | 166 + nuttx/arch/arm/src/lpc214x/lpc214x_timer.h | 152 + nuttx/arch/arm/src/lpc214x/lpc214x_timerisr.c | 170 + nuttx/arch/arm/src/lpc214x/lpc214x_uart.h | 142 + nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c | 3320 +++ nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.h | 346 + nuttx/arch/arm/src/lpc214x/lpc214x_vic.h | 70 + nuttx/arch/arm/src/lpc2378/Make.defs | 63 + nuttx/arch/arm/src/lpc2378/chip.h | 959 + nuttx/arch/arm/src/lpc2378/internal.h | 70 + .../arch/arm/src/lpc2378/lpc23xx_decodeirq.c | 176 + nuttx/arch/arm/src/lpc2378/lpc23xx_gpio.h | 71 + nuttx/arch/arm/src/lpc2378/lpc23xx_head.S | 234 + nuttx/arch/arm/src/lpc2378/lpc23xx_io.c | 101 + nuttx/arch/arm/src/lpc2378/lpc23xx_irq.c | 302 + nuttx/arch/arm/src/lpc2378/lpc23xx_lowputc.S | 262 + nuttx/arch/arm/src/lpc2378/lpc23xx_pinsel.h | 792 + nuttx/arch/arm/src/lpc2378/lpc23xx_pllsetup.c | 242 + nuttx/arch/arm/src/lpc2378/lpc23xx_scb.h | 131 + nuttx/arch/arm/src/lpc2378/lpc23xx_serial.c | 974 + nuttx/arch/arm/src/lpc2378/lpc23xx_timer.h | 163 + nuttx/arch/arm/src/lpc2378/lpc23xx_timerisr.c | 202 + nuttx/arch/arm/src/lpc2378/lpc23xx_uart.h | 231 + nuttx/arch/arm/src/lpc2378/lpc23xx_vic.h | 76 + nuttx/arch/arm/src/lpc31xx/Make.defs | 67 + nuttx/arch/arm/src/lpc31xx/chip.h | 86 + nuttx/arch/arm/src/lpc31xx/lpc31_adc.h | 132 + .../arch/arm/src/lpc31xx/lpc31_allocateheap.c | 206 + nuttx/arch/arm/src/lpc31xx/lpc31_analogdie.h | 421 + nuttx/arch/arm/src/lpc31xx/lpc31_bcrndx.c | 100 + nuttx/arch/arm/src/lpc31xx/lpc31_boot.c | 397 + nuttx/arch/arm/src/lpc31xx/lpc31_cgu.h | 1631 ++ nuttx/arch/arm/src/lpc31xx/lpc31_cgudrvr.h | 819 + nuttx/arch/arm/src/lpc31xx/lpc31_clkdomain.c | 125 + nuttx/arch/arm/src/lpc31xx/lpc31_clkexten.c | 152 + nuttx/arch/arm/src/lpc31xx/lpc31_clkfreq.c | 177 + nuttx/arch/arm/src/lpc31xx/lpc31_clkinit.c | 298 + nuttx/arch/arm/src/lpc31xx/lpc31_decodeirq.c | 137 + nuttx/arch/arm/src/lpc31xx/lpc31_defclk.c | 119 + nuttx/arch/arm/src/lpc31xx/lpc31_dma.h | 425 + nuttx/arch/arm/src/lpc31xx/lpc31_esrndx.c | 134 + nuttx/arch/arm/src/lpc31xx/lpc31_evntrtr.h | 264 + nuttx/arch/arm/src/lpc31xx/lpc31_fdcndx.c | 127 + nuttx/arch/arm/src/lpc31xx/lpc31_fdivinit.c | 204 + nuttx/arch/arm/src/lpc31xx/lpc31_freqin.c | 82 + nuttx/arch/arm/src/lpc31xx/lpc31_i2c.c | 608 + nuttx/arch/arm/src/lpc31xx/lpc31_i2c.h | 207 + nuttx/arch/arm/src/lpc31xx/lpc31_i2s.h | 315 + nuttx/arch/arm/src/lpc31xx/lpc31_intc.h | 198 + nuttx/arch/arm/src/lpc31xx/lpc31_internal.h | 300 + nuttx/arch/arm/src/lpc31xx/lpc31_ioconfig.h | 357 + nuttx/arch/arm/src/lpc31xx/lpc31_irq.c | 218 + nuttx/arch/arm/src/lpc31xx/lpc31_lcd.h | 161 + nuttx/arch/arm/src/lpc31xx/lpc31_lowputc.c | 356 + nuttx/arch/arm/src/lpc31xx/lpc31_mci.h | 270 + nuttx/arch/arm/src/lpc31xx/lpc31_memorymap.h | 415 + nuttx/arch/arm/src/lpc31xx/lpc31_mpmc.h | 340 + nuttx/arch/arm/src/lpc31xx/lpc31_nand.h | 424 + nuttx/arch/arm/src/lpc31xx/lpc31_otp.h | 139 + nuttx/arch/arm/src/lpc31xx/lpc31_pcm.h | 174 + nuttx/arch/arm/src/lpc31xx/lpc31_pllconfig.c | 267 + nuttx/arch/arm/src/lpc31xx/lpc31_pwm.h | 97 + nuttx/arch/arm/src/lpc31xx/lpc31_resetclks.c | 151 + nuttx/arch/arm/src/lpc31xx/lpc31_rng.h | 85 + nuttx/arch/arm/src/lpc31xx/lpc31_serial.c | 856 + nuttx/arch/arm/src/lpc31xx/lpc31_setfdiv.c | 135 + nuttx/arch/arm/src/lpc31xx/lpc31_setfreqin.c | 119 + nuttx/arch/arm/src/lpc31xx/lpc31_softreset.c | 90 + nuttx/arch/arm/src/lpc31xx/lpc31_spi.c | 971 + nuttx/arch/arm/src/lpc31xx/lpc31_spi.h | 252 + nuttx/arch/arm/src/lpc31xx/lpc31_syscreg.h | 611 + nuttx/arch/arm/src/lpc31xx/lpc31_timer.h | 119 + nuttx/arch/arm/src/lpc31xx/lpc31_timerisr.c | 162 + nuttx/arch/arm/src/lpc31xx/lpc31_uart.h | 263 + nuttx/arch/arm/src/lpc31xx/lpc31_usbdev.c | 2658 +++ nuttx/arch/arm/src/lpc31xx/lpc31_usbotg.h | 654 + nuttx/arch/arm/src/lpc31xx/lpc31_wdt.h | 130 + nuttx/arch/arm/src/sam3u/Make.defs | 80 + nuttx/arch/arm/src/sam3u/chip.h | 97 + nuttx/arch/arm/src/sam3u/sam3u_adc.h | 236 + nuttx/arch/arm/src/sam3u/sam3u_allocateheap.c | 149 + nuttx/arch/arm/src/sam3u/sam3u_chipid.h | 167 + nuttx/arch/arm/src/sam3u/sam3u_clockconfig.c | 335 + nuttx/arch/arm/src/sam3u/sam3u_dmac.c | 1540 ++ nuttx/arch/arm/src/sam3u/sam3u_dmac.h | 441 + nuttx/arch/arm/src/sam3u/sam3u_eefc.h | 120 + nuttx/arch/arm/src/sam3u/sam3u_gpbr.h | 90 + nuttx/arch/arm/src/sam3u/sam3u_gpioirq.c | 367 + nuttx/arch/arm/src/sam3u/sam3u_hsmci.c | 2503 +++ nuttx/arch/arm/src/sam3u/sam3u_hsmci.h | 297 + nuttx/arch/arm/src/sam3u/sam3u_internal.h | 910 + nuttx/arch/arm/src/sam3u/sam3u_irq.c | 467 + nuttx/arch/arm/src/sam3u/sam3u_lowputc.c | 333 + nuttx/arch/arm/src/sam3u/sam3u_matrix.h | 214 + nuttx/arch/arm/src/sam3u/sam3u_memorymap.h | 145 + nuttx/arch/arm/src/sam3u/sam3u_mpuinit.c | 122 + nuttx/arch/arm/src/sam3u/sam3u_pdc.h | 103 + nuttx/arch/arm/src/sam3u/sam3u_pio.c | 394 + nuttx/arch/arm/src/sam3u/sam3u_pio.h | 324 + nuttx/arch/arm/src/sam3u/sam3u_pmc.h | 316 + nuttx/arch/arm/src/sam3u/sam3u_pwm.h | 633 + nuttx/arch/arm/src/sam3u/sam3u_rstc.h | 102 + nuttx/arch/arm/src/sam3u/sam3u_rtc.h | 184 + nuttx/arch/arm/src/sam3u/sam3u_rtt.h | 89 + nuttx/arch/arm/src/sam3u/sam3u_serial.c | 1450 ++ nuttx/arch/arm/src/sam3u/sam3u_smc.h | 432 + nuttx/arch/arm/src/sam3u/sam3u_spi.c | 948 + nuttx/arch/arm/src/sam3u/sam3u_spi.h | 189 + nuttx/arch/arm/src/sam3u/sam3u_ssc.h | 292 + nuttx/arch/arm/src/sam3u/sam3u_start.c | 161 + nuttx/arch/arm/src/sam3u/sam3u_supc.h | 164 + nuttx/arch/arm/src/sam3u/sam3u_tc.h | 347 + nuttx/arch/arm/src/sam3u/sam3u_timerisr.c | 162 + nuttx/arch/arm/src/sam3u/sam3u_twi.h | 192 + nuttx/arch/arm/src/sam3u/sam3u_uart.h | 391 + nuttx/arch/arm/src/sam3u/sam3u_udphs.h | 370 + nuttx/arch/arm/src/sam3u/sam3u_userspace.c | 105 + nuttx/arch/arm/src/sam3u/sam3u_vectors.S | 385 + nuttx/arch/arm/src/sam3u/sam3u_wdt.h | 96 + nuttx/arch/arm/src/stm32/Make.defs | 92 + nuttx/arch/arm/src/stm32/chip.h | 78 + nuttx/arch/arm/src/stm32/chip/stm32_adc.h | 564 + nuttx/arch/arm/src/stm32/chip/stm32_bkp.h | 190 + nuttx/arch/arm/src/stm32/chip/stm32_can.h | 496 + nuttx/arch/arm/src/stm32/chip/stm32_dac.h | 256 + nuttx/arch/arm/src/stm32/chip/stm32_dbgmcu.h | 144 + nuttx/arch/arm/src/stm32/chip/stm32_eth.h | 829 + nuttx/arch/arm/src/stm32/chip/stm32_exti.h | 141 + nuttx/arch/arm/src/stm32/chip/stm32_flash.h | 190 + nuttx/arch/arm/src/stm32/chip/stm32_i2c.h | 192 + .../arch/arm/src/stm32/chip/stm32_memorymap.h | 55 + nuttx/arch/arm/src/stm32/chip/stm32_pwr.h | 103 + nuttx/arch/arm/src/stm32/chip/stm32_sdio.h | 291 + nuttx/arch/arm/src/stm32/chip/stm32_spi.h | 205 + nuttx/arch/arm/src/stm32/chip/stm32_syscfg.h | 151 + nuttx/arch/arm/src/stm32/chip/stm32_tim.h | 1029 + nuttx/arch/arm/src/stm32/chip/stm32_uart.h | 229 + nuttx/arch/arm/src/stm32/chip/stm32_usbdev.h | 236 + nuttx/arch/arm/src/stm32/chip/stm32_wdg.h | 136 + .../arm/src/stm32/chip/stm32f103re_pinmap.h | 332 + .../arm/src/stm32/chip/stm32f103vc_pinmap.h | 423 + .../arm/src/stm32/chip/stm32f103ze_pinmap.h | 583 + .../arm/src/stm32/chip/stm32f107vc_pinmap.h | 416 + .../arch/arm/src/stm32/chip/stm32f10xxx_dma.h | 350 + .../arm/src/stm32/chip/stm32f10xxx_gpio.h | 364 + .../src/stm32/chip/stm32f10xxx_memorymap.h | 136 + .../arch/arm/src/stm32/chip/stm32f10xxx_rcc.h | 297 + .../arch/arm/src/stm32/chip/stm32f10xxx_rtc.h | 96 + .../arm/src/stm32/chip/stm32f10xxx_vectors.h | 172 + .../arch/arm/src/stm32/chip/stm32f40xxx_dma.h | 499 + .../arm/src/stm32/chip/stm32f40xxx_gpio.h | 370 + .../src/stm32/chip/stm32f40xxx_memorymap.h | 197 + .../arm/src/stm32/chip/stm32f40xxx_pinmap.h | 628 + .../arch/arm/src/stm32/chip/stm32f40xxx_rcc.h | 506 + .../arch/arm/src/stm32/chip/stm32f40xxx_rtc.h | 338 + .../arm/src/stm32/chip/stm32f40xxx_vectors.h | 129 + nuttx/arch/arm/src/stm32/stm32.h | 94 + nuttx/arch/arm/src/stm32/stm32_adc.c | 1145 + nuttx/arch/arm/src/stm32/stm32_adc.h | 593 + nuttx/arch/arm/src/stm32/stm32_allocateheap.c | 163 + nuttx/arch/arm/src/stm32/stm32_bkp.h | 48 + nuttx/arch/arm/src/stm32/stm32_can.h | 66 + nuttx/arch/arm/src/stm32/stm32_dac.c | 860 + nuttx/arch/arm/src/stm32/stm32_dac.h | 139 + nuttx/arch/arm/src/stm32/stm32_dbgmcu.h | 64 + nuttx/arch/arm/src/stm32/stm32_dma.c | 78 + nuttx/arch/arm/src/stm32/stm32_dma.h | 247 + nuttx/arch/arm/src/stm32/stm32_dumpgpio.c | 170 + nuttx/arch/arm/src/stm32/stm32_eth.c | 3103 +++ nuttx/arch/arm/src/stm32/stm32_eth.h | 97 + nuttx/arch/arm/src/stm32/stm32_exti.c | 316 + nuttx/arch/arm/src/stm32/stm32_exti.h | 44 + nuttx/arch/arm/src/stm32/stm32_flash.c | 247 + nuttx/arch/arm/src/stm32/stm32_flash.h | 49 + nuttx/arch/arm/src/stm32/stm32_fsmc.h | 300 + nuttx/arch/arm/src/stm32/stm32_gpio.c | 708 + nuttx/arch/arm/src/stm32/stm32_gpio.h | 511 + nuttx/arch/arm/src/stm32/stm32_i2c.c | 1784 ++ nuttx/arch/arm/src/stm32/stm32_i2c.h | 50 + nuttx/arch/arm/src/stm32/stm32_idle.c | 119 + nuttx/arch/arm/src/stm32/stm32_internal.h | 45 + nuttx/arch/arm/src/stm32/stm32_irq.c | 477 + nuttx/arch/arm/src/stm32/stm32_lowputc.c | 552 + nuttx/arch/arm/src/stm32/stm32_lowputc.h | 79 + nuttx/arch/arm/src/stm32/stm32_lse.c | 105 + nuttx/arch/arm/src/stm32/stm32_pwm.c | 938 + nuttx/arch/arm/src/stm32/stm32_pwm.h | 370 + nuttx/arch/arm/src/stm32/stm32_pwr.c | 94 + nuttx/arch/arm/src/stm32/stm32_pwr.h | 89 + nuttx/arch/arm/src/stm32/stm32_rcc.c | 114 + nuttx/arch/arm/src/stm32/stm32_rcc.h | 191 + nuttx/arch/arm/src/stm32/stm32_rcclock.c | 111 + nuttx/arch/arm/src/stm32/stm32_rtc.c | 78 + nuttx/arch/arm/src/stm32/stm32_rtc.h | 83 + nuttx/arch/arm/src/stm32/stm32_sdio.c | 2732 +++ nuttx/arch/arm/src/stm32/stm32_sdio.h | 127 + nuttx/arch/arm/src/stm32/stm32_serial.c | 1065 + nuttx/arch/arm/src/stm32/stm32_spi.c | 1356 ++ nuttx/arch/arm/src/stm32/stm32_spi.h | 121 + nuttx/arch/arm/src/stm32/stm32_start.c | 165 + nuttx/arch/arm/src/stm32/stm32_syscfg.h | 104 + nuttx/arch/arm/src/stm32/stm32_tim.c | 781 + nuttx/arch/arm/src/stm32/stm32_tim.h | 191 + nuttx/arch/arm/src/stm32/stm32_timerisr.c | 164 + nuttx/arch/arm/src/stm32/stm32_uart.h | 64 + nuttx/arch/arm/src/stm32/stm32_usbdev.c | 3664 ++++ nuttx/arch/arm/src/stm32/stm32_usbdev.h | 98 + nuttx/arch/arm/src/stm32/stm32_vectors.S | 359 + nuttx/arch/arm/src/stm32/stm32_waste.c | 57 + nuttx/arch/arm/src/stm32/stm32_waste.h | 78 + nuttx/arch/arm/src/stm32/stm32_wdg.h | 64 + nuttx/arch/arm/src/stm32/stm32f10xxx_dma.c | 610 + nuttx/arch/arm/src/stm32/stm32f10xxx_rcc.c | 514 + nuttx/arch/arm/src/stm32/stm32f10xxx_rtc.c | 636 + nuttx/arch/arm/src/stm32/stm32f40xxx_dma.c | 662 + nuttx/arch/arm/src/stm32/stm32f40xxx_rcc.c | 668 + nuttx/arch/arm/src/stm32/stm32f40xxx_rtc.c | 842 + nuttx/arch/arm/src/str71x/Make.defs | 60 + nuttx/arch/arm/src/str71x/chip.h | 80 + nuttx/arch/arm/src/str71x/str71x_adc12.h | 109 + nuttx/arch/arm/src/str71x/str71x_apb.h | 109 + nuttx/arch/arm/src/str71x/str71x_bspi.h | 153 + nuttx/arch/arm/src/str71x/str71x_can.h | 207 + nuttx/arch/arm/src/str71x/str71x_decodeirq.c | 147 + nuttx/arch/arm/src/str71x/str71x_eic.h | 176 + nuttx/arch/arm/src/str71x/str71x_emi.h | 103 + nuttx/arch/arm/src/str71x/str71x_flash.h | 123 + nuttx/arch/arm/src/str71x/str71x_gpio.h | 94 + nuttx/arch/arm/src/str71x/str71x_head.S | 629 + nuttx/arch/arm/src/str71x/str71x_i2c.h | 153 + nuttx/arch/arm/src/str71x/str71x_internal.h | 156 + nuttx/arch/arm/src/str71x/str71x_irq.c | 232 + nuttx/arch/arm/src/str71x/str71x_lowputc.c | 319 + nuttx/arch/arm/src/str71x/str71x_map.h | 99 + nuttx/arch/arm/src/str71x/str71x_pcu.h | 159 + nuttx/arch/arm/src/str71x/str71x_prccu.c | 473 + nuttx/arch/arm/src/str71x/str71x_rccu.h | 143 + nuttx/arch/arm/src/str71x/str71x_rtc.h | 92 + nuttx/arch/arm/src/str71x/str71x_serial.c | 1049 + nuttx/arch/arm/src/str71x/str71x_timer.h | 155 + nuttx/arch/arm/src/str71x/str71x_timerisr.c | 213 + nuttx/arch/arm/src/str71x/str71x_uart.h | 181 + nuttx/arch/arm/src/str71x/str71x_usb.h | 180 + nuttx/arch/arm/src/str71x/str71x_wdog.h | 75 + nuttx/arch/arm/src/str71x/str71x_xti.c | 321 + nuttx/arch/arm/src/str71x/str71x_xti.h | 105 + nuttx/arch/avr/include/arch.h | 82 + nuttx/arch/avr/include/at32uc3/irq.h | 635 + nuttx/arch/avr/include/at90usb/irq.h | 132 + nuttx/arch/avr/include/atmega/irq.h | 129 + nuttx/arch/avr/include/avr/avr.h | 62 + nuttx/arch/avr/include/avr/irq.h | 207 + nuttx/arch/avr/include/avr/limits.h | 84 + nuttx/arch/avr/include/avr/syscall.h | 138 + nuttx/arch/avr/include/avr/types.h | 100 + nuttx/arch/avr/include/avr32/avr32.h | 206 + nuttx/arch/avr/include/avr32/irq.h | 217 + nuttx/arch/avr/include/avr32/limits.h | 84 + nuttx/arch/avr/include/avr32/syscall.h | 138 + nuttx/arch/avr/include/avr32/types.h | 95 + nuttx/arch/avr/include/irq.h | 100 + nuttx/arch/avr/include/limits.h | 56 + nuttx/arch/avr/include/syscall.h | 90 + nuttx/arch/avr/include/types.h | 68 + nuttx/arch/avr/src/Makefile | 162 + nuttx/arch/avr/src/at32uc3/Make.defs | 70 + nuttx/arch/avr/src/at32uc3/at32uc3_abdac.h | 101 + nuttx/arch/avr/src/at32uc3/at32uc3_adc.h | 195 + nuttx/arch/avr/src/at32uc3/at32uc3_clkinit.c | 505 + nuttx/arch/avr/src/at32uc3/at32uc3_config.h | 176 + nuttx/arch/avr/src/at32uc3/at32uc3_eic.h | 133 + nuttx/arch/avr/src/at32uc3/at32uc3_flashc.h | 229 + nuttx/arch/avr/src/at32uc3/at32uc3_gpio.c | 296 + nuttx/arch/avr/src/at32uc3/at32uc3_gpio.h | 465 + nuttx/arch/avr/src/at32uc3/at32uc3_gpioirq.c | 428 + nuttx/arch/avr/src/at32uc3/at32uc3_hmatrix.h | 314 + nuttx/arch/avr/src/at32uc3/at32uc3_intc.h | 98 + nuttx/arch/avr/src/at32uc3/at32uc3_internal.h | 344 + nuttx/arch/avr/src/at32uc3/at32uc3_irq.c | 333 + .../arch/avr/src/at32uc3/at32uc3_lowconsole.c | 391 + nuttx/arch/avr/src/at32uc3/at32uc3_lowinit.c | 107 + .../arch/avr/src/at32uc3/at32uc3_memorymap.h | 114 + nuttx/arch/avr/src/at32uc3/at32uc3_pdca.h | 277 + nuttx/arch/avr/src/at32uc3/at32uc3_pinmux.h | 71 + nuttx/arch/avr/src/at32uc3/at32uc3_pm.h | 335 + nuttx/arch/avr/src/at32uc3/at32uc3_pwm.h | 222 + nuttx/arch/avr/src/at32uc3/at32uc3_rtc.h | 112 + nuttx/arch/avr/src/at32uc3/at32uc3_serial.c | 839 + nuttx/arch/avr/src/at32uc3/at32uc3_spi.h | 166 + nuttx/arch/avr/src/at32uc3/at32uc3_ssc.h | 267 + nuttx/arch/avr/src/at32uc3/at32uc3_tc.h | 372 + nuttx/arch/avr/src/at32uc3/at32uc3_timerisr.c | 238 + nuttx/arch/avr/src/at32uc3/at32uc3_twi.h | 161 + nuttx/arch/avr/src/at32uc3/at32uc3_usart.h | 339 + nuttx/arch/avr/src/at32uc3/at32uc3_usbb.h | 1098 + nuttx/arch/avr/src/at32uc3/at32uc3_wdt.h | 87 + nuttx/arch/avr/src/at32uc3/at32uc3a_pinmux.h | 64 + nuttx/arch/avr/src/at32uc3/at32uc3b_pinmux.h | 263 + nuttx/arch/avr/src/at32uc3/chip.h | 223 + nuttx/arch/avr/src/at90usb/Make.defs | 79 + nuttx/arch/avr/src/at90usb/at90usb_config.h | 89 + .../arch/avr/src/at90usb/at90usb_exceptions.S | 177 + nuttx/arch/avr/src/at90usb/at90usb_head.S | 279 + nuttx/arch/avr/src/at90usb/at90usb_internal.h | 211 + .../arch/avr/src/at90usb/at90usb_lowconsole.c | 284 + nuttx/arch/avr/src/at90usb/at90usb_lowinit.c | 154 + .../arch/avr/src/at90usb/at90usb_memorymap.h | 62 + nuttx/arch/avr/src/at90usb/at90usb_serial.c | 619 + nuttx/arch/avr/src/at90usb/at90usb_timerisr.c | 181 + nuttx/arch/avr/src/at90usb/at90usb_usbdev.c | 2941 +++ nuttx/arch/avr/src/at90usb/chip.h | 102 + nuttx/arch/avr/src/atmega/Make.defs | 80 + nuttx/arch/avr/src/atmega/atmega_config.h | 94 + nuttx/arch/avr/src/atmega/atmega_exceptions.S | 170 + nuttx/arch/avr/src/atmega/atmega_head.S | 273 + nuttx/arch/avr/src/atmega/atmega_internal.h | 213 + nuttx/arch/avr/src/atmega/atmega_lowconsole.c | 452 + nuttx/arch/avr/src/atmega/atmega_lowinit.c | 154 + nuttx/arch/avr/src/atmega/atmega_memorymap.h | 62 + nuttx/arch/avr/src/atmega/atmega_serial.c | 1013 + nuttx/arch/avr/src/atmega/atmega_timerisr.c | 181 + nuttx/arch/avr/src/atmega/chip.h | 75 + nuttx/arch/avr/src/avr/README.txt | 2 + nuttx/arch/avr/src/avr/avr_internal.h | 196 + nuttx/arch/avr/src/avr/excptmacros.h | 585 + nuttx/arch/avr/src/avr/up_blocktask.c | 168 + nuttx/arch/avr/src/avr/up_checkstack.c | 141 + nuttx/arch/avr/src/avr/up_copystate.c | 86 + nuttx/arch/avr/src/avr/up_createstack.c | 150 + nuttx/arch/avr/src/avr/up_doirq.c | 116 + nuttx/arch/avr/src/avr/up_dumpstate.c | 263 + nuttx/arch/avr/src/avr/up_initialstate.c | 110 + nuttx/arch/avr/src/avr/up_irq.c | 107 + nuttx/arch/avr/src/avr/up_releasepending.c | 131 + nuttx/arch/avr/src/avr/up_reprioritizertr.c | 182 + nuttx/arch/avr/src/avr/up_romgetc.c | 106 + nuttx/arch/avr/src/avr/up_schedulesigaction.c | 209 + nuttx/arch/avr/src/avr/up_sigdeliver.c | 154 + nuttx/arch/avr/src/avr/up_spi.c | 537 + nuttx/arch/avr/src/avr/up_switchcontext.S | 140 + nuttx/arch/avr/src/avr/up_unblocktask.c | 158 + nuttx/arch/avr/src/avr/up_usestack.c | 125 + nuttx/arch/avr/src/avr32/avr32_internal.h | 136 + nuttx/arch/avr/src/avr32/up_blocktask.c | 168 + nuttx/arch/avr/src/avr32/up_copystate.c | 85 + nuttx/arch/avr/src/avr32/up_createstack.c | 137 + nuttx/arch/avr/src/avr32/up_doirq.c | 116 + nuttx/arch/avr/src/avr32/up_dumpstate.c | 240 + nuttx/arch/avr/src/avr32/up_exceptions.S | 373 + .../avr/src/avr32/up_fullcontextrestore.S | 158 + nuttx/arch/avr/src/avr32/up_initialstate.c | 130 + nuttx/arch/avr/src/avr32/up_nommuhead.S | 157 + nuttx/arch/avr/src/avr32/up_releasepending.c | 131 + nuttx/arch/avr/src/avr32/up_reprioritizertr.c | 182 + .../arch/avr/src/avr32/up_schedulesigaction.c | 205 + nuttx/arch/avr/src/avr32/up_sigdeliver.c | 157 + nuttx/arch/avr/src/avr32/up_switchcontext.S | 123 + nuttx/arch/avr/src/avr32/up_syscall6.S | 84 + nuttx/arch/avr/src/avr32/up_unblocktask.c | 158 + nuttx/arch/avr/src/avr32/up_usestack.c | 123 + nuttx/arch/avr/src/common/up_allocateheap.c | 82 + nuttx/arch/avr/src/common/up_arch.h | 90 + nuttx/arch/avr/src/common/up_assert.c | 163 + nuttx/arch/avr/src/common/up_exit.c | 174 + nuttx/arch/avr/src/common/up_idle.c | 87 + nuttx/arch/avr/src/common/up_initialize.c | 183 + nuttx/arch/avr/src/common/up_internal.h | 210 + .../arch/avr/src/common/up_interruptcontext.c | 70 + nuttx/arch/avr/src/common/up_lowputs.c | 75 + nuttx/arch/avr/src/common/up_mdelay.c | 91 + nuttx/arch/avr/src/common/up_modifyreg16.c | 86 + nuttx/arch/avr/src/common/up_modifyreg32.c | 86 + nuttx/arch/avr/src/common/up_modifyreg8.c | 86 + nuttx/arch/avr/src/common/up_puts.c | 76 + nuttx/arch/avr/src/common/up_releasestack.c | 80 + nuttx/arch/avr/src/common/up_udelay.c | 130 + nuttx/arch/hc/include/arch.h | 81 + nuttx/arch/hc/include/hc12/irq.h | 111 + nuttx/arch/hc/include/hc12/limits.h | 92 + nuttx/arch/hc/include/hc12/types.h | 103 + nuttx/arch/hc/include/hcs12/irq.h | 274 + nuttx/arch/hc/include/hcs12/limits.h | 92 + nuttx/arch/hc/include/hcs12/types.h | 104 + nuttx/arch/hc/include/irq.h | 100 + nuttx/arch/hc/include/limits.h | 55 + nuttx/arch/hc/include/m9s12/irq.h | 190 + nuttx/arch/hc/include/syscall.h | 82 + nuttx/arch/hc/include/types.h | 67 + nuttx/arch/hc/src/Makefile | 158 + nuttx/arch/hc/src/common/up_allocateheap.c | 82 + nuttx/arch/hc/src/common/up_arch.h | 92 + nuttx/arch/hc/src/common/up_blocktask.c | 167 + nuttx/arch/hc/src/common/up_copystate.c | 82 + nuttx/arch/hc/src/common/up_createstack.c | 131 + nuttx/arch/hc/src/common/up_doirq.c | 115 + nuttx/arch/hc/src/common/up_exit.c | 174 + nuttx/arch/hc/src/common/up_idle.c | 85 + nuttx/arch/hc/src/common/up_initialize.c | 168 + nuttx/arch/hc/src/common/up_internal.h | 218 + .../arch/hc/src/common/up_interruptcontext.c | 71 + nuttx/arch/hc/src/common/up_mdelay.c | 90 + nuttx/arch/hc/src/common/up_modifyreg16.c | 85 + nuttx/arch/hc/src/common/up_modifyreg32.c | 85 + nuttx/arch/hc/src/common/up_modifyreg8.c | 85 + nuttx/arch/hc/src/common/up_puts.c | 76 + nuttx/arch/hc/src/common/up_releasepending.c | 131 + nuttx/arch/hc/src/common/up_releasestack.c | 80 + nuttx/arch/hc/src/common/up_reprioritizertr.c | 187 + nuttx/arch/hc/src/common/up_udelay.c | 129 + nuttx/arch/hc/src/common/up_unblocktask.c | 159 + nuttx/arch/hc/src/common/up_usestack.c | 120 + nuttx/arch/hc/src/m9s12/Make.defs | 51 + nuttx/arch/hc/src/m9s12/chip.h | 102 + nuttx/arch/hc/src/m9s12/m9s12_assert.c | 320 + nuttx/arch/hc/src/m9s12/m9s12_atd.h | 323 + nuttx/arch/hc/src/m9s12/m9s12_crg.h | 140 + nuttx/arch/hc/src/m9s12/m9s12_dumpgpio.c | 287 + nuttx/arch/hc/src/m9s12/m9s12_emac.h | 248 + nuttx/arch/hc/src/m9s12/m9s12_ethernet.c | 692 + nuttx/arch/hc/src/m9s12/m9s12_flash.h | 209 + nuttx/arch/hc/src/m9s12/m9s12_gpio.c | 483 + nuttx/arch/hc/src/m9s12/m9s12_gpioirq.c | 295 + nuttx/arch/hc/src/m9s12/m9s12_iic.h | 108 + nuttx/arch/hc/src/m9s12/m9s12_initialstate.c | 125 + nuttx/arch/hc/src/m9s12/m9s12_int.h | 103 + nuttx/arch/hc/src/m9s12/m9s12_internal.h | 359 + nuttx/arch/hc/src/m9s12/m9s12_irq.c | 100 + nuttx/arch/hc/src/m9s12/m9s12_lowputc.S | 225 + nuttx/arch/hc/src/m9s12/m9s12_mebi.h | 166 + nuttx/arch/hc/src/m9s12/m9s12_mmc.h | 168 + nuttx/arch/hc/src/m9s12/m9s12_phy.h | 97 + nuttx/arch/hc/src/m9s12/m9s12_pim.h | 248 + .../arch/hc/src/m9s12/m9s12_saveusercontext.S | 189 + nuttx/arch/hc/src/m9s12/m9s12_sci.h | 157 + nuttx/arch/hc/src/m9s12/m9s12_serial.c | 844 + nuttx/arch/hc/src/m9s12/m9s12_serial.h | 135 + nuttx/arch/hc/src/m9s12/m9s12_spi.h | 114 + nuttx/arch/hc/src/m9s12/m9s12_start.S | 273 + nuttx/arch/hc/src/m9s12/m9s12_tim.h | 246 + nuttx/arch/hc/src/m9s12/m9s12_timerisr.c | 185 + nuttx/arch/hc/src/m9s12/m9s12_vectors.S | 450 + nuttx/arch/mips/include/arch.h | 82 + nuttx/arch/mips/include/irq.h | 99 + nuttx/arch/mips/include/limits.h | 82 + nuttx/arch/mips/include/mips32/cp0.h | 575 + nuttx/arch/mips/include/mips32/irq.h | 516 + nuttx/arch/mips/include/mips32/registers.h | 146 + nuttx/arch/mips/include/mips32/syscall.h | 244 + nuttx/arch/mips/include/pic32mx/chip.h | 1389 ++ nuttx/arch/mips/include/pic32mx/cp0.h | 396 + nuttx/arch/mips/include/pic32mx/irq.h | 212 + nuttx/arch/mips/include/pic32mx/irq_3xx4xx.h | 204 + .../arch/mips/include/pic32mx/irq_5xx6xx7xx.h | 273 + nuttx/arch/mips/include/syscall.h | 88 + nuttx/arch/mips/include/types.h | 95 + nuttx/arch/mips/src/Makefile | 150 + nuttx/arch/mips/src/common/up_allocateheap.c | 83 + nuttx/arch/mips/src/common/up_arch.h | 89 + nuttx/arch/mips/src/common/up_createstack.c | 137 + nuttx/arch/mips/src/common/up_etherstub.c | 86 + nuttx/arch/mips/src/common/up_exit.c | 175 + nuttx/arch/mips/src/common/up_idle.c | 89 + nuttx/arch/mips/src/common/up_initialize.c | 168 + nuttx/arch/mips/src/common/up_internal.h | 263 + .../mips/src/common/up_interruptcontext.c | 70 + nuttx/arch/mips/src/common/up_lowputs.c | 74 + nuttx/arch/mips/src/common/up_mdelay.c | 90 + nuttx/arch/mips/src/common/up_modifyreg16.c | 85 + nuttx/arch/mips/src/common/up_modifyreg32.c | 85 + nuttx/arch/mips/src/common/up_modifyreg8.c | 85 + nuttx/arch/mips/src/common/up_puts.c | 75 + nuttx/arch/mips/src/common/up_releasestack.c | 79 + nuttx/arch/mips/src/common/up_udelay.c | 129 + nuttx/arch/mips/src/common/up_usestack.c | 122 + nuttx/arch/mips/src/mips32/mips32-memorymap.h | 96 + nuttx/arch/mips/src/mips32/up_assert.c | 163 + nuttx/arch/mips/src/mips32/up_blocktask.c | 168 + nuttx/arch/mips/src/mips32/up_copystate.c | 86 + nuttx/arch/mips/src/mips32/up_doirq.c | 125 + nuttx/arch/mips/src/mips32/up_dumpstate.c | 241 + nuttx/arch/mips/src/mips32/up_initialstate.c | 148 + nuttx/arch/mips/src/mips32/up_irq.c | 114 + .../arch/mips/src/mips32/up_releasepending.c | 132 + .../arch/mips/src/mips32/up_reprioritizertr.c | 183 + .../mips/src/mips32/up_schedulesigaction.c | 212 + nuttx/arch/mips/src/mips32/up_sigdeliver.c | 142 + nuttx/arch/mips/src/mips32/up_swint0.c | 367 + nuttx/arch/mips/src/mips32/up_syscall0.S | 94 + nuttx/arch/mips/src/mips32/up_unblocktask.c | 159 + nuttx/arch/mips/src/pic32mx/Make.defs | 71 + nuttx/arch/mips/src/pic32mx/chip.h | 76 + nuttx/arch/mips/src/pic32mx/excptmacros.h | 437 + nuttx/arch/mips/src/pic32mx/pic32mx-adc.h | 243 + nuttx/arch/mips/src/pic32mx/pic32mx-bmx.h | 166 + nuttx/arch/mips/src/pic32mx/pic32mx-can.h | 89 + nuttx/arch/mips/src/pic32mx/pic32mx-che.h | 185 + nuttx/arch/mips/src/pic32mx/pic32mx-cm.h | 140 + nuttx/arch/mips/src/pic32mx/pic32mx-config.h | 837 + nuttx/arch/mips/src/pic32mx/pic32mx-cvr.h | 113 + nuttx/arch/mips/src/pic32mx/pic32mx-ddp.h | 94 + .../arch/mips/src/pic32mx/pic32mx-decodeirq.c | 172 + nuttx/arch/mips/src/pic32mx/pic32mx-devcfg.h | 237 + nuttx/arch/mips/src/pic32mx/pic32mx-dma.h | 687 + .../arch/mips/src/pic32mx/pic32mx-ethernet.h | 89 + .../arch/mips/src/pic32mx/pic32mx-exception.c | 199 + nuttx/arch/mips/src/pic32mx/pic32mx-flash.h | 130 + nuttx/arch/mips/src/pic32mx/pic32mx-gpio.c | 298 + nuttx/arch/mips/src/pic32mx/pic32mx-gpioirq.c | 288 + nuttx/arch/mips/src/pic32mx/pic32mx-head.S | 662 + nuttx/arch/mips/src/pic32mx/pic32mx-i2c.h | 305 + nuttx/arch/mips/src/pic32mx/pic32mx-ic.h | 166 + nuttx/arch/mips/src/pic32mx/pic32mx-int.h | 873 + .../arch/mips/src/pic32mx/pic32mx-internal.h | 560 + nuttx/arch/mips/src/pic32mx/pic32mx-ioport.h | 304 + nuttx/arch/mips/src/pic32mx/pic32mx-irq.c | 470 + .../mips/src/pic32mx/pic32mx-lowconsole.c | 348 + nuttx/arch/mips/src/pic32mx/pic32mx-lowinit.c | 207 + .../arch/mips/src/pic32mx/pic32mx-memorymap.h | 389 + nuttx/arch/mips/src/pic32mx/pic32mx-oc.h | 211 + nuttx/arch/mips/src/pic32mx/pic32mx-osc.h | 165 + nuttx/arch/mips/src/pic32mx/pic32mx-pmp.h | 241 + nuttx/arch/mips/src/pic32mx/pic32mx-reset.h | 117 + nuttx/arch/mips/src/pic32mx/pic32mx-rtcc.h | 219 + nuttx/arch/mips/src/pic32mx/pic32mx-serial.c | 854 + nuttx/arch/mips/src/pic32mx/pic32mx-spi.h | 231 + nuttx/arch/mips/src/pic32mx/pic32mx-timer.h | 222 + .../arch/mips/src/pic32mx/pic32mx-timerisr.c | 193 + nuttx/arch/mips/src/pic32mx/pic32mx-uart.h | 273 + nuttx/arch/mips/src/pic32mx/pic32mx-usbotg.h | 313 + nuttx/arch/mips/src/pic32mx/pic32mx-wdt.h | 117 + nuttx/arch/rgmp/include/arch.h | 64 + .../arch/rgmp/include/arm/arch/subarch/arch.h | 58 + nuttx/arch/rgmp/include/irq.h | 76 + nuttx/arch/rgmp/include/limits.h | 81 + nuttx/arch/rgmp/include/math.h | 65 + nuttx/arch/rgmp/include/stdbool.h | 89 + nuttx/arch/rgmp/include/stdint.h | 277 + nuttx/arch/rgmp/include/types.h | 96 + nuttx/arch/rgmp/include/x86/arch/com.h | 58 + .../arch/rgmp/include/x86/arch/subarch/arch.h | 60 + nuttx/arch/rgmp/src/Makefile | 104 + nuttx/arch/rgmp/src/arm/Make.defs | 42 + nuttx/arch/rgmp/src/arm/arch_nuttx.c | 91 + nuttx/arch/rgmp/src/arm/sigentry.S | 49 + nuttx/arch/rgmp/src/bridge.c | 104 + nuttx/arch/rgmp/src/nuttx.c | 504 + nuttx/arch/rgmp/src/rgmp.c | 168 + nuttx/arch/rgmp/src/x86/Make.defs | 42 + nuttx/arch/rgmp/src/x86/arch_nuttx.c | 106 + nuttx/arch/rgmp/src/x86/com.c | 631 + nuttx/arch/rgmp/src/x86/sigentry.S | 55 + nuttx/arch/sh/include/README.txt | 5 + nuttx/arch/sh/include/arch.h | 79 + nuttx/arch/sh/include/irq.h | 85 + nuttx/arch/sh/include/limits.h | 49 + nuttx/arch/sh/include/m16c/README.txt | 1 + nuttx/arch/sh/include/m16c/irq.h | 322 + nuttx/arch/sh/include/m16c/limits.h | 83 + nuttx/arch/sh/include/m16c/types.h | 98 + nuttx/arch/sh/include/serial.h | 57 + nuttx/arch/sh/include/sh1/README.txt | 1 + nuttx/arch/sh/include/sh1/irq.h | 566 + nuttx/arch/sh/include/sh1/limits.h | 83 + nuttx/arch/sh/include/sh1/types.h | 96 + nuttx/arch/sh/include/syscall.h | 82 + nuttx/arch/sh/include/types.h | 61 + nuttx/arch/sh/include/watchdog.h | 59 + nuttx/arch/sh/src/Makefile | 134 + nuttx/arch/sh/src/README.txt | 7 + nuttx/arch/sh/src/common/README.txt | 2 + nuttx/arch/sh/src/common/up_allocateheap.c | 82 + nuttx/arch/sh/src/common/up_arch.h | 70 + nuttx/arch/sh/src/common/up_assert.c | 148 + nuttx/arch/sh/src/common/up_blocktask.c | 166 + nuttx/arch/sh/src/common/up_createstack.c | 132 + nuttx/arch/sh/src/common/up_doirq.c | 124 + nuttx/arch/sh/src/common/up_exit.c | 174 + nuttx/arch/sh/src/common/up_idle.c | 87 + nuttx/arch/sh/src/common/up_initialize.c | 160 + nuttx/arch/sh/src/common/up_internal.h | 235 + .../arch/sh/src/common/up_interruptcontext.c | 70 + nuttx/arch/sh/src/common/up_lowputs.c | 74 + nuttx/arch/sh/src/common/up_mdelay.c | 90 + nuttx/arch/sh/src/common/up_puts.c | 75 + nuttx/arch/sh/src/common/up_releasepending.c | 132 + nuttx/arch/sh/src/common/up_releasestack.c | 79 + nuttx/arch/sh/src/common/up_reprioritizertr.c | 182 + nuttx/arch/sh/src/common/up_udelay.c | 129 + nuttx/arch/sh/src/common/up_unblocktask.c | 159 + nuttx/arch/sh/src/common/up_usestack.c | 122 + nuttx/arch/sh/src/m16c/Make.defs | 53 + nuttx/arch/sh/src/m16c/README.txt | 2 + nuttx/arch/sh/src/m16c/chip.h | 281 + nuttx/arch/sh/src/m16c/m16c_copystate.c | 74 + nuttx/arch/sh/src/m16c/m16c_dumpstate.c | 251 + nuttx/arch/sh/src/m16c/m16c_head.S | 278 + nuttx/arch/sh/src/m16c/m16c_initialstate.c | 111 + nuttx/arch/sh/src/m16c/m16c_irq.c | 127 + nuttx/arch/sh/src/m16c/m16c_lowputc.c | 343 + .../arch/sh/src/m16c/m16c_schedulesigaction.c | 201 + nuttx/arch/sh/src/m16c/m16c_serial.c | 1206 ++ nuttx/arch/sh/src/m16c/m16c_sigdeliver.c | 144 + nuttx/arch/sh/src/m16c/m16c_timer.h | 226 + nuttx/arch/sh/src/m16c/m16c_timerisr.c | 186 + nuttx/arch/sh/src/m16c/m16c_uart.h | 145 + nuttx/arch/sh/src/m16c/m16c_vectors.S | 523 + nuttx/arch/sh/src/sh1/Make.defs | 56 + nuttx/arch/sh/src/sh1/README.txt | 2 + nuttx/arch/sh/src/sh1/chip.h | 74 + nuttx/arch/sh/src/sh1/sh1_703x.h | 475 + nuttx/arch/sh/src/sh1/sh1_copystate.c | 77 + nuttx/arch/sh/src/sh1/sh1_dumpstate.c | 234 + nuttx/arch/sh/src/sh1/sh1_head.S | 524 + nuttx/arch/sh/src/sh1/sh1_initialstate.c | 129 + nuttx/arch/sh/src/sh1/sh1_irq.c | 285 + nuttx/arch/sh/src/sh1/sh1_lowputc.c | 265 + nuttx/arch/sh/src/sh1/sh1_saveusercontext.S | 121 + nuttx/arch/sh/src/sh1/sh1_schedulesigaction.c | 197 + nuttx/arch/sh/src/sh1/sh1_serial.c | 957 + nuttx/arch/sh/src/sh1/sh1_sigdeliver.c | 141 + nuttx/arch/sh/src/sh1/sh1_timerisr.c | 205 + nuttx/arch/sh/src/sh1/sh1_vector.S | 525 + nuttx/arch/sim/include/arch.h | 80 + nuttx/arch/sim/include/irq.h | 106 + nuttx/arch/sim/include/limits.h | 81 + nuttx/arch/sim/include/syscall.h | 82 + nuttx/arch/sim/include/types.h | 96 + nuttx/arch/sim/src/Makefile | 219 + nuttx/arch/sim/src/nuttx-names.dat | 36 + nuttx/arch/sim/src/up_allocateheap.c | 85 + nuttx/arch/sim/src/up_blockdevice.c | 88 + nuttx/arch/sim/src/up_blocktask.c | 160 + nuttx/arch/sim/src/up_createstack.c | 114 + nuttx/arch/sim/src/up_devconsole.c | 106 + nuttx/arch/sim/src/up_deviceimage.c | 356 + nuttx/arch/sim/src/up_exit.c | 110 + nuttx/arch/sim/src/up_framebuffer.c | 399 + nuttx/arch/sim/src/up_head.c | 91 + nuttx/arch/sim/src/up_hostusleep.c | 66 + nuttx/arch/sim/src/up_idle.c | 159 + nuttx/arch/sim/src/up_initialize.c | 109 + nuttx/arch/sim/src/up_initialstate.c | 84 + nuttx/arch/sim/src/up_internal.h | 213 + nuttx/arch/sim/src/up_interruptcontext.c | 76 + nuttx/arch/sim/src/up_lcd.c | 428 + nuttx/arch/sim/src/up_netdev.c | 76 + nuttx/arch/sim/src/up_releasepending.c | 119 + nuttx/arch/sim/src/up_releasestack.c | 82 + nuttx/arch/sim/src/up_reprioritizertr.c | 178 + nuttx/arch/sim/src/up_romgetc.c | 101 + nuttx/arch/sim/src/up_schedulesigaction.c | 111 + nuttx/arch/sim/src/up_setjmp.S | 142 + nuttx/arch/sim/src/up_stdio.c | 82 + nuttx/arch/sim/src/up_tapdev.c | 271 + nuttx/arch/sim/src/up_touchscreen.c | 812 + nuttx/arch/sim/src/up_uipdriver.c | 230 + nuttx/arch/sim/src/up_unblocktask.c | 148 + nuttx/arch/sim/src/up_usestack.c | 101 + nuttx/arch/sim/src/up_wpcap.c | 312 + nuttx/arch/sim/src/up_x11eventloop.c | 140 + nuttx/arch/sim/src/up_x11framebuffer.c | 477 + nuttx/arch/x86/include/README.txt | 31 + nuttx/arch/x86/include/arch.h | 91 + nuttx/arch/x86/include/i486/arch.h | 451 + nuttx/arch/x86/include/i486/io.h | 148 + nuttx/arch/x86/include/i486/irq.h | 287 + nuttx/arch/x86/include/i486/limits.h | 81 + nuttx/arch/x86/include/i486/syscall.h | 138 + nuttx/arch/x86/include/i486/types.h | 97 + nuttx/arch/x86/include/io.h | 86 + nuttx/arch/x86/include/irq.h | 98 + nuttx/arch/x86/include/limits.h | 53 + nuttx/arch/x86/include/qemu/arch.h | 80 + nuttx/arch/x86/include/qemu/irq.h | 80 + nuttx/arch/x86/include/syscall.h | 88 + nuttx/arch/x86/include/types.h | 65 + nuttx/arch/x86/src/Makefile | 163 + nuttx/arch/x86/src/README.txt | 31 + nuttx/arch/x86/src/common/up_allocateheap.c | 82 + nuttx/arch/x86/src/common/up_arch.h | 90 + nuttx/arch/x86/src/common/up_assert.c | 282 + nuttx/arch/x86/src/common/up_blocktask.c | 166 + nuttx/arch/x86/src/common/up_copystate.c | 82 + nuttx/arch/x86/src/common/up_exit.c | 174 + nuttx/arch/x86/src/common/up_initialize.c | 168 + nuttx/arch/x86/src/common/up_internal.h | 237 + .../arch/x86/src/common/up_interruptcontext.c | 72 + nuttx/arch/x86/src/common/up_lowputs.c | 74 + nuttx/arch/x86/src/common/up_mdelay.c | 90 + nuttx/arch/x86/src/common/up_modifyreg16.c | 85 + nuttx/arch/x86/src/common/up_modifyreg32.c | 85 + nuttx/arch/x86/src/common/up_modifyreg8.c | 85 + nuttx/arch/x86/src/common/up_puts.c | 75 + nuttx/arch/x86/src/common/up_releasepending.c | 132 + .../arch/x86/src/common/up_reprioritizertr.c | 187 + nuttx/arch/x86/src/common/up_udelay.c | 129 + nuttx/arch/x86/src/common/up_unblocktask.c | 158 + nuttx/arch/x86/src/i486/i486_utils.S | 96 + nuttx/arch/x86/src/i486/up_createstack.c | 135 + nuttx/arch/x86/src/i486/up_initialstate.c | 126 + nuttx/arch/x86/src/i486/up_irq.c | 376 + nuttx/arch/x86/src/i486/up_regdump.c | 82 + nuttx/arch/x86/src/i486/up_releasestack.c | 79 + nuttx/arch/x86/src/i486/up_savestate.c | 113 + .../arch/x86/src/i486/up_schedulesigaction.c | 198 + nuttx/arch/x86/src/i486/up_sigdeliver.c | 139 + nuttx/arch/x86/src/i486/up_syscall6.S | 97 + nuttx/arch/x86/src/i486/up_usestack.c | 119 + nuttx/arch/x86/src/qemu/Make.defs | 57 + nuttx/arch/x86/src/qemu/chip.h | 74 + .../x86/src/qemu/qemu_fullcontextrestore.S | 181 + nuttx/arch/x86/src/qemu/qemu_handlers.c | 204 + nuttx/arch/x86/src/qemu/qemu_head.S | 161 + nuttx/arch/x86/src/qemu/qemu_idle.c | 88 + nuttx/arch/x86/src/qemu/qemu_internal.h | 448 + nuttx/arch/x86/src/qemu/qemu_lowputc.c | 104 + nuttx/arch/x86/src/qemu/qemu_lowsetup.c | 140 + nuttx/arch/x86/src/qemu/qemu_memorymap.h | 67 + .../arch/x86/src/qemu/qemu_saveusercontext.S | 182 + nuttx/arch/x86/src/qemu/qemu_serial.c | 116 + nuttx/arch/x86/src/qemu/qemu_timerisr.c | 148 + nuttx/arch/x86/src/qemu/qemu_vectors.S | 271 + nuttx/arch/z16/include/arch.h | 80 + nuttx/arch/z16/include/irq.h | 81 + nuttx/arch/z16/include/limits.h | 79 + nuttx/arch/z16/include/serial.h | 55 + nuttx/arch/z16/include/syscall.h | 82 + nuttx/arch/z16/include/types.h | 92 + nuttx/arch/z16/include/z16f/arch.h | 77 + nuttx/arch/z16/include/z16f/irq.h | 249 + nuttx/arch/z16/src/Makefile | 154 + nuttx/arch/z16/src/common/up_allocateheap.c | 112 + nuttx/arch/z16/src/common/up_assert.c | 179 + nuttx/arch/z16/src/common/up_blocktask.c | 173 + nuttx/arch/z16/src/common/up_copystate.c | 77 + nuttx/arch/z16/src/common/up_createstack.c | 133 + nuttx/arch/z16/src/common/up_doirq.c | 126 + nuttx/arch/z16/src/common/up_exit.c | 176 + nuttx/arch/z16/src/common/up_idle.c | 107 + nuttx/arch/z16/src/common/up_initialize.c | 177 + nuttx/arch/z16/src/common/up_initialstate.c | 91 + nuttx/arch/z16/src/common/up_internal.h | 187 + .../arch/z16/src/common/up_interruptcontext.c | 71 + nuttx/arch/z16/src/common/up_mdelay.c | 94 + nuttx/arch/z16/src/common/up_registerdump.c | 90 + nuttx/arch/z16/src/common/up_releasepending.c | 136 + nuttx/arch/z16/src/common/up_releasestack.c | 79 + .../arch/z16/src/common/up_reprioritizertr.c | 186 + .../z16/src/common/up_schedulesigaction.c | 201 + nuttx/arch/z16/src/common/up_sigdeliver.c | 144 + nuttx/arch/z16/src/common/up_stackdump.c | 108 + nuttx/arch/z16/src/common/up_udelay.c | 133 + nuttx/arch/z16/src/common/up_unblocktask.c | 167 + nuttx/arch/z16/src/common/up_usestack.c | 122 + nuttx/arch/z16/src/z16f/Make.defs | 48 + nuttx/arch/z16/src/z16f/chip.h | 568 + nuttx/arch/z16/src/z16f/z16f_clkinit.c | 251 + nuttx/arch/z16/src/z16f/z16f_head.S | 489 + nuttx/arch/z16/src/z16f/z16f_irq.c | 214 + nuttx/arch/z16/src/z16f/z16f_lowuart.S | 228 + .../z16/src/z16f/z16f_restoreusercontext.S | 103 + .../arch/z16/src/z16f/z16f_saveusercontext.S | 119 + nuttx/arch/z16/src/z16f/z16f_serial.c | 806 + nuttx/arch/z16/src/z16f/z16f_sysexec.c | 132 + nuttx/arch/z16/src/z16f/z16f_timerisr.c | 135 + nuttx/arch/z80/include/arch.h | 82 + nuttx/arch/z80/include/ez80/arch.h | 77 + nuttx/arch/z80/include/ez80/io.h | 87 + nuttx/arch/z80/include/ez80/irq.h | 262 + nuttx/arch/z80/include/ez80/limits.h | 88 + nuttx/arch/z80/include/ez80/types.h | 115 + nuttx/arch/z80/include/io.h | 76 + nuttx/arch/z80/include/irq.h | 81 + nuttx/arch/z80/include/limits.h | 49 + nuttx/arch/z80/include/serial.h | 57 + nuttx/arch/z80/include/syscall.h | 82 + nuttx/arch/z80/include/types.h | 61 + nuttx/arch/z80/include/z8/arch.h | 77 + nuttx/arch/z80/include/z8/irq.h | 368 + nuttx/arch/z80/include/z8/limits.h | 77 + nuttx/arch/z80/include/z8/types.h | 106 + nuttx/arch/z80/include/z80/arch.h | 77 + nuttx/arch/z80/include/z80/io.h | 85 + nuttx/arch/z80/include/z80/irq.h | 152 + nuttx/arch/z80/include/z80/limits.h | 77 + nuttx/arch/z80/include/z80/types.h | 99 + nuttx/arch/z80/src/Makefile | 50 + nuttx/arch/z80/src/Makefile.sdcc | 252 + nuttx/arch/z80/src/Makefile.zdsii | 162 + nuttx/arch/z80/src/common/up_allocateheap.c | 114 + nuttx/arch/z80/src/common/up_arch.h | 52 + nuttx/arch/z80/src/common/up_assert.c | 179 + nuttx/arch/z80/src/common/up_blocktask.c | 174 + nuttx/arch/z80/src/common/up_createstack.c | 131 + nuttx/arch/z80/src/common/up_doirq.c | 109 + nuttx/arch/z80/src/common/up_exit.c | 177 + nuttx/arch/z80/src/common/up_idle.c | 107 + nuttx/arch/z80/src/common/up_initialize.c | 170 + nuttx/arch/z80/src/common/up_internal.h | 204 + .../arch/z80/src/common/up_interruptcontext.c | 72 + nuttx/arch/z80/src/common/up_mdelay.c | 94 + nuttx/arch/z80/src/common/up_puts.c | 75 + nuttx/arch/z80/src/common/up_releasepending.c | 137 + nuttx/arch/z80/src/common/up_releasestack.c | 79 + .../arch/z80/src/common/up_reprioritizertr.c | 187 + nuttx/arch/z80/src/common/up_stackdump.c | 109 + nuttx/arch/z80/src/common/up_udelay.c | 133 + nuttx/arch/z80/src/common/up_unblocktask.c | 168 + nuttx/arch/z80/src/common/up_usestack.c | 121 + nuttx/arch/z80/src/ez80/Make.defs | 61 + nuttx/arch/z80/src/ez80/chip.h | 97 + nuttx/arch/z80/src/ez80/ez80_clock.c | 65 + nuttx/arch/z80/src/ez80/ez80_copystate.c | 78 + nuttx/arch/z80/src/ez80/ez80_emac.c | 2247 ++ nuttx/arch/z80/src/ez80/ez80_i2c.c | 932 + nuttx/arch/z80/src/ez80/ez80_initialstate.c | 92 + nuttx/arch/z80/src/ez80/ez80_io.asm | 154 + nuttx/arch/z80/src/ez80/ez80_irq.c | 124 + nuttx/arch/z80/src/ez80/ez80_irqsave.asm | 88 + nuttx/arch/z80/src/ez80/ez80_lowuart.c | 256 + nuttx/arch/z80/src/ez80/ez80_registerdump.c | 102 + .../arch/z80/src/ez80/ez80_restorecontext.asm | 110 + .../z80/src/ez80/ez80_saveusercontext.asm | 172 + .../z80/src/ez80/ez80_schedulesigaction.c | 192 + nuttx/arch/z80/src/ez80/ez80_serial.c | 842 + nuttx/arch/z80/src/ez80/ez80_sigdeliver.c | 142 + nuttx/arch/z80/src/ez80/ez80_spi.c | 489 + nuttx/arch/z80/src/ez80/ez80_startup.asm | 155 + nuttx/arch/z80/src/ez80/ez80_timerisr.c | 172 + nuttx/arch/z80/src/ez80/ez80_vectors.asm | 340 + nuttx/arch/z80/src/ez80/ez80f91.h | 501 + nuttx/arch/z80/src/ez80/ez80f91_emac.h | 288 + nuttx/arch/z80/src/ez80/ez80f91_i2c.h | 149 + nuttx/arch/z80/src/ez80/ez80f91_init.asm | 257 + nuttx/arch/z80/src/ez80/ez80f91_spi.h | 131 + nuttx/arch/z80/src/ez80/switch.h | 164 + nuttx/arch/z80/src/ez80/up_mem.h | 88 + nuttx/arch/z80/src/mkhpbase.sh | 109 + nuttx/arch/z80/src/z8/Make.defs | 49 + nuttx/arch/z80/src/z8/chip.h | 238 + nuttx/arch/z80/src/z8/switch.h | 257 + nuttx/arch/z80/src/z8/up_mem.h | 88 + nuttx/arch/z80/src/z8/z8_head.S | 253 + nuttx/arch/z80/src/z8/z8_i2c.c | 604 + nuttx/arch/z80/src/z8/z8_initialstate.c | 94 + nuttx/arch/z80/src/z8/z8_irq.c | 248 + nuttx/arch/z80/src/z8/z8_lowuart.c | 130 + nuttx/arch/z80/src/z8/z8_registerdump.c | 141 + nuttx/arch/z80/src/z8/z8_restorecontext.S | 164 + nuttx/arch/z80/src/z8/z8_saveirqcontext.c | 134 + nuttx/arch/z80/src/z8/z8_saveusercontext.S | 165 + nuttx/arch/z80/src/z8/z8_schedulesigaction.c | 192 + nuttx/arch/z80/src/z8/z8_serial.c | 859 + nuttx/arch/z80/src/z8/z8_sigdeliver.c | 154 + nuttx/arch/z80/src/z8/z8_timerisr.c | 147 + nuttx/arch/z80/src/z8/z8_vector.S | 873 + nuttx/arch/z80/src/z80/Make.defs | 55 + nuttx/arch/z80/src/z80/README.txt | 49 + nuttx/arch/z80/src/z80/chip.h | 92 + nuttx/arch/z80/src/z80/switch.h | 163 + nuttx/arch/z80/src/z80/z80_copystate.c | 78 + nuttx/arch/z80/src/z80/z80_head.asm | 283 + nuttx/arch/z80/src/z80/z80_initialstate.c | 91 + nuttx/arch/z80/src/z80/z80_io.c | 94 + nuttx/arch/z80/src/z80/z80_irq.c | 113 + nuttx/arch/z80/src/z80/z80_registerdump.c | 91 + .../z80/src/z80/z80_restoreusercontext.asm | 104 + nuttx/arch/z80/src/z80/z80_rom.asm | 276 + .../arch/z80/src/z80/z80_saveusercontext.asm | 143 + .../arch/z80/src/z80/z80_schedulesigaction.c | 192 + nuttx/arch/z80/src/z80/z80_sigdeliver.c | 139 + nuttx/binfmt/Makefile | 102 + nuttx/binfmt/binfmt_dumpmodule.c | 101 + nuttx/binfmt/binfmt_exec.c | 123 + nuttx/binfmt/binfmt_execmodule.c | 190 + nuttx/binfmt/binfmt_globals.c | 71 + nuttx/binfmt/binfmt_internal.h | 88 + nuttx/binfmt/binfmt_loadmodule.c | 138 + nuttx/binfmt/binfmt_register.c | 104 + nuttx/binfmt/binfmt_unloadmodule.c | 108 + nuttx/binfmt/binfmt_unregister.c | 138 + nuttx/binfmt/libnxflat/Make.defs | 39 + nuttx/binfmt/libnxflat/gnu-nxflat.ld | 172 + nuttx/binfmt/libnxflat/libnxflat_bind.c | 492 + nuttx/binfmt/libnxflat/libnxflat_init.c | 188 + nuttx/binfmt/libnxflat/libnxflat_load.c | 208 + nuttx/binfmt/libnxflat/libnxflat_read.c | 165 + nuttx/binfmt/libnxflat/libnxflat_uninit.c | 88 + nuttx/binfmt/libnxflat/libnxflat_unload.c | 97 + nuttx/binfmt/libnxflat/libnxflat_verify.c | 100 + nuttx/binfmt/nxflat.c | 257 + nuttx/binfmt/symtab_findbyname.c | 97 + nuttx/binfmt/symtab_findbyvalue.c | 121 + nuttx/binfmt/symtab_findorderedbyname.c | 139 + nuttx/binfmt/symtab_findorderedbyvalue.c | 127 + nuttx/configs/README.txt | 1463 ++ nuttx/configs/amber/README.txt | 506 + nuttx/configs/amber/hello/Make.defs | 149 + nuttx/configs/amber/hello/appconfig | 39 + nuttx/configs/amber/hello/defconfig | 821 + nuttx/configs/amber/hello/ld.script | 211 + nuttx/configs/amber/hello/setenv.sh | 63 + nuttx/configs/amber/include/board.h | 100 + nuttx/configs/amber/src/Makefile | 97 + nuttx/configs/amber/src/amber_internal.h | 101 + nuttx/configs/amber/src/up_boot.c | 93 + nuttx/configs/avr32dev1/README.txt | 450 + nuttx/configs/avr32dev1/include/board.h | 257 + nuttx/configs/avr32dev1/nsh/Make.defs | 145 + nuttx/configs/avr32dev1/nsh/appconfig | 43 + nuttx/configs/avr32dev1/nsh/defconfig | 790 + nuttx/configs/avr32dev1/nsh/ld.script | 105 + nuttx/configs/avr32dev1/nsh/setenv.sh | 57 + nuttx/configs/avr32dev1/ostest/Make.defs | 145 + nuttx/configs/avr32dev1/ostest/appconfig | 39 + nuttx/configs/avr32dev1/ostest/defconfig | 790 + nuttx/configs/avr32dev1/ostest/ld.script | 105 + nuttx/configs/avr32dev1/ostest/setenv.sh | 57 + .../configs/avr32dev1/ostest/test-result.txt | 404 + nuttx/configs/avr32dev1/src/Makefile | 91 + .../avr32dev1/src/avr32dev1_internal.h | 127 + nuttx/configs/avr32dev1/src/up_boot.c | 84 + nuttx/configs/avr32dev1/src/up_buttons.c | 185 + nuttx/configs/avr32dev1/src/up_leds.c | 93 + nuttx/configs/avr32dev1/tools/doisp.sh | 37 + nuttx/configs/c5471evm/README.txt | 151 + nuttx/configs/c5471evm/doc/test-result.txt | 164 + nuttx/configs/c5471evm/httpd/Make.defs | 119 + nuttx/configs/c5471evm/httpd/appconfig | 46 + nuttx/configs/c5471evm/httpd/defconfig | 455 + nuttx/configs/c5471evm/httpd/ld.script | 107 + nuttx/configs/c5471evm/httpd/setenv.sh | 46 + nuttx/configs/c5471evm/include/README.txt | 1 + nuttx/configs/c5471evm/include/board.h | 66 + nuttx/configs/c5471evm/nettest/Make.defs | 119 + nuttx/configs/c5471evm/nettest/appconfig | 43 + nuttx/configs/c5471evm/nettest/defconfig | 455 + nuttx/configs/c5471evm/nettest/ld.script | 107 + nuttx/configs/c5471evm/nettest/setenv.sh | 46 + nuttx/configs/c5471evm/nsh/Make.defs | 119 + nuttx/configs/c5471evm/nsh/appconfig | 54 + nuttx/configs/c5471evm/nsh/defconfig | 455 + nuttx/configs/c5471evm/nsh/ld.script | 107 + nuttx/configs/c5471evm/nsh/setenv.sh | 46 + nuttx/configs/c5471evm/ostest/Make.defs | 119 + nuttx/configs/c5471evm/ostest/appconfig | 39 + nuttx/configs/c5471evm/ostest/defconfig | 455 + nuttx/configs/c5471evm/ostest/ld.script | 107 + nuttx/configs/c5471evm/ostest/setenv.sh | 46 + nuttx/configs/c5471evm/src/Makefile | 77 + nuttx/configs/c5471evm/src/README.txt | 2 + nuttx/configs/c5471evm/src/up_leds.c | 107 + nuttx/configs/demo9s12ne64/README.txt | 376 + nuttx/configs/demo9s12ne64/include/board.h | 143 + nuttx/configs/demo9s12ne64/ostest/Make.defs | 152 + nuttx/configs/demo9s12ne64/ostest/appconfig | 39 + nuttx/configs/demo9s12ne64/ostest/defconfig | 766 + .../demo9s12ne64/ostest/ld.script.banked | 143 + .../demo9s12ne64/ostest/ld.script.nonbanked | 116 + nuttx/configs/demo9s12ne64/ostest/setenv.sh | 46 + nuttx/configs/demo9s12ne64/src/Makefile | 86 + nuttx/configs/demo9s12ne64/src/demo9s12ne64.h | 91 + nuttx/configs/demo9s12ne64/src/up_boot.c | 89 + nuttx/configs/demo9s12ne64/src/up_buttons.c | 82 + nuttx/configs/demo9s12ne64/src/up_leds.c | 108 + nuttx/configs/demo9s12ne64/src/up_nsh.c | 86 + nuttx/configs/demo9s12ne64/src/up_spi.c | 130 + nuttx/configs/detron/README.txt | 404 + nuttx/configs/detron/hidkbd/Make.defs | 163 + nuttx/configs/detron/hidkbd/appconfig | 39 + nuttx/configs/detron/hidkbd/defconfig | 894 + nuttx/configs/detron/hidkbd/ld.script | 110 + nuttx/configs/detron/hidkbd/setenv.sh | 47 + nuttx/configs/detron/include/board.h | 207 + nuttx/configs/detron/nsh/Make.defs | 162 + nuttx/configs/detron/nsh/appconfig | 54 + nuttx/configs/detron/nsh/defconfig | 907 + nuttx/configs/detron/nsh/ld.script | 109 + nuttx/configs/detron/nsh/setenv.sh | 46 + nuttx/configs/detron/ostest/Make.defs | 162 + nuttx/configs/detron/ostest/appconfig | 39 + nuttx/configs/detron/ostest/defconfig | 828 + nuttx/configs/detron/ostest/ld.script | 109 + nuttx/configs/detron/ostest/setenv.sh | 46 + nuttx/configs/detron/src/Makefile | 87 + nuttx/configs/detron/src/detron_internal.h | 159 + nuttx/configs/detron/src/up_boot.c | 77 + nuttx/configs/detron/src/up_buttons.c | 180 + nuttx/configs/detron/src/up_nsh.c | 324 + nuttx/configs/detron/wlan/Make.defs | 163 + nuttx/configs/detron/wlan/appconfig | 43 + nuttx/configs/detron/wlan/defconfig | 919 + nuttx/configs/detron/wlan/ld.script | 110 + nuttx/configs/detron/wlan/setenv.sh | 47 + nuttx/configs/ea3131/README.txt | 636 + nuttx/configs/ea3131/include/board.h | 167 + .../configs/ea3131/include/board_memorymap.h | 117 + nuttx/configs/ea3131/locked/Makefile | 120 + nuttx/configs/ea3131/locked/ld-locked.script | 43 + nuttx/configs/ea3131/locked/mklocked.sh | 225 + nuttx/configs/ea3131/nsh/Make.defs | 164 + nuttx/configs/ea3131/nsh/appconfig | 43 + nuttx/configs/ea3131/nsh/defconfig | 774 + nuttx/configs/ea3131/nsh/ld.script | 107 + nuttx/configs/ea3131/nsh/setenv.sh | 47 + nuttx/configs/ea3131/ostest/Make.defs | 164 + nuttx/configs/ea3131/ostest/appconfig | 39 + nuttx/configs/ea3131/ostest/defconfig | 774 + nuttx/configs/ea3131/ostest/ld.script | 107 + nuttx/configs/ea3131/ostest/setenv.sh | 47 + nuttx/configs/ea3131/pgnsh/Make.defs | 164 + nuttx/configs/ea3131/pgnsh/appconfig | 44 + nuttx/configs/ea3131/pgnsh/defconfig | 920 + nuttx/configs/ea3131/pgnsh/ld.script | 151 + nuttx/configs/ea3131/pgnsh/setenv.sh | 47 + nuttx/configs/ea3131/src/Makefile | 105 + nuttx/configs/ea3131/src/ea3131_internal.h | 127 + nuttx/configs/ea3131/src/up_boot.c | 119 + nuttx/configs/ea3131/src/up_buttons.c | 82 + nuttx/configs/ea3131/src/up_clkinit.c | 444 + nuttx/configs/ea3131/src/up_fillpage.c | 525 + nuttx/configs/ea3131/src/up_leds.c | 111 + nuttx/configs/ea3131/src/up_mem.c | 359 + nuttx/configs/ea3131/src/up_nsh.c | 165 + nuttx/configs/ea3131/src/up_spi.c | 142 + nuttx/configs/ea3131/src/up_usbstrg.c | 126 + nuttx/configs/ea3131/tools/Makefile | 53 + nuttx/configs/ea3131/tools/armusbocd.cfg | 34 + nuttx/configs/ea3131/tools/crc32.c | 123 + nuttx/configs/ea3131/tools/lpchdr.c | 297 + nuttx/configs/ea3131/tools/lpchdr.h | 105 + nuttx/configs/ea3131/tools/mklpc.sh | 60 + nuttx/configs/ea3131/tools/oocd.sh | 43 + nuttx/configs/ea3131/usbserial/Make.defs | 164 + nuttx/configs/ea3131/usbserial/appconfig | 39 + nuttx/configs/ea3131/usbserial/defconfig | 820 + nuttx/configs/ea3131/usbserial/ld.script | 108 + nuttx/configs/ea3131/usbserial/setenv.sh | 47 + nuttx/configs/ea3131/usbstorage/Make.defs | 164 + nuttx/configs/ea3131/usbstorage/appconfig | 39 + nuttx/configs/ea3131/usbstorage/defconfig | 821 + nuttx/configs/ea3131/usbstorage/ld.script | 107 + nuttx/configs/ea3131/usbstorage/setenv.sh | 47 + nuttx/configs/ea3152/README.txt | 411 + nuttx/configs/ea3152/include/board.h | 167 + .../configs/ea3152/include/board_memorymap.h | 117 + nuttx/configs/ea3152/ostest/Make.defs | 164 + nuttx/configs/ea3152/ostest/appconfig | 39 + nuttx/configs/ea3152/ostest/defconfig | 775 + nuttx/configs/ea3152/ostest/ld.script | 107 + nuttx/configs/ea3152/ostest/setenv.sh | 47 + nuttx/configs/ea3152/src/Makefile | 105 + nuttx/configs/ea3152/src/ea3152_internal.h | 127 + nuttx/configs/ea3152/src/up_boot.c | 119 + nuttx/configs/ea3152/src/up_buttons.c | 82 + nuttx/configs/ea3152/src/up_clkinit.c | 444 + nuttx/configs/ea3152/src/up_fillpage.c | 525 + nuttx/configs/ea3152/src/up_leds.c | 111 + nuttx/configs/ea3152/src/up_mem.c | 359 + nuttx/configs/ea3152/src/up_nsh.c | 165 + nuttx/configs/ea3152/src/up_spi.c | 142 + nuttx/configs/ea3152/src/up_usbstrg.c | 126 + nuttx/configs/ea3152/tools/Makefile | 53 + nuttx/configs/ea3152/tools/armusbocd.cfg | 34 + nuttx/configs/ea3152/tools/crc32.c | 123 + nuttx/configs/ea3152/tools/jlink.cfg | 8 + nuttx/configs/ea3152/tools/lpc3152.cfg | 78 + nuttx/configs/ea3152/tools/lpchdr.c | 297 + nuttx/configs/ea3152/tools/lpchdr.h | 105 + nuttx/configs/ea3152/tools/mklpc.sh | 60 + .../ea3152/tools/olimex-arm-usb-ocd.cfg | 12 + nuttx/configs/ea3152/tools/oocd.sh | 169 + nuttx/configs/eagle100/README.txt | 377 + nuttx/configs/eagle100/httpd/Make.defs | 148 + nuttx/configs/eagle100/httpd/appconfig | 46 + nuttx/configs/eagle100/httpd/defconfig | 626 + nuttx/configs/eagle100/httpd/ld.script | 112 + nuttx/configs/eagle100/httpd/setenv.sh | 46 + nuttx/configs/eagle100/include/README.txt | 1 + nuttx/configs/eagle100/include/board.h | 142 + nuttx/configs/eagle100/nettest/Make.defs | 148 + nuttx/configs/eagle100/nettest/appconfig | 43 + nuttx/configs/eagle100/nettest/defconfig | 609 + nuttx/configs/eagle100/nettest/ld.script | 112 + nuttx/configs/eagle100/nettest/setenv.sh | 46 + nuttx/configs/eagle100/nsh/Make.defs | 148 + nuttx/configs/eagle100/nsh/appconfig | 43 + nuttx/configs/eagle100/nsh/defconfig | 594 + nuttx/configs/eagle100/nsh/ld.script | 112 + nuttx/configs/eagle100/nsh/setenv.sh | 46 + nuttx/configs/eagle100/nxflat/Make.defs | 151 + nuttx/configs/eagle100/nxflat/appconfig | 39 + nuttx/configs/eagle100/nxflat/defconfig | 607 + nuttx/configs/eagle100/nxflat/ld.script | 112 + nuttx/configs/eagle100/nxflat/setenv.sh | 46 + nuttx/configs/eagle100/ostest/Make.defs | 148 + nuttx/configs/eagle100/ostest/appconfig | 39 + nuttx/configs/eagle100/ostest/defconfig | 601 + nuttx/configs/eagle100/ostest/ld.script | 112 + nuttx/configs/eagle100/ostest/setenv.sh | 46 + nuttx/configs/eagle100/ostest/test-result.txt | 427 + nuttx/configs/eagle100/src/Makefile | 86 + nuttx/configs/eagle100/src/README.txt | 1 + .../configs/eagle100/src/eagle100_internal.h | 106 + nuttx/configs/eagle100/src/up_boot.c | 91 + nuttx/configs/eagle100/src/up_ethernet.c | 98 + nuttx/configs/eagle100/src/up_leds.c | 171 + nuttx/configs/eagle100/src/up_nsh.c | 159 + nuttx/configs/eagle100/src/up_ssi.c | 152 + nuttx/configs/eagle100/thttpd/Make.defs | 151 + nuttx/configs/eagle100/thttpd/appconfig | 44 + nuttx/configs/eagle100/thttpd/defconfig | 705 + nuttx/configs/eagle100/thttpd/ld.script | 112 + nuttx/configs/eagle100/thttpd/setenv.sh | 46 + nuttx/configs/ez80f910200kitg/README.txt | 80 + nuttx/configs/ez80f910200kitg/include/board.h | 80 + .../configs/ez80f910200kitg/ostest/Make.defs | 178 + .../configs/ez80f910200kitg/ostest/README.txt | 12 + .../configs/ez80f910200kitg/ostest/appconfig | 39 + .../configs/ez80f910200kitg/ostest/defconfig | 788 + .../ez80f910200kitg/ostest/ostest.linkcmd | 94 + .../ez80f910200kitg/ostest/ostest.zdsproj | 247 + .../configs/ez80f910200kitg/ostest/setenv.sh | 52 + .../ez80f910200kitg/ostest/test-result.txt | 529 + nuttx/configs/ez80f910200kitg/src/Makefile | 84 + nuttx/configs/ez80f910200kitg/src/ez80_leds.c | 89 + .../ez80f910200kitg/src/ez80_lowinit.c | 66 + nuttx/configs/ez80f910200zco/README.txt | 106 + nuttx/configs/ez80f910200zco/dhcpd/Make.defs | 178 + nuttx/configs/ez80f910200zco/dhcpd/README.txt | 5 + nuttx/configs/ez80f910200zco/dhcpd/appconfig | 43 + nuttx/configs/ez80f910200zco/dhcpd/defconfig | 822 + .../ez80f910200zco/dhcpd/dhcpd.linkcmd | 94 + .../ez80f910200zco/dhcpd/dhcpd.zdsproj | 247 + nuttx/configs/ez80f910200zco/dhcpd/setenv.sh | 52 + nuttx/configs/ez80f910200zco/httpd/Make.defs | 178 + nuttx/configs/ez80f910200zco/httpd/README.txt | 5 + nuttx/configs/ez80f910200zco/httpd/appconfig | 47 + nuttx/configs/ez80f910200zco/httpd/defconfig | 830 + .../ez80f910200zco/httpd/httpd.linkcmd | 94 + .../ez80f910200zco/httpd/httpd.zdsproj | 247 + nuttx/configs/ez80f910200zco/httpd/setenv.sh | 52 + nuttx/configs/ez80f910200zco/include/board.h | 93 + .../configs/ez80f910200zco/nettest/Make.defs | 178 + .../configs/ez80f910200zco/nettest/README.txt | 5 + .../configs/ez80f910200zco/nettest/appconfig | 43 + .../configs/ez80f910200zco/nettest/defconfig | 815 + .../ez80f910200zco/nettest/nettest.linkcmd | 94 + .../ez80f910200zco/nettest/nettest.zdsproj | 247 + .../configs/ez80f910200zco/nettest/setenv.sh | 52 + nuttx/configs/ez80f910200zco/nsh/Make.defs | 178 + nuttx/configs/ez80f910200zco/nsh/README.txt | 5 + nuttx/configs/ez80f910200zco/nsh/appconfig | 54 + nuttx/configs/ez80f910200zco/nsh/defconfig | 815 + nuttx/configs/ez80f910200zco/nsh/nsh.linkcmd | 94 + nuttx/configs/ez80f910200zco/nsh/nsh.zdsproj | 247 + .../configs/ez80f910200zco/nsh/sample-run.txt | 57 + nuttx/configs/ez80f910200zco/nsh/setenv.sh | 52 + nuttx/configs/ez80f910200zco/ostest/Make.defs | 178 + .../configs/ez80f910200zco/ostest/README.txt | 5 + nuttx/configs/ez80f910200zco/ostest/appconfig | 39 + nuttx/configs/ez80f910200zco/ostest/defconfig | 798 + .../ez80f910200zco/ostest/ostest.linkcmd | 94 + .../ez80f910200zco/ostest/ostest.zdsproj | 247 + nuttx/configs/ez80f910200zco/ostest/setenv.sh | 52 + .../ez80f910200zco/ostest/test-result.txt | 731 + nuttx/configs/ez80f910200zco/poll/Make.defs | 178 + nuttx/configs/ez80f910200zco/poll/README.txt | 5 + nuttx/configs/ez80f910200zco/poll/appconfig | 43 + nuttx/configs/ez80f910200zco/poll/defconfig | 815 + .../configs/ez80f910200zco/poll/poll.linkcmd | 94 + .../configs/ez80f910200zco/poll/poll.zdsproj | 247 + nuttx/configs/ez80f910200zco/poll/setenv.sh | 52 + nuttx/configs/ez80f910200zco/src/Makefile | 91 + .../configs/ez80f910200zco/src/ez80_buttons.c | 174 + nuttx/configs/ez80f910200zco/src/ez80_leds.c | 318 + .../configs/ez80f910200zco/src/ez80_lowinit.c | 66 + .../ez80f910200zco/src/ez80f910200zco.h | 151 + nuttx/configs/hymini-stm32v/README.txt | 674 + nuttx/configs/hymini-stm32v/buttons/Make.defs | 174 + nuttx/configs/hymini-stm32v/buttons/appconfig | 39 + nuttx/configs/hymini-stm32v/buttons/defconfig | 880 + nuttx/configs/hymini-stm32v/buttons/ld.script | 112 + .../hymini-stm32v/buttons/ld.script.dfu | 111 + nuttx/configs/hymini-stm32v/buttons/setenv.sh | 47 + .../configs/hymini-stm32v/include/README.txt | 1 + nuttx/configs/hymini-stm32v/include/board.h | 230 + nuttx/configs/hymini-stm32v/nsh/Make.defs | 174 + nuttx/configs/hymini-stm32v/nsh/appconfig | 41 + nuttx/configs/hymini-stm32v/nsh/defconfig | 865 + nuttx/configs/hymini-stm32v/nsh/ld.script | 112 + nuttx/configs/hymini-stm32v/nsh/ld.script.dfu | 111 + nuttx/configs/hymini-stm32v/nsh/setenv.sh | 47 + nuttx/configs/hymini-stm32v/nsh2/Make.defs | 174 + nuttx/configs/hymini-stm32v/nsh2/appconfig | 52 + nuttx/configs/hymini-stm32v/nsh2/defconfig | 1209 ++ nuttx/configs/hymini-stm32v/nsh2/ld.script | 112 + .../configs/hymini-stm32v/nsh2/ld.script.dfu | 111 + nuttx/configs/hymini-stm32v/nsh2/setenv.sh | 67 + nuttx/configs/hymini-stm32v/nx/Make.defs | 174 + nuttx/configs/hymini-stm32v/nx/appconfig | 39 + nuttx/configs/hymini-stm32v/nx/defconfig | 1153 + nuttx/configs/hymini-stm32v/nx/ld.script | 112 + nuttx/configs/hymini-stm32v/nx/ld.script.dfu | 111 + nuttx/configs/hymini-stm32v/nx/setenv.sh | 62 + nuttx/configs/hymini-stm32v/nxlines/Make.defs | 176 + nuttx/configs/hymini-stm32v/nxlines/appconfig | 39 + nuttx/configs/hymini-stm32v/nxlines/defconfig | 1209 ++ nuttx/configs/hymini-stm32v/nxlines/ld.script | 112 + .../hymini-stm32v/nxlines/ld.script.dfu | 111 + nuttx/configs/hymini-stm32v/nxlines/setenv.sh | 53 + nuttx/configs/hymini-stm32v/src/Makefile | 102 + nuttx/configs/hymini-stm32v/src/README.txt | 1 + .../src/hymini_stm32v-internal.h | 153 + nuttx/configs/hymini-stm32v/src/ssd1289.c | 989 + nuttx/configs/hymini-stm32v/src/ssd1289.h | 55 + nuttx/configs/hymini-stm32v/src/up_boot.c | 103 + nuttx/configs/hymini-stm32v/src/up_buttons.c | 159 + nuttx/configs/hymini-stm32v/src/up_leds.c | 241 + nuttx/configs/hymini-stm32v/src/up_nsh.c | 182 + nuttx/configs/hymini-stm32v/src/up_spi.c | 179 + nuttx/configs/hymini-stm32v/src/up_ts.c | 163 + nuttx/configs/hymini-stm32v/src/up_usbdev.c | 117 + nuttx/configs/hymini-stm32v/src/up_usbstrg.c | 164 + .../configs/hymini-stm32v/usbserial/Make.defs | 174 + .../configs/hymini-stm32v/usbserial/appconfig | 39 + .../configs/hymini-stm32v/usbserial/defconfig | 953 + .../configs/hymini-stm32v/usbserial/ld.script | 113 + .../hymini-stm32v/usbserial/ld.script.dfu | 111 + .../configs/hymini-stm32v/usbserial/setenv.sh | 47 + .../hymini-stm32v/usbstorage/Make.defs | 174 + .../hymini-stm32v/usbstorage/appconfig | 39 + .../hymini-stm32v/usbstorage/defconfig | 928 + .../hymini-stm32v/usbstorage/ld.script | 112 + .../hymini-stm32v/usbstorage/ld.script.dfu | 111 + .../hymini-stm32v/usbstorage/setenv.sh | 47 + nuttx/configs/kwikstik-k40/README.txt | 482 + nuttx/configs/kwikstik-k40/include/board.h | 285 + nuttx/configs/kwikstik-k40/ostest/Make.defs | 162 + nuttx/configs/kwikstik-k40/ostest/appconfig | 39 + nuttx/configs/kwikstik-k40/ostest/defconfig | 921 + nuttx/configs/kwikstik-k40/ostest/ld.script | 135 + nuttx/configs/kwikstik-k40/ostest/setenv.sh | 61 + nuttx/configs/kwikstik-k40/src/Makefile | 105 + .../kwikstik-k40/src/kwikstik-internal.h | 195 + nuttx/configs/kwikstik-k40/src/up_boot.c | 102 + nuttx/configs/kwikstik-k40/src/up_buttons.c | 123 + nuttx/configs/kwikstik-k40/src/up_lcd.c | 134 + nuttx/configs/kwikstik-k40/src/up_leds.c | 107 + nuttx/configs/kwikstik-k40/src/up_nsh.c | 258 + nuttx/configs/kwikstik-k40/src/up_spi.c | 164 + nuttx/configs/kwikstik-k40/src/up_usbdev.c | 115 + nuttx/configs/kwikstik-k40/src/up_usbstrg.c | 118 + nuttx/configs/lm3s6965-ek/README.txt | 442 + nuttx/configs/lm3s6965-ek/include/README.txt | 1 + nuttx/configs/lm3s6965-ek/include/board.h | 142 + nuttx/configs/lm3s6965-ek/nsh/Make.defs | 162 + nuttx/configs/lm3s6965-ek/nsh/appconfig | 54 + nuttx/configs/lm3s6965-ek/nsh/defconfig | 618 + nuttx/configs/lm3s6965-ek/nsh/ld.script | 108 + nuttx/configs/lm3s6965-ek/nsh/setenv.sh | 46 + nuttx/configs/lm3s6965-ek/nx/Make.defs | 162 + nuttx/configs/lm3s6965-ek/nx/appconfig | 39 + nuttx/configs/lm3s6965-ek/nx/defconfig | 781 + nuttx/configs/lm3s6965-ek/nx/ld.script | 108 + nuttx/configs/lm3s6965-ek/nx/setenv.sh | 46 + nuttx/configs/lm3s6965-ek/ostest/Make.defs | 162 + nuttx/configs/lm3s6965-ek/ostest/appconfig | 39 + nuttx/configs/lm3s6965-ek/ostest/defconfig | 615 + nuttx/configs/lm3s6965-ek/ostest/ld.script | 108 + nuttx/configs/lm3s6965-ek/ostest/setenv.sh | 46 + nuttx/configs/lm3s6965-ek/src/Makefile | 90 + nuttx/configs/lm3s6965-ek/src/README.txt | 1 + .../lm3s6965-ek/src/lm3s6965ek_internal.h | 136 + nuttx/configs/lm3s6965-ek/src/up_boot.c | 92 + nuttx/configs/lm3s6965-ek/src/up_ethernet.c | 98 + nuttx/configs/lm3s6965-ek/src/up_leds.c | 167 + nuttx/configs/lm3s6965-ek/src/up_nsh.c | 159 + nuttx/configs/lm3s6965-ek/src/up_oled.c | 172 + nuttx/configs/lm3s6965-ek/src/up_ssi.c | 164 + nuttx/configs/lm3s8962-ek/README.txt | 427 + nuttx/configs/lm3s8962-ek/include/README.txt | 1 + nuttx/configs/lm3s8962-ek/include/board.h | 142 + nuttx/configs/lm3s8962-ek/nsh/Make.defs | 162 + nuttx/configs/lm3s8962-ek/nsh/appconfig | 54 + nuttx/configs/lm3s8962-ek/nsh/defconfig | 618 + nuttx/configs/lm3s8962-ek/nsh/ld.script | 108 + nuttx/configs/lm3s8962-ek/nsh/setenv.sh | 46 + nuttx/configs/lm3s8962-ek/nx/Make.defs | 162 + nuttx/configs/lm3s8962-ek/nx/appconfig | 39 + nuttx/configs/lm3s8962-ek/nx/defconfig | 780 + nuttx/configs/lm3s8962-ek/nx/ld.script | 108 + nuttx/configs/lm3s8962-ek/nx/setenv.sh | 46 + nuttx/configs/lm3s8962-ek/ostest/Make.defs | 162 + nuttx/configs/lm3s8962-ek/ostest/appconfig | 39 + nuttx/configs/lm3s8962-ek/ostest/defconfig | 615 + nuttx/configs/lm3s8962-ek/ostest/ld.script | 108 + nuttx/configs/lm3s8962-ek/ostest/setenv.sh | 46 + nuttx/configs/lm3s8962-ek/src/Makefile | 90 + nuttx/configs/lm3s8962-ek/src/README.txt | 1 + .../lm3s8962-ek/src/lm3s8962ek_internal.h | 136 + nuttx/configs/lm3s8962-ek/src/up_boot.c | 92 + nuttx/configs/lm3s8962-ek/src/up_ethernet.c | 98 + nuttx/configs/lm3s8962-ek/src/up_leds.c | 167 + nuttx/configs/lm3s8962-ek/src/up_nsh.c | 159 + nuttx/configs/lm3s8962-ek/src/up_oled.c | 172 + nuttx/configs/lm3s8962-ek/src/up_ssi.c | 164 + nuttx/configs/lpcxpresso-lpc1768/README.txt | 782 + .../lpcxpresso-lpc1768/dhcpd/Make.defs | 174 + .../lpcxpresso-lpc1768/dhcpd/appconfig | 43 + .../lpcxpresso-lpc1768/dhcpd/defconfig | 919 + .../lpcxpresso-lpc1768/dhcpd/ld.script | 110 + .../lpcxpresso-lpc1768/dhcpd/setenv.sh | 59 + .../lpcxpresso-lpc1768/include/board.h | 290 + .../configs/lpcxpresso-lpc1768/nsh/Make.defs | 174 + .../configs/lpcxpresso-lpc1768/nsh/appconfig | 54 + .../configs/lpcxpresso-lpc1768/nsh/defconfig | 951 + .../configs/lpcxpresso-lpc1768/nsh/ld.script | 110 + .../configs/lpcxpresso-lpc1768/nsh/setenv.sh | 59 + nuttx/configs/lpcxpresso-lpc1768/nx/Make.defs | 174 + nuttx/configs/lpcxpresso-lpc1768/nx/appconfig | 39 + nuttx/configs/lpcxpresso-lpc1768/nx/defconfig | 1083 + nuttx/configs/lpcxpresso-lpc1768/nx/ld.script | 110 + nuttx/configs/lpcxpresso-lpc1768/nx/setenv.sh | 59 + .../lpcxpresso-lpc1768/ostest/Make.defs | 174 + .../lpcxpresso-lpc1768/ostest/appconfig | 39 + .../lpcxpresso-lpc1768/ostest/defconfig | 907 + .../lpcxpresso-lpc1768/ostest/ld.script | 110 + .../lpcxpresso-lpc1768/ostest/setenv.sh | 59 + nuttx/configs/lpcxpresso-lpc1768/src/Makefile | 96 + .../src/lpcxpresso_internal.h | 236 + .../configs/lpcxpresso-lpc1768/src/up_boot.c | 93 + .../configs/lpcxpresso-lpc1768/src/up_leds.c | 157 + nuttx/configs/lpcxpresso-lpc1768/src/up_nsh.c | 171 + .../configs/lpcxpresso-lpc1768/src/up_oled.c | 214 + nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c | 215 + .../lpcxpresso-lpc1768/src/up_usbstrg.c | 143 + .../lpcxpresso-lpc1768/thttpd/Make.defs | 179 + .../lpcxpresso-lpc1768/thttpd/appconfig | 43 + .../lpcxpresso-lpc1768/thttpd/defconfig | 1006 + .../lpcxpresso-lpc1768/thttpd/ld.script | 110 + .../lpcxpresso-lpc1768/thttpd/setenv.sh | 61 + .../configs/lpcxpresso-lpc1768/tools/flash.sh | 146 + .../lpcxpresso-lpc1768/usbstorage/Make.defs | 174 + .../lpcxpresso-lpc1768/usbstorage/appconfig | 39 + .../lpcxpresso-lpc1768/usbstorage/defconfig | 896 + .../lpcxpresso-lpc1768/usbstorage/ld.script | 110 + .../lpcxpresso-lpc1768/usbstorage/setenv.sh | 59 + nuttx/configs/m68332evb/Make.defs | 103 + nuttx/configs/m68332evb/appconfig | 39 + nuttx/configs/m68332evb/defconfig | 386 + nuttx/configs/m68332evb/doc/m68k-defconfig | 111 + nuttx/configs/m68332evb/include/README.txt | 1 + nuttx/configs/m68332evb/ld.script | 84 + nuttx/configs/m68332evb/setenv.sh | 46 + nuttx/configs/m68332evb/src/Makefile | 74 + nuttx/configs/m68332evb/src/README.txt | 1 + nuttx/configs/mbed/README.txt | 403 + nuttx/configs/mbed/hidkbd/Make.defs | 162 + nuttx/configs/mbed/hidkbd/appconfig | 39 + nuttx/configs/mbed/hidkbd/defconfig | 894 + nuttx/configs/mbed/hidkbd/ld.script | 109 + nuttx/configs/mbed/hidkbd/setenv.sh | 47 + nuttx/configs/mbed/include/board.h | 217 + nuttx/configs/mbed/nsh/Make.defs | 162 + nuttx/configs/mbed/nsh/appconfig | 43 + nuttx/configs/mbed/nsh/defconfig | 823 + nuttx/configs/mbed/nsh/ld.script | 109 + nuttx/configs/mbed/nsh/setenv.sh | 47 + nuttx/configs/mbed/src/Makefile | 90 + nuttx/configs/mbed/src/mbed_internal.h | 94 + nuttx/configs/mbed/src/up_boot.c | 82 + nuttx/configs/mbed/src/up_leds.c | 222 + nuttx/configs/mbed/src/up_nsh.c | 102 + nuttx/configs/mcu123-lpc214x/README.txt | 284 + .../configs/mcu123-lpc214x/include/README.txt | 1 + nuttx/configs/mcu123-lpc214x/include/board.h | 79 + .../configs/mcu123-lpc214x/lpc21isp-1.60.diff | 102 + nuttx/configs/mcu123-lpc214x/nsh/Make.defs | 160 + nuttx/configs/mcu123-lpc214x/nsh/appconfig | 43 + nuttx/configs/mcu123-lpc214x/nsh/defconfig | 641 + nuttx/configs/mcu123-lpc214x/nsh/ld.script | 119 + nuttx/configs/mcu123-lpc214x/nsh/setenv.sh | 47 + nuttx/configs/mcu123-lpc214x/ostest/Make.defs | 160 + nuttx/configs/mcu123-lpc214x/ostest/appconfig | 39 + nuttx/configs/mcu123-lpc214x/ostest/defconfig | 631 + nuttx/configs/mcu123-lpc214x/ostest/ld.script | 119 + nuttx/configs/mcu123-lpc214x/ostest/setenv.sh | 47 + .../mcu123-lpc214x/scripts/lpc21isp.sh | 65 + nuttx/configs/mcu123-lpc214x/src/Makefile | 91 + nuttx/configs/mcu123-lpc214x/src/README.txt | 2 + nuttx/configs/mcu123-lpc214x/src/up_leds.c | 115 + nuttx/configs/mcu123-lpc214x/src/up_nsh.c | 159 + nuttx/configs/mcu123-lpc214x/src/up_spi.c | 601 + nuttx/configs/mcu123-lpc214x/src/up_usbstrg.c | 143 + .../mcu123-lpc214x/usbserial/Make.defs | 160 + .../mcu123-lpc214x/usbserial/appconfig | 39 + .../mcu123-lpc214x/usbserial/defconfig | 648 + .../mcu123-lpc214x/usbserial/ld.script | 119 + .../mcu123-lpc214x/usbserial/setenv.sh | 47 + .../mcu123-lpc214x/usbstorage/Make.defs | 160 + .../mcu123-lpc214x/usbstorage/appconfig | 39 + .../mcu123-lpc214x/usbstorage/defconfig | 691 + .../mcu123-lpc214x/usbstorage/ld.script | 119 + .../mcu123-lpc214x/usbstorage/setenv.sh | 47 + nuttx/configs/micropendous3/README.txt | 534 + nuttx/configs/micropendous3/hello/Make.defs | 149 + nuttx/configs/micropendous3/hello/appconfig | 39 + nuttx/configs/micropendous3/hello/defconfig | 815 + nuttx/configs/micropendous3/hello/ld.script | 211 + nuttx/configs/micropendous3/hello/setenv.sh | 63 + nuttx/configs/micropendous3/include/board.h | 101 + nuttx/configs/micropendous3/src/Makefile | 97 + .../src/micropendous3_internal.h | 101 + nuttx/configs/micropendous3/src/up_boot.c | 93 + nuttx/configs/mx1ads/README.txt | 138 + nuttx/configs/mx1ads/include/README.txt | 1 + nuttx/configs/mx1ads/include/board.h | 166 + nuttx/configs/mx1ads/ostest/Make.defs | 133 + nuttx/configs/mx1ads/ostest/appconfig | 39 + nuttx/configs/mx1ads/ostest/defconfig | 579 + nuttx/configs/mx1ads/ostest/ld.script | 84 + nuttx/configs/mx1ads/ostest/setenv.sh | 46 + nuttx/configs/mx1ads/src/Makefile | 77 + nuttx/configs/mx1ads/src/README.txt | 1 + nuttx/configs/mx1ads/src/up_boot.c | 107 + nuttx/configs/mx1ads/src/up_leds.c | 107 + nuttx/configs/mx1ads/src/up_network.c | 77 + nuttx/configs/ne64badge/README.txt | 483 + nuttx/configs/ne64badge/include/board.h | 151 + nuttx/configs/ne64badge/ostest/Make.defs | 152 + nuttx/configs/ne64badge/ostest/appconfig | 39 + nuttx/configs/ne64badge/ostest/defconfig | 777 + .../configs/ne64badge/ostest/ld.script.banked | 151 + .../ne64badge/ostest/ld.script.nonbanked | 124 + nuttx/configs/ne64badge/ostest/setenv.sh | 46 + nuttx/configs/ne64badge/src/Makefile | 86 + .../ne64badge/src/ne64badge_internal.h | 205 + nuttx/configs/ne64badge/src/up_boot.c | 89 + nuttx/configs/ne64badge/src/up_buttons.c | 130 + nuttx/configs/ne64badge/src/up_leds.c | 158 + nuttx/configs/ne64badge/src/up_nsh.c | 86 + nuttx/configs/ne64badge/src/up_spi.c | 130 + nuttx/configs/ntosd-dm320/README.txt | 371 + nuttx/configs/ntosd-dm320/doc/README.txt | 74 + nuttx/configs/ntosd-dm320/doc/test-result.txt | 468 + nuttx/configs/ntosd-dm320/include/README.txt | 1 + nuttx/configs/ntosd-dm320/include/board.h | 134 + nuttx/configs/ntosd-dm320/nettest/Make.defs | 171 + nuttx/configs/ntosd-dm320/nettest/appconfig | 43 + nuttx/configs/ntosd-dm320/nettest/defconfig | 575 + nuttx/configs/ntosd-dm320/nettest/ld.script | 85 + nuttx/configs/ntosd-dm320/nettest/setenv.sh | 46 + nuttx/configs/ntosd-dm320/nsh/Make.defs | 171 + nuttx/configs/ntosd-dm320/nsh/appconfig | 54 + nuttx/configs/ntosd-dm320/nsh/defconfig | 636 + nuttx/configs/ntosd-dm320/nsh/ld.script | 85 + nuttx/configs/ntosd-dm320/nsh/setenv.sh | 46 + nuttx/configs/ntosd-dm320/ostest/Make.defs | 171 + nuttx/configs/ntosd-dm320/ostest/appconfig | 39 + nuttx/configs/ntosd-dm320/ostest/defconfig | 567 + nuttx/configs/ntosd-dm320/ostest/ld.script | 85 + nuttx/configs/ntosd-dm320/ostest/setenv.sh | 46 + nuttx/configs/ntosd-dm320/poll/Make.defs | 171 + nuttx/configs/ntosd-dm320/poll/appconfig | 43 + nuttx/configs/ntosd-dm320/poll/defconfig | 582 + nuttx/configs/ntosd-dm320/poll/ld.script | 85 + nuttx/configs/ntosd-dm320/poll/setenv.sh | 46 + nuttx/configs/ntosd-dm320/src/Makefile | 77 + nuttx/configs/ntosd-dm320/src/README.txt | 1 + nuttx/configs/ntosd-dm320/src/up_leds.c | 104 + nuttx/configs/ntosd-dm320/src/up_network.c | 103 + nuttx/configs/ntosd-dm320/thttpd/Make.defs | 171 + nuttx/configs/ntosd-dm320/thttpd/appconfig | 44 + nuttx/configs/ntosd-dm320/thttpd/defconfig | 760 + nuttx/configs/ntosd-dm320/thttpd/ld.script | 85 + nuttx/configs/ntosd-dm320/thttpd/setenv.sh | 46 + nuttx/configs/ntosd-dm320/udp/Make.defs | 171 + nuttx/configs/ntosd-dm320/udp/appconfig | 43 + nuttx/configs/ntosd-dm320/udp/defconfig | 582 + nuttx/configs/ntosd-dm320/udp/ld.script | 85 + nuttx/configs/ntosd-dm320/udp/setenv.sh | 46 + nuttx/configs/ntosd-dm320/uip/Make.defs | 171 + nuttx/configs/ntosd-dm320/uip/appconfig | 46 + nuttx/configs/ntosd-dm320/uip/defconfig | 583 + nuttx/configs/ntosd-dm320/uip/ld.script | 85 + nuttx/configs/ntosd-dm320/uip/setenv.sh | 46 + nuttx/configs/nucleus2g/README.txt | 487 + nuttx/configs/nucleus2g/include/board.h | 270 + nuttx/configs/nucleus2g/nsh/Make.defs | 162 + nuttx/configs/nucleus2g/nsh/appconfig | 43 + nuttx/configs/nucleus2g/nsh/defconfig | 888 + nuttx/configs/nucleus2g/nsh/ld.script | 109 + nuttx/configs/nucleus2g/nsh/setenv.sh | 47 + nuttx/configs/nucleus2g/ostest/Make.defs | 162 + nuttx/configs/nucleus2g/ostest/appconfig | 39 + nuttx/configs/nucleus2g/ostest/defconfig | 823 + nuttx/configs/nucleus2g/ostest/ld.script | 109 + nuttx/configs/nucleus2g/ostest/setenv.sh | 47 + .../configs/nucleus2g/ostest/test-result.txt | 432 + nuttx/configs/nucleus2g/src/Makefile | 90 + .../nucleus2g/src/nucleus2g_internal.h | 156 + nuttx/configs/nucleus2g/src/up_boot.c | 115 + nuttx/configs/nucleus2g/src/up_leds.c | 235 + nuttx/configs/nucleus2g/src/up_nsh.c | 164 + nuttx/configs/nucleus2g/src/up_ssp.c | 185 + nuttx/configs/nucleus2g/src/up_usbstrg.c | 143 + nuttx/configs/nucleus2g/tools/olimex.cfg | 62 + nuttx/configs/nucleus2g/tools/oocd.sh | 49 + nuttx/configs/nucleus2g/tools/scarab.cfg | 63 + nuttx/configs/nucleus2g/usbserial/Make.defs | 162 + nuttx/configs/nucleus2g/usbserial/appconfig | 39 + nuttx/configs/nucleus2g/usbserial/defconfig | 867 + nuttx/configs/nucleus2g/usbserial/ld.script | 109 + nuttx/configs/nucleus2g/usbserial/setenv.sh | 47 + nuttx/configs/nucleus2g/usbstorage/Make.defs | 162 + nuttx/configs/nucleus2g/usbstorage/appconfig | 39 + nuttx/configs/nucleus2g/usbstorage/defconfig | 868 + nuttx/configs/nucleus2g/usbstorage/ld.script | 109 + nuttx/configs/nucleus2g/usbstorage/setenv.sh | 47 + nuttx/configs/olimex-lpc1766stk/README.txt | 893 + .../configs/olimex-lpc1766stk/ftpc/Make.defs | 165 + .../configs/olimex-lpc1766stk/ftpc/appconfig | 51 + .../configs/olimex-lpc1766stk/ftpc/defconfig | 1007 + .../configs/olimex-lpc1766stk/ftpc/ld.script | 109 + .../configs/olimex-lpc1766stk/ftpc/setenv.sh | 47 + .../olimex-lpc1766stk/hidkbd/Make.defs | 162 + .../olimex-lpc1766stk/hidkbd/appconfig | 39 + .../olimex-lpc1766stk/hidkbd/defconfig | 894 + .../olimex-lpc1766stk/hidkbd/ld.script | 109 + .../olimex-lpc1766stk/hidkbd/setenv.sh | 47 + .../configs/olimex-lpc1766stk/include/board.h | 327 + .../olimex-lpc1766stk/nettest/Make.defs | 162 + .../olimex-lpc1766stk/nettest/appconfig | 42 + .../olimex-lpc1766stk/nettest/defconfig | 847 + .../olimex-lpc1766stk/nettest/ld.script | 109 + .../olimex-lpc1766stk/nettest/setenv.sh | 47 + nuttx/configs/olimex-lpc1766stk/nsh/Make.defs | 162 + nuttx/configs/olimex-lpc1766stk/nsh/appconfig | 54 + nuttx/configs/olimex-lpc1766stk/nsh/defconfig | 910 + nuttx/configs/olimex-lpc1766stk/nsh/ld.script | 109 + nuttx/configs/olimex-lpc1766stk/nsh/setenv.sh | 47 + nuttx/configs/olimex-lpc1766stk/nx/Make.defs | 162 + nuttx/configs/olimex-lpc1766stk/nx/appconfig | 39 + nuttx/configs/olimex-lpc1766stk/nx/defconfig | 1090 + nuttx/configs/olimex-lpc1766stk/nx/ld.script | 109 + nuttx/configs/olimex-lpc1766stk/nx/setenv.sh | 47 + .../olimex-lpc1766stk/ostest/Make.defs | 162 + .../olimex-lpc1766stk/ostest/appconfig | 39 + .../olimex-lpc1766stk/ostest/defconfig | 883 + .../olimex-lpc1766stk/ostest/ld.script | 109 + .../olimex-lpc1766stk/ostest/setenv.sh | 47 + .../olimex-lpc1766stk/slip-httpd/Make.defs | 165 + .../olimex-lpc1766stk/slip-httpd/appconfig | 44 + .../olimex-lpc1766stk/slip-httpd/defconfig | 954 + .../olimex-lpc1766stk/slip-httpd/ld.script | 109 + .../olimex-lpc1766stk/slip-httpd/setenv.sh | 47 + nuttx/configs/olimex-lpc1766stk/src/Makefile | 93 + .../src/lpc1766stk_internal.h | 235 + nuttx/configs/olimex-lpc1766stk/src/up_boot.c | 93 + nuttx/configs/olimex-lpc1766stk/src/up_lcd.c | 265 + nuttx/configs/olimex-lpc1766stk/src/up_leds.c | 172 + nuttx/configs/olimex-lpc1766stk/src/up_nsh.c | 329 + nuttx/configs/olimex-lpc1766stk/src/up_ssp.c | 199 + .../olimex-lpc1766stk/src/up_usbstrg.c | 156 + .../olimex-lpc1766stk/thttpd/Make.defs | 165 + .../olimex-lpc1766stk/thttpd/appconfig | 43 + .../olimex-lpc1766stk/thttpd/defconfig | 946 + .../olimex-lpc1766stk/thttpd/ld.script | 109 + .../olimex-lpc1766stk/thttpd/setenv.sh | 47 + .../olimex-lpc1766stk/tools/olimex.cfg | 86 + nuttx/configs/olimex-lpc1766stk/tools/oocd.sh | 52 + .../olimex-lpc1766stk/usbserial/Make.defs | 162 + .../olimex-lpc1766stk/usbserial/appconfig | 39 + .../olimex-lpc1766stk/usbserial/defconfig | 883 + .../olimex-lpc1766stk/usbserial/ld.script | 109 + .../olimex-lpc1766stk/usbserial/setenv.sh | 47 + .../olimex-lpc1766stk/usbstorage/Make.defs | 162 + .../olimex-lpc1766stk/usbstorage/appconfig | 39 + .../olimex-lpc1766stk/usbstorage/defconfig | 883 + .../olimex-lpc1766stk/usbstorage/ld.script | 109 + .../olimex-lpc1766stk/usbstorage/setenv.sh | 47 + .../configs/olimex-lpc1766stk/wlan/Make.defs | 162 + .../configs/olimex-lpc1766stk/wlan/appconfig | 42 + .../configs/olimex-lpc1766stk/wlan/defconfig | 913 + .../configs/olimex-lpc1766stk/wlan/ld.script | 109 + .../configs/olimex-lpc1766stk/wlan/setenv.sh | 47 + nuttx/configs/olimex-lpc2378/README.txt | 11 + .../configs/olimex-lpc2378/include/README.txt | 1 + nuttx/configs/olimex-lpc2378/include/board.h | 90 + nuttx/configs/olimex-lpc2378/nsh/Make.defs | 179 + nuttx/configs/olimex-lpc2378/nsh/appconfig | 43 + nuttx/configs/olimex-lpc2378/nsh/defconfig | 443 + nuttx/configs/olimex-lpc2378/nsh/ld.script | 165 + nuttx/configs/olimex-lpc2378/nsh/setenv.sh | 52 + nuttx/configs/olimex-lpc2378/ostest/Make.defs | 179 + nuttx/configs/olimex-lpc2378/ostest/appconfig | 39 + nuttx/configs/olimex-lpc2378/ostest/defconfig | 443 + nuttx/configs/olimex-lpc2378/ostest/ld.script | 166 + nuttx/configs/olimex-lpc2378/ostest/setenv.sh | 52 + nuttx/configs/olimex-lpc2378/src/Makefile | 93 + nuttx/configs/olimex-lpc2378/src/up_leds.c | 141 + nuttx/configs/olimex-lpc2378/src/up_nsh.c | 114 + nuttx/configs/olimex-strp711/README.txt | 435 + .../configs/olimex-strp711/include/README.txt | 1 + nuttx/configs/olimex-strp711/include/board.h | 185 + .../configs/olimex-strp711/nettest/Make.defs | 160 + .../configs/olimex-strp711/nettest/appconfig | 43 + .../configs/olimex-strp711/nettest/defconfig | 760 + .../configs/olimex-strp711/nettest/ld.script | 122 + .../configs/olimex-strp711/nettest/setenv.sh | 47 + nuttx/configs/olimex-strp711/nsh/Make.defs | 160 + nuttx/configs/olimex-strp711/nsh/appconfig | 43 + nuttx/configs/olimex-strp711/nsh/defconfig | 694 + nuttx/configs/olimex-strp711/nsh/ld.script | 122 + nuttx/configs/olimex-strp711/nsh/setenv.sh | 47 + nuttx/configs/olimex-strp711/ostest/Make.defs | 160 + nuttx/configs/olimex-strp711/ostest/appconfig | 39 + nuttx/configs/olimex-strp711/ostest/defconfig | 695 + nuttx/configs/olimex-strp711/ostest/ld.script | 122 + nuttx/configs/olimex-strp711/ostest/setenv.sh | 47 + .../olimex-strp711/ostest/test-results.txt | 405 + .../configs/olimex-strp711/scripts/oocd-reset | 41 + nuttx/configs/olimex-strp711/scripts/oocd.sh | 79 + .../olimex-strp711/scripts/oocd_flash.script | 26 + .../olimex-strp711/scripts/oocd_ft2xx.cfg | 37 + .../olimex-strp711/scripts/oocd_wiggler.cfg | 46 + nuttx/configs/olimex-strp711/src/Makefile | 90 + nuttx/configs/olimex-strp711/src/README.txt | 2 + nuttx/configs/olimex-strp711/src/up_buttons.c | 130 + .../configs/olimex-strp711/src/up_enc28j60.c | 212 + nuttx/configs/olimex-strp711/src/up_leds.c | 218 + nuttx/configs/olimex-strp711/src/up_nsh.c | 167 + nuttx/configs/olimex-strp711/src/up_spi.c | 1121 + nuttx/configs/pcblogic-pic32mx/README.txt | 483 + .../configs/pcblogic-pic32mx/include/board.h | 124 + .../configs/pcblogic-pic32mx/ostest/Make.defs | 160 + .../configs/pcblogic-pic32mx/ostest/appconfig | 39 + .../configs/pcblogic-pic32mx/ostest/defconfig | 879 + .../configs/pcblogic-pic32mx/ostest/ld.script | 317 + .../configs/pcblogic-pic32mx/ostest/setenv.sh | 61 + nuttx/configs/pcblogic-pic32mx/src/Makefile | 88 + .../pcblogic-pic32mx/src/pcblogic-internal.h | 101 + nuttx/configs/pcblogic-pic32mx/src/up_boot.c | 93 + nuttx/configs/pcblogic-pic32mx/tools/Makefile | 51 + .../configs/pcblogic-pic32mx/tools/mkpichex.c | 299 + nuttx/configs/pic32-starterkit/README.txt | 662 + .../configs/pic32-starterkit/include/board.h | 146 + .../configs/pic32-starterkit/ostest/Make.defs | 160 + .../configs/pic32-starterkit/ostest/appconfig | 39 + .../configs/pic32-starterkit/ostest/defconfig | 910 + .../configs/pic32-starterkit/ostest/ld.script | 317 + .../configs/pic32-starterkit/ostest/setenv.sh | 61 + nuttx/configs/pic32-starterkit/src/Makefile | 92 + .../src/starterkit_internal.h | 122 + nuttx/configs/pic32-starterkit/src/up_boot.c | 94 + nuttx/configs/pic32-starterkit/src/up_leds.c | 134 + nuttx/configs/pic32-starterkit/src/up_nsh.c | 322 + nuttx/configs/pic32-starterkit/src/up_spi.c | 223 + nuttx/configs/pic32-starterkit/tools/Makefile | 51 + .../configs/pic32-starterkit/tools/mkpichex.c | 299 + nuttx/configs/pjrc-8051/Make.defs | 97 + nuttx/configs/pjrc-8051/README.txt | 37 + nuttx/configs/pjrc-8051/appconfig | 39 + nuttx/configs/pjrc-8051/defconfig | 385 + nuttx/configs/pjrc-8051/include/README.txt | 1 + nuttx/configs/pjrc-8051/include/board.h | 51 + nuttx/configs/pjrc-8051/include/pjrc.h | 215 + nuttx/configs/pjrc-8051/sdcc-2.6.0.patch | 28 + nuttx/configs/pjrc-8051/setenv.sh | 45 + nuttx/configs/pjrc-8051/src/Makefile | 76 + nuttx/configs/pjrc-8051/src/README.txt | 1 + nuttx/configs/pjrc-8051/src/up_leds.c | 207 + nuttx/configs/qemu-i486/README.txt | 166 + nuttx/configs/qemu-i486/include/README.txt | 1 + nuttx/configs/qemu-i486/include/board.h | 101 + nuttx/configs/qemu-i486/nsh/Make.defs | 134 + nuttx/configs/qemu-i486/nsh/appconfig | 43 + nuttx/configs/qemu-i486/nsh/defconfig | 537 + nuttx/configs/qemu-i486/nsh/ld.script | 91 + nuttx/configs/qemu-i486/nsh/setenv.sh | 48 + nuttx/configs/qemu-i486/ostest/Make.defs | 134 + nuttx/configs/qemu-i486/ostest/appconfig | 39 + nuttx/configs/qemu-i486/ostest/defconfig | 406 + nuttx/configs/qemu-i486/ostest/ld.script | 91 + nuttx/configs/qemu-i486/ostest/setenv.sh | 48 + nuttx/configs/qemu-i486/src/Makefile | 83 + nuttx/configs/qemu-i486/src/README.txt | 1 + .../configs/qemu-i486/src/qemui486_internal.h | 69 + nuttx/configs/qemu-i486/src/up_boot.c | 82 + nuttx/configs/rgmp/README.txt | 93 + nuttx/configs/rgmp/arm/default/Make.defs | 117 + nuttx/configs/rgmp/arm/default/appconfig | 39 + nuttx/configs/rgmp/arm/default/defconfig | 403 + nuttx/configs/rgmp/arm/default/setenv.sh | 47 + nuttx/configs/rgmp/arm/nsh/Make.defs | 117 + nuttx/configs/rgmp/arm/nsh/appconfig | 54 + nuttx/configs/rgmp/arm/nsh/defconfig | 433 + nuttx/configs/rgmp/arm/nsh/setenv.sh | 47 + nuttx/configs/rgmp/include/README.txt | 1 + nuttx/configs/rgmp/include/stdarg.h | 8 + nuttx/configs/rgmp/src/README.txt | 1 + nuttx/configs/rgmp/x86/default/Make.defs | 116 + nuttx/configs/rgmp/x86/default/appconfig | 39 + nuttx/configs/rgmp/x86/default/defconfig | 417 + nuttx/configs/rgmp/x86/default/setenv.sh | 47 + nuttx/configs/rgmp/x86/nsh/Make.defs | 116 + nuttx/configs/rgmp/x86/nsh/appconfig | 54 + nuttx/configs/rgmp/x86/nsh/defconfig | 447 + nuttx/configs/rgmp/x86/nsh/setenv.sh | 47 + nuttx/configs/sam3u-ek/README.txt | 372 + nuttx/configs/sam3u-ek/include/board.h | 206 + nuttx/configs/sam3u-ek/kernel/Makefile | 136 + nuttx/configs/sam3u-ek/kernel/kernel.ld | 147 + nuttx/configs/sam3u-ek/knsh/Make.defs | 162 + nuttx/configs/sam3u-ek/knsh/appconfig | 43 + nuttx/configs/sam3u-ek/knsh/defconfig | 894 + nuttx/configs/sam3u-ek/knsh/ld.script | 127 + nuttx/configs/sam3u-ek/knsh/setenv.sh | 46 + nuttx/configs/sam3u-ek/nsh/Make.defs | 162 + nuttx/configs/sam3u-ek/nsh/appconfig | 43 + nuttx/configs/sam3u-ek/nsh/defconfig | 864 + nuttx/configs/sam3u-ek/nsh/ld.script | 111 + nuttx/configs/sam3u-ek/nsh/setenv.sh | 46 + nuttx/configs/sam3u-ek/nx/Make.defs | 162 + nuttx/configs/sam3u-ek/nx/appconfig | 39 + nuttx/configs/sam3u-ek/nx/defconfig | 914 + nuttx/configs/sam3u-ek/nx/ld.script | 111 + nuttx/configs/sam3u-ek/nx/setenv.sh | 46 + nuttx/configs/sam3u-ek/ostest/Make.defs | 162 + nuttx/configs/sam3u-ek/ostest/appconfig | 39 + nuttx/configs/sam3u-ek/ostest/defconfig | 862 + nuttx/configs/sam3u-ek/ostest/ld.script | 111 + nuttx/configs/sam3u-ek/ostest/setenv.sh | 46 + nuttx/configs/sam3u-ek/src/Makefile | 96 + nuttx/configs/sam3u-ek/src/sam3uek_internal.h | 257 + nuttx/configs/sam3u-ek/src/up_boot.c | 113 + nuttx/configs/sam3u-ek/src/up_buttons.c | 185 + nuttx/configs/sam3u-ek/src/up_lcd.c | 1069 + nuttx/configs/sam3u-ek/src/up_leds.c | 197 + nuttx/configs/sam3u-ek/src/up_mmcsd.c | 139 + nuttx/configs/sam3u-ek/src/up_nsh.c | 164 + nuttx/configs/sam3u-ek/src/up_spi.c | 243 + nuttx/configs/sam3u-ek/src/up_touchscreen.c | 272 + nuttx/configs/sam3u-ek/src/up_usbdev.c | 111 + nuttx/configs/sam3u-ek/src/up_usbstrg.c | 152 + nuttx/configs/sam3u-ek/touchscreen/Make.defs | 162 + nuttx/configs/sam3u-ek/touchscreen/appconfig | 48 + nuttx/configs/sam3u-ek/touchscreen/defconfig | 1101 + nuttx/configs/sam3u-ek/touchscreen/ld.script | 111 + nuttx/configs/sam3u-ek/touchscreen/setenv.sh | 47 + nuttx/configs/sim/README.txt | 400 + nuttx/configs/sim/doc/test-results.txt | 2914 +++ nuttx/configs/sim/include/README.txt | 1 + nuttx/configs/sim/mount/Make.defs | 121 + nuttx/configs/sim/mount/appconfig | 39 + nuttx/configs/sim/mount/defconfig | 389 + nuttx/configs/sim/mount/setenv.sh | 45 + nuttx/configs/sim/nettest/Make.defs | 121 + nuttx/configs/sim/nettest/appconfig | 43 + nuttx/configs/sim/nettest/defconfig | 388 + nuttx/configs/sim/nettest/setenv.sh | 45 + nuttx/configs/sim/nsh/Make.defs | 121 + nuttx/configs/sim/nsh/appconfig | 43 + nuttx/configs/sim/nsh/defconfig | 476 + nuttx/configs/sim/nsh/setenv.sh | 45 + nuttx/configs/sim/nsh2/Make.defs | 122 + nuttx/configs/sim/nsh2/appconfig | 49 + nuttx/configs/sim/nsh2/defconfig | 801 + nuttx/configs/sim/nsh2/setenv.sh | 45 + nuttx/configs/sim/nx/Make.defs | 121 + nuttx/configs/sim/nx/appconfig | 39 + nuttx/configs/sim/nx/defconfig | 607 + nuttx/configs/sim/nx/setenv.sh | 45 + nuttx/configs/sim/nx11/Make.defs | 121 + nuttx/configs/sim/nx11/appconfig | 39 + nuttx/configs/sim/nx11/defconfig | 572 + nuttx/configs/sim/nx11/setenv.sh | 45 + nuttx/configs/sim/nxffs/Make.defs | 121 + nuttx/configs/sim/nxffs/appconfig | 39 + nuttx/configs/sim/nxffs/defconfig | 398 + nuttx/configs/sim/nxffs/setenv.sh | 45 + nuttx/configs/sim/ostest/Make.defs | 121 + nuttx/configs/sim/ostest/appconfig | 39 + nuttx/configs/sim/ostest/defconfig | 382 + nuttx/configs/sim/ostest/setenv.sh | 45 + nuttx/configs/sim/pashello/Make.defs | 122 + nuttx/configs/sim/pashello/appconfig | 42 + nuttx/configs/sim/pashello/defconfig | 377 + nuttx/configs/sim/pashello/setenv.sh | 45 + nuttx/configs/sim/src/Makefile | 83 + nuttx/configs/sim/src/README.txt | 1 + nuttx/configs/sim/src/up_touchscreen.c | 182 + nuttx/configs/sim/touchscreen/Make.defs | 121 + nuttx/configs/sim/touchscreen/appconfig | 39 + nuttx/configs/sim/touchscreen/defconfig | 601 + nuttx/configs/sim/touchscreen/setenv.sh | 45 + nuttx/configs/skp16c26/README.txt | 116 + nuttx/configs/skp16c26/include/README.txt | 2 + nuttx/configs/skp16c26/include/board.h | 138 + nuttx/configs/skp16c26/ostest/Make.defs | 106 + nuttx/configs/skp16c26/ostest/appconfig | 39 + nuttx/configs/skp16c26/ostest/defconfig | 570 + nuttx/configs/skp16c26/ostest/ld.script | 139 + nuttx/configs/skp16c26/ostest/setenv.sh | 46 + nuttx/configs/skp16c26/src/Makefile | 77 + nuttx/configs/skp16c26/src/README.txt | 2 + .../configs/skp16c26/src/skp16c26_internal.h | 67 + nuttx/configs/skp16c26/src/up_buttons.c | 111 + nuttx/configs/skp16c26/src/up_lcd.c | 282 + nuttx/configs/skp16c26/src/up_lcdconsole.c | 141 + nuttx/configs/skp16c26/src/up_leds.c | 245 + nuttx/configs/stm3210e-eval/README.txt | 797 + nuttx/configs/stm3210e-eval/RIDE/Make.defs | 174 + nuttx/configs/stm3210e-eval/RIDE/README.txt | 38 + nuttx/configs/stm3210e-eval/RIDE/appconfig | 39 + nuttx/configs/stm3210e-eval/RIDE/bigfatstub.c | 31 + nuttx/configs/stm3210e-eval/RIDE/defconfig | 870 + nuttx/configs/stm3210e-eval/RIDE/nuttx.ctx | 40 + nuttx/configs/stm3210e-eval/RIDE/nuttx.dbi | 23 + nuttx/configs/stm3210e-eval/RIDE/nuttx.elf.ld | 19 + nuttx/configs/stm3210e-eval/RIDE/nuttx.rapp | 83 + nuttx/configs/stm3210e-eval/RIDE/nuttx.rdb | Bin 0 -> 116736 bytes nuttx/configs/stm3210e-eval/RIDE/nuttx.rprj | 4 + nuttx/configs/stm3210e-eval/RIDE/setenv.sh | 47 + nuttx/configs/stm3210e-eval/RIDE/stm32-ld.sh | 18 + .../configs/stm3210e-eval/RIDE/stm32-nuttx.ld | 111 + nuttx/configs/stm3210e-eval/buttons/Make.defs | 174 + nuttx/configs/stm3210e-eval/buttons/appconfig | 39 + nuttx/configs/stm3210e-eval/buttons/defconfig | 905 + nuttx/configs/stm3210e-eval/buttons/ld.script | 112 + .../stm3210e-eval/buttons/ld.script.dfu | 111 + nuttx/configs/stm3210e-eval/buttons/setenv.sh | 47 + .../configs/stm3210e-eval/include/README.txt | 1 + nuttx/configs/stm3210e-eval/include/board.h | 300 + nuttx/configs/stm3210e-eval/nsh/Make.defs | 174 + nuttx/configs/stm3210e-eval/nsh/appconfig | 41 + nuttx/configs/stm3210e-eval/nsh/defconfig | 890 + nuttx/configs/stm3210e-eval/nsh/ld.script | 112 + nuttx/configs/stm3210e-eval/nsh/ld.script.dfu | 111 + nuttx/configs/stm3210e-eval/nsh/setenv.sh | 47 + nuttx/configs/stm3210e-eval/nsh2/Make.defs | 174 + nuttx/configs/stm3210e-eval/nsh2/appconfig | 50 + nuttx/configs/stm3210e-eval/nsh2/defconfig | 1298 ++ nuttx/configs/stm3210e-eval/nsh2/ld.script | 112 + .../configs/stm3210e-eval/nsh2/ld.script.dfu | 111 + nuttx/configs/stm3210e-eval/nsh2/setenv.sh | 67 + nuttx/configs/stm3210e-eval/nx/Make.defs | 174 + nuttx/configs/stm3210e-eval/nx/appconfig | 39 + nuttx/configs/stm3210e-eval/nx/defconfig | 1185 + nuttx/configs/stm3210e-eval/nx/ld.script | 112 + nuttx/configs/stm3210e-eval/nx/ld.script.dfu | 111 + nuttx/configs/stm3210e-eval/nx/setenv.sh | 62 + nuttx/configs/stm3210e-eval/nxlines/Make.defs | 176 + nuttx/configs/stm3210e-eval/nxlines/appconfig | 39 + nuttx/configs/stm3210e-eval/nxlines/defconfig | 1257 ++ nuttx/configs/stm3210e-eval/nxlines/ld.script | 112 + .../stm3210e-eval/nxlines/ld.script.dfu | 111 + nuttx/configs/stm3210e-eval/nxlines/setenv.sh | 53 + nuttx/configs/stm3210e-eval/nxtext/Make.defs | 176 + nuttx/configs/stm3210e-eval/nxtext/appconfig | 39 + nuttx/configs/stm3210e-eval/nxtext/defconfig | 1257 ++ nuttx/configs/stm3210e-eval/nxtext/ld.script | 112 + .../stm3210e-eval/nxtext/ld.script.dfu | 111 + nuttx/configs/stm3210e-eval/nxtext/setenv.sh | 62 + nuttx/configs/stm3210e-eval/ostest/Make.defs | 174 + nuttx/configs/stm3210e-eval/ostest/appconfig | 39 + nuttx/configs/stm3210e-eval/ostest/defconfig | 880 + nuttx/configs/stm3210e-eval/ostest/ld.script | 112 + .../stm3210e-eval/ostest/ld.script.dfu | 111 + nuttx/configs/stm3210e-eval/ostest/setenv.sh | 47 + nuttx/configs/stm3210e-eval/src/Makefile | 107 + nuttx/configs/stm3210e-eval/src/README.txt | 1 + .../stm3210e-eval/src/stm3210e-internal.h | 291 + nuttx/configs/stm3210e-eval/src/up_adc.c | 140 + nuttx/configs/stm3210e-eval/src/up_boot.c | 102 + nuttx/configs/stm3210e-eval/src/up_buttons.c | 170 + .../stm3210e-eval/src/up_deselectlcd.c | 97 + .../stm3210e-eval/src/up_deselectnor.c | 95 + .../stm3210e-eval/src/up_deselectsram.c | 97 + .../configs/stm3210e-eval/src/up_extcontext.c | 117 + nuttx/configs/stm3210e-eval/src/up_extmem.c | 191 + nuttx/configs/stm3210e-eval/src/up_lcd.c | 1569 ++ nuttx/configs/stm3210e-eval/src/up_leds.c | 259 + nuttx/configs/stm3210e-eval/src/up_lm75.c | 128 + nuttx/configs/stm3210e-eval/src/up_nsh.c | 213 + .../configs/stm3210e-eval/src/up_selectlcd.c | 146 + .../configs/stm3210e-eval/src/up_selectnor.c | 140 + .../configs/stm3210e-eval/src/up_selectsram.c | 146 + nuttx/configs/stm3210e-eval/src/up_spi.c | 178 + nuttx/configs/stm3210e-eval/src/up_usbdev.c | 116 + nuttx/configs/stm3210e-eval/src/up_usbstrg.c | 164 + .../tools/olimex-arm-usb-ocd.cfg | 13 + nuttx/configs/stm3210e-eval/tools/oocd.sh | 90 + nuttx/configs/stm3210e-eval/tools/stm32.cfg | 69 + .../configs/stm3210e-eval/usbserial/Make.defs | 174 + .../configs/stm3210e-eval/usbserial/appconfig | 39 + .../configs/stm3210e-eval/usbserial/defconfig | 977 + .../configs/stm3210e-eval/usbserial/ld.script | 112 + .../stm3210e-eval/usbserial/ld.script.dfu | 111 + .../configs/stm3210e-eval/usbserial/setenv.sh | 47 + .../stm3210e-eval/usbstorage/Make.defs | 174 + .../stm3210e-eval/usbstorage/appconfig | 39 + .../stm3210e-eval/usbstorage/defconfig | 952 + .../stm3210e-eval/usbstorage/ld.script | 112 + .../stm3210e-eval/usbstorage/ld.script.dfu | 111 + .../stm3210e-eval/usbstorage/setenv.sh | 47 + nuttx/configs/stm3240g-eval/README.txt | 523 + nuttx/configs/stm3240g-eval/dhcpd/Make.defs | 170 + nuttx/configs/stm3240g-eval/dhcpd/appconfig | 43 + nuttx/configs/stm3240g-eval/dhcpd/defconfig | 1208 ++ nuttx/configs/stm3240g-eval/dhcpd/ld.script | 116 + nuttx/configs/stm3240g-eval/dhcpd/setenv.sh | 67 + nuttx/configs/stm3240g-eval/include/board.h | 332 + nuttx/configs/stm3240g-eval/nettest/Make.defs | 170 + nuttx/configs/stm3240g-eval/nettest/appconfig | 42 + nuttx/configs/stm3240g-eval/nettest/defconfig | 1201 ++ nuttx/configs/stm3240g-eval/nettest/ld.script | 116 + nuttx/configs/stm3240g-eval/nettest/setenv.sh | 67 + nuttx/configs/stm3240g-eval/nsh/Make.defs | 170 + nuttx/configs/stm3240g-eval/nsh/appconfig | 53 + nuttx/configs/stm3240g-eval/nsh/defconfig | 1205 ++ nuttx/configs/stm3240g-eval/nsh/ld.script | 116 + nuttx/configs/stm3240g-eval/nsh/setenv.sh | 67 + nuttx/configs/stm3240g-eval/ostest/Make.defs | 170 + nuttx/configs/stm3240g-eval/ostest/appconfig | 39 + nuttx/configs/stm3240g-eval/ostest/defconfig | 1452 ++ nuttx/configs/stm3240g-eval/ostest/ld.script | 116 + nuttx/configs/stm3240g-eval/ostest/setenv.sh | 67 + nuttx/configs/stm3240g-eval/src/Makefile | 89 + .../stm3240g-eval/src/stm3240g-internal.h | 128 + nuttx/configs/stm3240g-eval/src/up_adc.c | 111 + nuttx/configs/stm3240g-eval/src/up_boot.c | 90 + nuttx/configs/stm3240g-eval/src/up_buttons.c | 170 + nuttx/configs/stm3240g-eval/src/up_leds.c | 259 + nuttx/configs/stm3240g-eval/src/up_spi.c | 161 + nuttx/configs/sure-pic32mx/README.txt | 433 + nuttx/configs/sure-pic32mx/include/board.h | 201 + nuttx/configs/sure-pic32mx/ostest/Make.defs | 160 + nuttx/configs/sure-pic32mx/ostest/appconfig | 39 + nuttx/configs/sure-pic32mx/ostest/defconfig | 878 + nuttx/configs/sure-pic32mx/ostest/ld.script | 317 + nuttx/configs/sure-pic32mx/ostest/setenv.sh | 61 + nuttx/configs/sure-pic32mx/src/Makefile | 96 + .../configs/sure-pic32mx/src/sure-internal.h | 110 + nuttx/configs/sure-pic32mx/src/up_boot.c | 93 + nuttx/configs/sure-pic32mx/src/up_buttons.c | 210 + nuttx/configs/sure-pic32mx/src/up_leds.c | 218 + nuttx/configs/sure-pic32mx/src/up_nsh.c | 322 + nuttx/configs/sure-pic32mx/src/up_spi.c | 144 + nuttx/configs/sure-pic32mx/tools/Makefile | 51 + nuttx/configs/sure-pic32mx/tools/mkpichex.c | 299 + nuttx/configs/teensy/README.txt | 548 + nuttx/configs/teensy/hello/Make.defs | 149 + nuttx/configs/teensy/hello/appconfig | 39 + nuttx/configs/teensy/hello/defconfig | 815 + nuttx/configs/teensy/hello/ld.script | 210 + nuttx/configs/teensy/hello/setenv.sh | 63 + nuttx/configs/teensy/include/board.h | 99 + nuttx/configs/teensy/nsh/Make.defs | 149 + nuttx/configs/teensy/nsh/appconfig | 54 + nuttx/configs/teensy/nsh/defconfig | 799 + nuttx/configs/teensy/nsh/ld.script | 210 + nuttx/configs/teensy/nsh/setenv.sh | 63 + nuttx/configs/teensy/src/Makefile | 103 + nuttx/configs/teensy/src/teensy_internal.h | 101 + nuttx/configs/teensy/src/up_boot.c | 93 + nuttx/configs/teensy/src/up_leds.c | 194 + nuttx/configs/teensy/src/up_spi.c | 202 + nuttx/configs/teensy/src/up_usbstrg.c | 137 + nuttx/configs/teensy/usbstorage/Make.defs | 149 + nuttx/configs/teensy/usbstorage/appconfig | 39 + nuttx/configs/teensy/usbstorage/defconfig | 847 + nuttx/configs/teensy/usbstorage/ld.script | 210 + nuttx/configs/teensy/usbstorage/setenv.sh | 63 + nuttx/configs/twr-k60n512/README.txt | 644 + nuttx/configs/twr-k60n512/include/board.h | 438 + nuttx/configs/twr-k60n512/nsh/Make.defs | 162 + nuttx/configs/twr-k60n512/nsh/appconfig | 41 + nuttx/configs/twr-k60n512/nsh/defconfig | 927 + nuttx/configs/twr-k60n512/nsh/ld.script | 135 + nuttx/configs/twr-k60n512/nsh/setenv.sh | 61 + nuttx/configs/twr-k60n512/ostest/Make.defs | 162 + nuttx/configs/twr-k60n512/ostest/appconfig | 39 + nuttx/configs/twr-k60n512/ostest/defconfig | 921 + nuttx/configs/twr-k60n512/ostest/ld.script | 135 + nuttx/configs/twr-k60n512/ostest/setenv.sh | 61 + nuttx/configs/twr-k60n512/src/Makefile | 105 + .../configs/twr-k60n512/src/twrk60-internal.h | 309 + nuttx/configs/twr-k60n512/src/up_boot.c | 102 + nuttx/configs/twr-k60n512/src/up_buttons.c | 168 + nuttx/configs/twr-k60n512/src/up_leds.c | 263 + nuttx/configs/twr-k60n512/src/up_nsh.c | 267 + nuttx/configs/twr-k60n512/src/up_spi.c | 164 + nuttx/configs/twr-k60n512/src/up_usbdev.c | 115 + nuttx/configs/twr-k60n512/src/up_usbstrg.c | 118 + nuttx/configs/us7032evb1/README.txt | 138 + nuttx/configs/us7032evb1/bin/README.txt | 2 + nuttx/configs/us7032evb1/include/README.txt | 2 + nuttx/configs/us7032evb1/include/board.h | 100 + nuttx/configs/us7032evb1/nsh/Make.defs | 104 + nuttx/configs/us7032evb1/nsh/appconfig | 43 + nuttx/configs/us7032evb1/nsh/defconfig | 610 + nuttx/configs/us7032evb1/nsh/ld.script | 91 + nuttx/configs/us7032evb1/nsh/setenv.sh | 47 + nuttx/configs/us7032evb1/ostest/Make.defs | 104 + nuttx/configs/us7032evb1/ostest/appconfig | 39 + nuttx/configs/us7032evb1/ostest/defconfig | 610 + nuttx/configs/us7032evb1/ostest/ld.script | 91 + nuttx/configs/us7032evb1/ostest/setenv.sh | 47 + nuttx/configs/us7032evb1/shterm/Makefile | 51 + nuttx/configs/us7032evb1/shterm/shterm.c | 737 + nuttx/configs/us7032evb1/src/Makefile | 77 + nuttx/configs/us7032evb1/src/README.txt | 3 + nuttx/configs/us7032evb1/src/up_leds.c | 135 + nuttx/configs/vsn/README.txt | 261 + nuttx/configs/vsn/include/board.h | 221 + nuttx/configs/vsn/include/muxbus.h | 84 + nuttx/configs/vsn/include/nsh_romfsimg.h | 89 + nuttx/configs/vsn/include/power.h | 72 + nuttx/configs/vsn/include/rcS.template | 14 + nuttx/configs/vsn/nsh/Make.defs | 178 + nuttx/configs/vsn/nsh/appconfig | 82 + nuttx/configs/vsn/nsh/defconfig | 896 + nuttx/configs/vsn/nsh/ld.script | 111 + nuttx/configs/vsn/nsh/ld.script.dfu | 110 + nuttx/configs/vsn/nsh/setenv.sh | 46 + nuttx/configs/vsn/src/Makefile | 111 + nuttx/configs/vsn/src/README.txt | 58 + nuttx/configs/vsn/src/boot.c | 90 + nuttx/configs/vsn/src/buttons.c | 88 + nuttx/configs/vsn/src/chipcon.c | 83 + nuttx/configs/vsn/src/leds.c | 120 + nuttx/configs/vsn/src/muxbus.c | 198 + nuttx/configs/vsn/src/power.c | 108 + nuttx/configs/vsn/src/rtac.c | 106 + nuttx/configs/vsn/src/sif.c | 721 + nuttx/configs/vsn/src/spi.c | 193 + nuttx/configs/vsn/src/sysclock.c | 194 + nuttx/configs/vsn/src/usbdev.c | 123 + nuttx/configs/vsn/src/usbstrg.c | 156 + nuttx/configs/vsn/src/vsn.h | 239 + nuttx/configs/xtrs/README.txt | 126 + nuttx/configs/xtrs/include/README.txt | 1 + nuttx/configs/xtrs/include/board.h | 71 + nuttx/configs/xtrs/include/trs80-m3.h | 185 + nuttx/configs/xtrs/nsh/Make.defs | 99 + nuttx/configs/xtrs/nsh/appconfig | 43 + nuttx/configs/xtrs/nsh/defconfig | 424 + nuttx/configs/xtrs/nsh/setenv.sh | 45 + nuttx/configs/xtrs/ostest/Make.defs | 99 + nuttx/configs/xtrs/ostest/appconfig | 39 + nuttx/configs/xtrs/ostest/defconfig | 381 + nuttx/configs/xtrs/ostest/setenv.sh | 45 + nuttx/configs/xtrs/pashello/Make.defs | 99 + nuttx/configs/xtrs/pashello/appconfig | 43 + nuttx/configs/xtrs/pashello/defconfig | 381 + nuttx/configs/xtrs/pashello/setenv.sh | 45 + .../xtrs/sdcc-2.6.0-asz80-symlen.patch | 11 + nuttx/configs/xtrs/src/Make.defs | 37 + nuttx/configs/xtrs/src/Makefile | 77 + nuttx/configs/xtrs/src/README.txt | 1 + nuttx/configs/xtrs/src/xtr_irq.c | 116 + nuttx/configs/xtrs/src/xtr_lowputc.c | 105 + nuttx/configs/xtrs/src/xtr_serial.c | 411 + nuttx/configs/xtrs/src/xtr_timerisr.c | 94 + nuttx/configs/xtrs/src/xtrs_head.asm | 276 + nuttx/configs/z16f2800100zcog/README.txt | 90 + nuttx/configs/z16f2800100zcog/include/board.h | 84 + .../configs/z16f2800100zcog/ostest/Make.defs | 171 + .../configs/z16f2800100zcog/ostest/README.txt | 12 + .../configs/z16f2800100zcog/ostest/appconfig | 39 + .../configs/z16f2800100zcog/ostest/defconfig | 409 + .../z16f2800100zcog/ostest/ostest.linkcmd | 92 + .../z16f2800100zcog/ostest/ostest.zfpproj | 238 + .../configs/z16f2800100zcog/ostest/setenv.sh | 51 + .../z16f2800100zcog/ostest/test-result.txt | 529 + .../z16f2800100zcog/pashello/Make.defs | 171 + .../z16f2800100zcog/pashello/README.txt | 12 + .../z16f2800100zcog/pashello/appconfig | 42 + .../z16f2800100zcog/pashello/defconfig | 409 + .../z16f2800100zcog/pashello/pashello.linkcmd | 92 + .../z16f2800100zcog/pashello/pashello.zfpproj | 238 + .../z16f2800100zcog/pashello/setenv.sh | 51 + nuttx/configs/z16f2800100zcog/src/Makefile | 84 + nuttx/configs/z16f2800100zcog/src/z16f_leds.c | 105 + .../z16f2800100zcog/src/z16f_lowinit.c | 90 + nuttx/configs/z80sim/README.txt | 104 + nuttx/configs/z80sim/include/README.txt | 1 + nuttx/configs/z80sim/include/board.h | 66 + nuttx/configs/z80sim/nsh/Make.defs | 99 + nuttx/configs/z80sim/nsh/appconfig | 43 + nuttx/configs/z80sim/nsh/defconfig | 414 + nuttx/configs/z80sim/nsh/setenv.sh | 45 + nuttx/configs/z80sim/ostest/Make.defs | 99 + nuttx/configs/z80sim/ostest/appconfig | 39 + nuttx/configs/z80sim/ostest/defconfig | 371 + nuttx/configs/z80sim/ostest/setenv.sh | 45 + nuttx/configs/z80sim/pashello/Make.defs | 99 + nuttx/configs/z80sim/pashello/appconfig | 43 + nuttx/configs/z80sim/pashello/defconfig | 371 + nuttx/configs/z80sim/pashello/setenv.sh | 45 + .../z80sim/sdcc-2.6.0-asz80-symlen.patch | 11 + nuttx/configs/z80sim/src/Makefile | 76 + nuttx/configs/z80sim/src/README.txt | 1 + nuttx/configs/z80sim/src/z80_irq.c | 116 + nuttx/configs/z80sim/src/z80_lowputc.c | 103 + nuttx/configs/z80sim/src/z80_serial.c | 361 + nuttx/configs/z80sim/src/z80_timerisr.c | 95 + nuttx/configs/z8encore000zco/README.txt | 60 + nuttx/configs/z8encore000zco/include/board.h | 76 + nuttx/configs/z8encore000zco/ostest/Make.defs | 197 + .../configs/z8encore000zco/ostest/README.txt | 12 + nuttx/configs/z8encore000zco/ostest/appconfig | 39 + nuttx/configs/z8encore000zco/ostest/defconfig | 410 + .../z8encore000zco/ostest/ostest.linkcmd | 80 + .../z8encore000zco/ostest/ostest.zdsproj | 291 + nuttx/configs/z8encore000zco/ostest/setenv.sh | 52 + .../z8encore000zco/ostest/test-result.txt | 529 + nuttx/configs/z8encore000zco/src/Makefile | 84 + nuttx/configs/z8encore000zco/src/z8_leds.c | 243 + nuttx/configs/z8encore000zco/src/z8_lowinit.c | 66 + nuttx/configs/z8f64200100kit/README.txt | 60 + nuttx/configs/z8f64200100kit/include/board.h | 76 + nuttx/configs/z8f64200100kit/ostest/Make.defs | 197 + .../configs/z8f64200100kit/ostest/README.txt | 12 + nuttx/configs/z8f64200100kit/ostest/appconfig | 39 + nuttx/configs/z8f64200100kit/ostest/defconfig | 410 + .../z8f64200100kit/ostest/ostest.linkcmd | 80 + .../z8f64200100kit/ostest/ostest.zdsproj | 291 + nuttx/configs/z8f64200100kit/ostest/setenv.sh | 52 + .../z8f64200100kit/ostest/test-result.txt | 529 + nuttx/configs/z8f64200100kit/src/Makefile | 84 + nuttx/configs/z8f64200100kit/src/z8_leds.c | 89 + nuttx/configs/z8f64200100kit/src/z8_lowinit.c | 66 + nuttx/drivers/Makefile | 110 + nuttx/drivers/README.txt | 117 + nuttx/drivers/analog/Make.defs | 81 + nuttx/drivers/analog/ad5410.c | 206 + nuttx/drivers/analog/adc.c | 420 + nuttx/drivers/analog/ads1255.c | 335 + nuttx/drivers/analog/dac.c | 499 + nuttx/drivers/bch/Make.defs | 52 + nuttx/drivers/bch/bch_internal.h | 102 + nuttx/drivers/bch/bchdev_driver.c | 255 + nuttx/drivers/bch/bchdev_register.c | 103 + nuttx/drivers/bch/bchdev_unregister.c | 158 + nuttx/drivers/bch/bchlib_cache.c | 133 + nuttx/drivers/bch/bchlib_read.c | 203 + nuttx/drivers/bch/bchlib_sem.c | 84 + nuttx/drivers/bch/bchlib_setup.c | 159 + nuttx/drivers/bch/bchlib_teardown.c | 113 + nuttx/drivers/bch/bchlib_write.c | 216 + nuttx/drivers/can.c | 770 + nuttx/drivers/dev_null.c | 134 + nuttx/drivers/dev_zero.c | 127 + nuttx/drivers/input/Make.defs | 56 + nuttx/drivers/input/ads7843e.c | 1171 + nuttx/drivers/input/ads7843e.h | 170 + nuttx/drivers/input/tsc2007.c | 1310 ++ nuttx/drivers/input/tsc2007.h | 120 + nuttx/drivers/lcd/Make.defs | 60 + nuttx/drivers/lcd/nokia6100.c | 1230 ++ nuttx/drivers/lcd/p14201.c | 1244 ++ nuttx/drivers/lcd/pcf8833.h | 152 + nuttx/drivers/lcd/s1d15g10.h | 141 + nuttx/drivers/lcd/sd1329.h | 527 + nuttx/drivers/lcd/skeleton.c | 401 + nuttx/drivers/lcd/ssd1305.h | 211 + nuttx/drivers/lcd/ug-9664hswag01.c | 1049 + nuttx/drivers/loop.c | 506 + nuttx/drivers/mmcsd/Make.defs | 46 + nuttx/drivers/mmcsd/mmcsd_csd.h | 424 + nuttx/drivers/mmcsd/mmcsd_debug.c | 183 + nuttx/drivers/mmcsd/mmcsd_internal.h | 105 + nuttx/drivers/mmcsd/mmcsd_sdio.c | 3062 +++ nuttx/drivers/mmcsd/mmcsd_sdio.h | 339 + nuttx/drivers/mmcsd/mmcsd_spi.c | 1878 ++ nuttx/drivers/mmcsd/mmcsd_spi.h | 187 + nuttx/drivers/mtd/Make.defs | 49 + nuttx/drivers/mtd/at24xx.c | 429 + nuttx/drivers/mtd/at45db.c | 899 + nuttx/drivers/mtd/flash_eraseall.c | 117 + nuttx/drivers/mtd/ftl.c | 578 + nuttx/drivers/mtd/m25px.c | 710 + nuttx/drivers/mtd/rammtd.c | 417 + nuttx/drivers/mtd/ramtron.c | 674 + nuttx/drivers/mtd/skeleton.c | 275 + nuttx/drivers/net/Make.defs | 71 + nuttx/drivers/net/cs89x0.c | 959 + nuttx/drivers/net/cs89x0.h | 326 + nuttx/drivers/net/dm90x0.c | 1815 ++ nuttx/drivers/net/e1000.c | 1049 + nuttx/drivers/net/e1000.h | 123 + nuttx/drivers/net/enc28j60.c | 2221 ++ nuttx/drivers/net/enc28j60.h | 478 + nuttx/drivers/net/skeleton.c | 692 + nuttx/drivers/net/slip.c | 1017 + nuttx/drivers/net/vnet.c | 673 + nuttx/drivers/pipes/Make.defs | 46 + nuttx/drivers/pipes/fifo.c | 136 + nuttx/drivers/pipes/pipe.c | 282 + nuttx/drivers/pipes/pipe_common.c | 679 + nuttx/drivers/pipes/pipe_common.h | 139 + nuttx/drivers/pm/Make.defs | 50 + nuttx/drivers/pm/pm_activity.c | 166 + nuttx/drivers/pm/pm_changestate.c | 223 + nuttx/drivers/pm/pm_checkstate.c | 161 + nuttx/drivers/pm/pm_initialize.c | 112 + nuttx/drivers/pm/pm_internal.h | 210 + nuttx/drivers/pm/pm_register.c | 112 + nuttx/drivers/pm/pm_update.c | 334 + nuttx/drivers/pwm.c | 422 + nuttx/drivers/ramdisk.c | 339 + nuttx/drivers/rwbuffer.c | 679 + nuttx/drivers/sensors/Make.defs | 51 + nuttx/drivers/sensors/lis331dl.c | 320 + nuttx/drivers/sensors/lm75.c | 537 + nuttx/drivers/serial/Make.defs | 50 + nuttx/drivers/serial/lowconsole.c | 132 + nuttx/drivers/serial/serial.c | 763 + nuttx/drivers/serial/serialirq.c | 187 + nuttx/drivers/serial/uart_16550.c | 1162 + nuttx/drivers/usbdev/Make.defs | 63 + nuttx/drivers/usbdev/cdc_serdesc.c | 590 + nuttx/drivers/usbdev/cdc_serial.c | 1990 ++ nuttx/drivers/usbdev/cdc_serial.h | 196 + nuttx/drivers/usbdev/usbdev_composite.c | 85 + nuttx/drivers/usbdev/usbdev_composite.h | 86 + nuttx/drivers/usbdev/usbdev_scsi.c | 2664 +++ nuttx/drivers/usbdev/usbdev_serial.c | 2216 ++ nuttx/drivers/usbdev/usbdev_storage.c | 1651 ++ nuttx/drivers/usbdev/usbdev_storage.h | 608 + nuttx/drivers/usbdev/usbdev_stordesc.c | 408 + nuttx/drivers/usbdev/usbdev_trace.c | 233 + nuttx/drivers/usbdev/usbdev_trprintf.c | 253 + nuttx/drivers/usbhost/Make.defs | 57 + nuttx/drivers/usbhost/hid_parser.c | 529 + nuttx/drivers/usbhost/usbhost_enumerate.c | 517 + nuttx/drivers/usbhost/usbhost_findclass.c | 199 + nuttx/drivers/usbhost/usbhost_hidkbd.c | 2048 ++ nuttx/drivers/usbhost/usbhost_registerclass.c | 117 + nuttx/drivers/usbhost/usbhost_registry.c | 80 + nuttx/drivers/usbhost/usbhost_registry.h | 87 + nuttx/drivers/usbhost/usbhost_skeleton.c | 1060 + nuttx/drivers/usbhost/usbhost_storage.c | 2233 ++ nuttx/drivers/wireless/Make.defs | 47 + .../wireless/cc1101/ISM1_868MHzGFSK100kbps.c | 113 + .../wireless/cc1101/ISM2_905MHzGFSK250kbps.c | 111 + nuttx/drivers/wireless/cc1101/cc1101.c | 813 + nuttx/fs/Makefile | 133 + nuttx/fs/fat/Make.defs | 50 + nuttx/fs/fat/fs_configfat.c | 963 + nuttx/fs/fat/fs_fat32.c | 2287 ++ nuttx/fs/fat/fs_fat32.h | 910 + nuttx/fs/fat/fs_fat32attrib.c | 189 + nuttx/fs/fat/fs_fat32dirent.c | 2947 +++ nuttx/fs/fat/fs_fat32util.c | 1855 ++ nuttx/fs/fat/fs_mkfatfs.c | 312 + nuttx/fs/fat/fs_mkfatfs.h | 170 + nuttx/fs/fat/fs_writefat.c | 544 + nuttx/fs/fs_close.c | 133 + nuttx/fs/fs_closeblockdriver.c | 110 + nuttx/fs/fs_closedir.c | 150 + nuttx/fs/fs_dup.c | 107 + nuttx/fs/fs_dup2.c | 108 + nuttx/fs/fs_fcntl.c | 255 + nuttx/fs/fs_fdopen.c | 261 + nuttx/fs/fs_filedup.c | 120 + nuttx/fs/fs_filedup2.c | 121 + nuttx/fs/fs_files.c | 458 + nuttx/fs/fs_findblockdriver.c | 130 + nuttx/fs/fs_fsync.c | 137 + nuttx/fs/fs_inode.c | 331 + nuttx/fs/fs_inodeaddref.c | 83 + nuttx/fs/fs_inodefind.c | 98 + nuttx/fs/fs_inoderelease.c | 107 + nuttx/fs/fs_inoderemove.c | 156 + nuttx/fs/fs_inodereserve.c | 210 + nuttx/fs/fs_internal.h | 153 + nuttx/fs/fs_ioctl.c | 149 + nuttx/fs/fs_lseek.c | 175 + nuttx/fs/fs_mkdir.c | 130 + nuttx/fs/fs_mount.c | 383 + nuttx/fs/fs_open.c | 191 + nuttx/fs/fs_openblockdriver.c | 127 + nuttx/fs/fs_opendir.c | 314 + nuttx/fs/fs_poll.c | 326 + nuttx/fs/fs_read.c | 143 + nuttx/fs/fs_readdir.c | 231 + nuttx/fs/fs_registerblockdriver.c | 103 + nuttx/fs/fs_registerdriver.c | 100 + nuttx/fs/fs_rename.c | 154 + nuttx/fs/fs_rewinddir.c | 146 + nuttx/fs/fs_rmdir.c | 130 + nuttx/fs/fs_seekdir.c | 232 + nuttx/fs/fs_select.c | 216 + nuttx/fs/fs_stat.c | 224 + nuttx/fs/fs_statfs.c | 165 + nuttx/fs/fs_umount.c | 206 + nuttx/fs/fs_unlink.c | 130 + nuttx/fs/fs_unregisterblockdriver.c | 82 + nuttx/fs/fs_unregisterdriver.c | 82 + nuttx/fs/fs_write.c | 188 + nuttx/fs/mmap/Make.defs | 43 + nuttx/fs/mmap/README.txt | 78 + nuttx/fs/mmap/fs_mmap.c | 174 + nuttx/fs/mmap/fs_munmap.c | 212 + nuttx/fs/mmap/fs_rammap.c | 238 + nuttx/fs/mmap/fs_rammap.h | 150 + nuttx/fs/nxffs/Make.defs | 46 + nuttx/fs/nxffs/README.txt | 171 + nuttx/fs/nxffs/nxffs.h | 1083 + nuttx/fs/nxffs/nxffs_block.c | 186 + nuttx/fs/nxffs/nxffs_blockstats.c | 152 + nuttx/fs/nxffs/nxffs_cache.c | 261 + nuttx/fs/nxffs/nxffs_dirent.c | 217 + nuttx/fs/nxffs/nxffs_dump.c | 479 + nuttx/fs/nxffs/nxffs_initialize.c | 520 + nuttx/fs/nxffs/nxffs_inode.c | 502 + nuttx/fs/nxffs/nxffs_ioctl.c | 150 + nuttx/fs/nxffs/nxffs_open.c | 1263 ++ nuttx/fs/nxffs/nxffs_pack.c | 1572 ++ nuttx/fs/nxffs/nxffs_read.c | 473 + nuttx/fs/nxffs/nxffs_reformat.c | 267 + nuttx/fs/nxffs/nxffs_stat.c | 186 + nuttx/fs/nxffs/nxffs_unlink.c | 187 + nuttx/fs/nxffs/nxffs_util.c | 181 + nuttx/fs/nxffs/nxffs_write.c | 853 + nuttx/fs/romfs/Make.defs | 45 + nuttx/fs/romfs/fs_romfs.c | 1090 + nuttx/fs/romfs/fs_romfs.h | 231 + nuttx/fs/romfs/fs_romfsutil.c | 979 + nuttx/graphics/Makefile | 209 + nuttx/graphics/README.txt | 329 + nuttx/graphics/nxbe/Make.defs | 41 + nuttx/graphics/nxbe/nxbe.h | 518 + nuttx/graphics/nxbe/nxbe_bitmap.c | 192 + nuttx/graphics/nxbe/nxbe_clipper.c | 278 + nuttx/graphics/nxbe/nxbe_closewindow.c | 137 + nuttx/graphics/nxbe/nxbe_colormap.c | 155 + nuttx/graphics/nxbe/nxbe_configure.c | 219 + nuttx/graphics/nxbe/nxbe_fill.c | 157 + nuttx/graphics/nxbe/nxbe_filltrapezoid.c | 175 + nuttx/graphics/nxbe/nxbe_getrectangle.c | 138 + nuttx/graphics/nxbe/nxbe_lower.c | 125 + nuttx/graphics/nxbe/nxbe_move.c | 283 + nuttx/graphics/nxbe/nxbe_raise.c | 116 + nuttx/graphics/nxbe/nxbe_redraw.c | 139 + nuttx/graphics/nxbe/nxbe_redrawbelow.c | 91 + nuttx/graphics/nxbe/nxbe_setpixel.c | 158 + nuttx/graphics/nxbe/nxbe_setposition.c | 119 + nuttx/graphics/nxbe/nxbe_setsize.c | 121 + nuttx/graphics/nxbe/nxbe_visible.c | 134 + nuttx/graphics/nxfonts/Make.defs | 122 + nuttx/graphics/nxfonts/Makefile.sources | 189 + nuttx/graphics/nxfonts/nxfonts_bitmaps.c | 1689 ++ nuttx/graphics/nxfonts/nxfonts_convert.c | 290 + nuttx/graphics/nxfonts/nxfonts_getfont.c | 411 + nuttx/graphics/nxfonts/nxfonts_internal.h | 88 + nuttx/graphics/nxfonts/nxfonts_sans17x22.h | 849 + nuttx/graphics/nxfonts/nxfonts_sans17x23b.h | 849 + nuttx/graphics/nxfonts/nxfonts_sans20x26.h | 849 + nuttx/graphics/nxfonts/nxfonts_sans20x27b.h | 849 + nuttx/graphics/nxfonts/nxfonts_sans22x29.h | 849 + nuttx/graphics/nxfonts/nxfonts_sans22x29b.h | 849 + nuttx/graphics/nxfonts/nxfonts_sans23x27.h | 860 + nuttx/graphics/nxfonts/nxfonts_sans28x37.h | 849 + nuttx/graphics/nxfonts/nxfonts_sans28x37b.h | 849 + nuttx/graphics/nxfonts/nxfonts_sans39x48.h | 849 + nuttx/graphics/nxfonts/nxfonts_sans40x49b.h | 849 + nuttx/graphics/nxfonts/nxfonts_serif22x28b.h | 849 + nuttx/graphics/nxfonts/nxfonts_serif22x29.h | 849 + nuttx/graphics/nxfonts/nxfonts_serif27x38b.h | 849 + nuttx/graphics/nxfonts/nxfonts_serif29x37.h | 849 + nuttx/graphics/nxfonts/nxfonts_serif38x48.h | 849 + nuttx/graphics/nxfonts/nxfonts_serif38x49b.h | 849 + nuttx/graphics/nxglib/Make.defs | 93 + nuttx/graphics/nxglib/Makefile.sources | 175 + .../graphics/nxglib/fb/nxglib_copyrectangle.c | 179 + .../graphics/nxglib/fb/nxglib_fillrectangle.c | 177 + .../graphics/nxglib/fb/nxglib_filltrapezoid.c | 269 + .../graphics/nxglib/fb/nxglib_getrectangle.c | 201 + .../graphics/nxglib/fb/nxglib_moverectangle.c | 250 + nuttx/graphics/nxglib/fb/nxglib_setpixel.c | 156 + .../nxglib/lcd/nxglib_copyrectangle.c | 141 + .../nxglib/lcd/nxglib_fillrectangle.c | 111 + .../nxglib/lcd/nxglib_filltrapezoid.c | 245 + .../graphics/nxglib/lcd/nxglib_getrectangle.c | 105 + .../nxglib/lcd/nxglib_moverectangle.c | 131 + nuttx/graphics/nxglib/lcd/nxglib_setpixel.c | 153 + nuttx/graphics/nxglib/nxglib_bitblit.h | 208 + nuttx/graphics/nxglib/nxglib_circlepts.c | 171 + nuttx/graphics/nxglib/nxglib_circletraps.c | 176 + nuttx/graphics/nxglib/nxglib_colorcopy.c | 87 + nuttx/graphics/nxglib/nxglib_copyrun.h | 346 + nuttx/graphics/nxglib/nxglib_fillrun.h | 196 + nuttx/graphics/nxglib/nxglib_intersecting.c | 83 + .../graphics/nxglib/nxglib_nonintersecting.c | 151 + nuttx/graphics/nxglib/nxglib_nullrect.c | 82 + nuttx/graphics/nxglib/nxglib_rectadd.c | 84 + nuttx/graphics/nxglib/nxglib_rectcopy.c | 84 + nuttx/graphics/nxglib/nxglib_rectinside.c | 83 + nuttx/graphics/nxglib/nxglib_rectintersect.c | 84 + nuttx/graphics/nxglib/nxglib_rectoffset.c | 87 + nuttx/graphics/nxglib/nxglib_rectoverlap.c | 90 + nuttx/graphics/nxglib/nxglib_rectsize.c | 81 + nuttx/graphics/nxglib/nxglib_rectunion.c | 85 + nuttx/graphics/nxglib/nxglib_rgb2yuv.c | 103 + nuttx/graphics/nxglib/nxglib_runcopy.c | 82 + nuttx/graphics/nxglib/nxglib_runoffset.c | 85 + nuttx/graphics/nxglib/nxglib_splitline.c | 337 + nuttx/graphics/nxglib/nxglib_trapcopy.c | 82 + nuttx/graphics/nxglib/nxglib_trapoffset.c | 82 + nuttx/graphics/nxglib/nxglib_vectoradd.c | 84 + nuttx/graphics/nxglib/nxglib_vectsubtract.c | 84 + nuttx/graphics/nxglib/nxglib_yuv2rgb.c | 102 + nuttx/graphics/nxmu/Make.defs | 48 + nuttx/graphics/nxmu/nx_bitmap.c | 136 + nuttx/graphics/nxmu/nx_closewindow.c | 107 + nuttx/graphics/nxmu/nx_connect.c | 220 + nuttx/graphics/nxmu/nx_disconnect.c | 108 + nuttx/graphics/nxmu/nx_drawcircle.c | 145 + nuttx/graphics/nxmu/nx_drawline.c | 136 + nuttx/graphics/nxmu/nx_eventhandler.c | 248 + nuttx/graphics/nxmu/nx_eventnotify.c | 111 + nuttx/graphics/nxmu/nx_fill.c | 122 + nuttx/graphics/nxmu/nx_fillcircle.c | 114 + nuttx/graphics/nxmu/nx_filltrapezoid.c | 138 + nuttx/graphics/nxmu/nx_getposition.c | 122 + nuttx/graphics/nxmu/nx_getrectangle.c | 130 + nuttx/graphics/nxmu/nx_kbdchin.c | 105 + nuttx/graphics/nxmu/nx_kbdin.c | 126 + nuttx/graphics/nxmu/nx_lower.c | 104 + nuttx/graphics/nxmu/nx_mousein.c | 106 + nuttx/graphics/nxmu/nx_move.c | 120 + nuttx/graphics/nxmu/nx_openwindow.c | 130 + nuttx/graphics/nxmu/nx_raise.c | 104 + nuttx/graphics/nxmu/nx_releasebkgd.c | 112 + nuttx/graphics/nxmu/nx_requestbkgd.c | 143 + nuttx/graphics/nxmu/nx_setbgcolor.c | 115 + nuttx/graphics/nxmu/nx_setpixel.c | 123 + nuttx/graphics/nxmu/nx_setposition.c | 116 + nuttx/graphics/nxmu/nx_setsize.c | 116 + nuttx/graphics/nxmu/nxfe.h | 649 + nuttx/graphics/nxmu/nxmu_constructwindow.c | 146 + nuttx/graphics/nxmu/nxmu_kbdin.c | 122 + nuttx/graphics/nxmu/nxmu_mouse.c | 222 + nuttx/graphics/nxmu/nxmu_openwindow.c | 113 + nuttx/graphics/nxmu/nxmu_redrawreq.c | 98 + nuttx/graphics/nxmu/nxmu_releasebkgd.c | 110 + nuttx/graphics/nxmu/nxmu_reportposition.c | 108 + nuttx/graphics/nxmu/nxmu_requestbkgd.c | 124 + nuttx/graphics/nxmu/nxmu_semtake.c | 87 + nuttx/graphics/nxmu/nxmu_server.c | 530 + nuttx/graphics/nxsu/Make.defs | 44 + nuttx/graphics/nxsu/nx_bitmap.c | 110 + nuttx/graphics/nxsu/nx_close.c | 91 + nuttx/graphics/nxsu/nx_closewindow.c | 100 + nuttx/graphics/nxsu/nx_drawcircle.c | 145 + nuttx/graphics/nxsu/nx_drawline.c | 136 + nuttx/graphics/nxsu/nx_fill.c | 103 + nuttx/graphics/nxsu/nx_fillcircle.c | 114 + nuttx/graphics/nxsu/nx_filltrapezoid.c | 105 + nuttx/graphics/nxsu/nx_getposition.c | 106 + nuttx/graphics/nxsu/nx_getrectangle.c | 110 + nuttx/graphics/nxsu/nx_kbdchin.c | 101 + nuttx/graphics/nxsu/nx_kbdin.c | 100 + nuttx/graphics/nxsu/nx_lower.c | 99 + nuttx/graphics/nxsu/nx_mousein.c | 200 + nuttx/graphics/nxsu/nx_move.c | 101 + nuttx/graphics/nxsu/nx_open.c | 218 + nuttx/graphics/nxsu/nx_openwindow.c | 127 + nuttx/graphics/nxsu/nx_raise.c | 99 + nuttx/graphics/nxsu/nx_releasebkgd.c | 109 + nuttx/graphics/nxsu/nx_requestbkgd.c | 155 + nuttx/graphics/nxsu/nx_setbgcolor.c | 103 + nuttx/graphics/nxsu/nx_setpixel.c | 104 + nuttx/graphics/nxsu/nx_setposition.c | 99 + nuttx/graphics/nxsu/nx_setsize.c | 99 + nuttx/graphics/nxsu/nxfe.h | 185 + nuttx/graphics/nxsu/nxsu_constructwindow.c | 150 + nuttx/graphics/nxsu/nxsu_redrawreq.c | 104 + nuttx/graphics/nxsu/nxsu_reportposition.c | 107 + nuttx/graphics/nxtk/Make.defs | 48 + nuttx/graphics/nxtk/nxtk_bitmaptoolbar.c | 137 + nuttx/graphics/nxtk/nxtk_bitmapwindow.c | 137 + nuttx/graphics/nxtk/nxtk_closetoolbar.c | 111 + nuttx/graphics/nxtk/nxtk_closewindow.c | 95 + nuttx/graphics/nxtk/nxtk_containerclip.c | 122 + nuttx/graphics/nxtk/nxtk_drawcircletoolbar.c | 145 + nuttx/graphics/nxtk/nxtk_drawcirclewindow.c | 145 + nuttx/graphics/nxtk/nxtk_drawframe.c | 237 + nuttx/graphics/nxtk/nxtk_drawlinetoolbar.c | 139 + nuttx/graphics/nxtk/nxtk_drawlinewindow.c | 138 + nuttx/graphics/nxtk/nxtk_events.c | 273 + nuttx/graphics/nxtk/nxtk_fillcircletoolbar.c | 115 + nuttx/graphics/nxtk/nxtk_fillcirclewindow.c | 115 + nuttx/graphics/nxtk/nxtk_filltoolbar.c | 116 + nuttx/graphics/nxtk/nxtk_filltraptoolbar.c | 110 + nuttx/graphics/nxtk/nxtk_filltrapwindow.c | 110 + nuttx/graphics/nxtk/nxtk_fillwindow.c | 116 + nuttx/graphics/nxtk/nxtk_getposition.c | 95 + nuttx/graphics/nxtk/nxtk_gettoolbar.c | 123 + nuttx/graphics/nxtk/nxtk_getwindow.c | 123 + nuttx/graphics/nxtk/nxtk_internal.h | 249 + nuttx/graphics/nxtk/nxtk_lower.c | 95 + nuttx/graphics/nxtk/nxtk_movetoolbar.c | 119 + nuttx/graphics/nxtk/nxtk_movewindow.c | 118 + nuttx/graphics/nxtk/nxtk_opentoolbar.c | 127 + nuttx/graphics/nxtk/nxtk_openwindow.c | 151 + nuttx/graphics/nxtk/nxtk_raise.c | 95 + nuttx/graphics/nxtk/nxtk_setposition.c | 107 + nuttx/graphics/nxtk/nxtk_setsize.c | 114 + nuttx/graphics/nxtk/nxtk_setsubwindows.c | 165 + nuttx/graphics/nxtk/nxtk_subwindowclip.c | 118 + nuttx/graphics/nxtk/nxtk_subwindowmove.c | 151 + nuttx/include/arpa/inet.h | 129 + nuttx/include/assert.h | 123 + nuttx/include/crc32.h | 82 + nuttx/include/ctype.h | 226 + nuttx/include/cxx/cassert | 49 + nuttx/include/cxx/cctype | 49 + nuttx/include/cxx/cerrno | 49 + nuttx/include/cxx/climits | 49 + nuttx/include/cxx/cmath | 75 + nuttx/include/cxx/csignal | 72 + nuttx/include/cxx/cstdarg | 49 + nuttx/include/cxx/cstdbool | 49 + nuttx/include/cxx/cstddef | 81 + nuttx/include/cxx/cstdint | 82 + nuttx/include/cxx/cstdio | 86 + nuttx/include/cxx/cstdlib | 79 + nuttx/include/cxx/cstring | 81 + nuttx/include/cxx/ctime | 71 + nuttx/include/debug.h | 626 + nuttx/include/dirent.h | 118 + nuttx/include/errno.h | 369 + nuttx/include/fcntl.h | 152 + nuttx/include/fixedmath.h | 226 + nuttx/include/inttypes.h | 190 + nuttx/include/libgen.h | 66 + nuttx/include/limits.h | 194 + nuttx/include/math.h | 70 + nuttx/include/mqueue.h | 110 + nuttx/include/net/ethernet.h | 71 + nuttx/include/net/if.h | 85 + nuttx/include/net/ioctls.h | 143 + nuttx/include/net/uip/uip-arch.h | 370 + nuttx/include/net/uip/uip-arp.h | 262 + nuttx/include/net/uip/uip-icmp.h | 211 + nuttx/include/net/uip/uip-igmp.h | 258 + nuttx/include/net/uip/uip-ipopt.h | 251 + nuttx/include/net/uip/uip-tcp.h | 460 + nuttx/include/net/uip/uip-udp.h | 206 + nuttx/include/net/uip/uip.h | 568 + nuttx/include/net/uip/uipopt.h | 314 + nuttx/include/netinet/arp.h | 111 + nuttx/include/netinet/ether.h | 77 + nuttx/include/netinet/in.h | 126 + nuttx/include/netinet/ip.h | 54 + nuttx/include/netinet/ip6.h | 54 + nuttx/include/nuttx/analog/adc.h | 225 + nuttx/include/nuttx/analog/dac.h | 212 + nuttx/include/nuttx/arch.h | 619 + nuttx/include/nuttx/binfmt.h | 209 + nuttx/include/nuttx/can.h | 308 + nuttx/include/nuttx/clock.h | 219 + nuttx/include/nuttx/compiler.h | 448 + nuttx/include/nuttx/cs89x0.h | 168 + nuttx/include/nuttx/dirent.h | 200 + nuttx/include/nuttx/enc28j60.h | 151 + nuttx/include/nuttx/fat.h | 88 + nuttx/include/nuttx/fb.h | 354 + nuttx/include/nuttx/fs.h | 439 + nuttx/include/nuttx/i2c.h | 332 + nuttx/include/nuttx/init.h | 82 + nuttx/include/nuttx/input/ads7843e.h | 172 + nuttx/include/nuttx/input/touchscreen.h | 174 + nuttx/include/nuttx/input/tsc2007.h | 172 + nuttx/include/nuttx/ioctl.h | 209 + nuttx/include/nuttx/irq.h | 94 + nuttx/include/nuttx/kmalloc.h | 114 + nuttx/include/nuttx/lcd/lcd.h | 219 + nuttx/include/nuttx/lcd/nokia6100.h | 141 + nuttx/include/nuttx/lcd/p14201.h | 129 + nuttx/include/nuttx/lcd/ug-9664hswag01.h | 158 + nuttx/include/nuttx/lib.h | 83 + nuttx/include/nuttx/mii.h | 447 + nuttx/include/nuttx/mkfatfs.h | 145 + nuttx/include/nuttx/mm.h | 84 + nuttx/include/nuttx/mmcsd.h | 106 + nuttx/include/nuttx/mqueue.h | 124 + nuttx/include/nuttx/mtd.h | 217 + nuttx/include/nuttx/net.h | 231 + nuttx/include/nuttx/nx/nx.h | 833 + nuttx/include/nuttx/nx/nxfonts.h | 375 + nuttx/include/nuttx/nx/nxglib.h | 738 + nuttx/include/nuttx/nx/nxtk.h | 614 + nuttx/include/nuttx/nxffs.h | 150 + nuttx/include/nuttx/nxflat.h | 264 + nuttx/include/nuttx/page.h | 467 + nuttx/include/nuttx/pm.h | 479 + nuttx/include/nuttx/progmem.h | 144 + nuttx/include/nuttx/pthread.h | 88 + nuttx/include/nuttx/pwm.h | 253 + nuttx/include/nuttx/ramdisk.h | 90 + nuttx/include/nuttx/regex.h | 82 + nuttx/include/nuttx/rgbcolors.h | 293 + nuttx/include/nuttx/rtc.h | 264 + nuttx/include/nuttx/rwbuffer.h | 192 + nuttx/include/nuttx/sched.h | 356 + nuttx/include/nuttx/scsi.h | 1013 + nuttx/include/nuttx/sdio.h | 855 + nuttx/include/nuttx/sensors/lis331dl.h | 142 + nuttx/include/nuttx/sensors/lm75.h | 133 + nuttx/include/nuttx/serial.h | 302 + nuttx/include/nuttx/spi.h | 444 + nuttx/include/nuttx/streams.h | 276 + nuttx/include/nuttx/symtab.h | 163 + nuttx/include/nuttx/time.h | 120 + nuttx/include/nuttx/tioctl.h | 197 + nuttx/include/nuttx/uart_16550.h | 351 + nuttx/include/nuttx/usb/cdc.h | 879 + nuttx/include/nuttx/usb/cdc_serial.h | 315 + nuttx/include/nuttx/usb/hid.h | 693 + nuttx/include/nuttx/usb/hid_parser.h | 350 + nuttx/include/nuttx/usb/ohci.h | 459 + nuttx/include/nuttx/usb/storage.h | 131 + nuttx/include/nuttx/usb/usb.h | 355 + nuttx/include/nuttx/usb/usbdev.h | 458 + nuttx/include/nuttx/usb/usbdev_trace.h | 478 + nuttx/include/nuttx/usb/usbhost.h | 869 + nuttx/include/nuttx/usb/usbhost_trace.h | 75 + nuttx/include/nuttx/wireless/cc1101.h | 464 + nuttx/include/nuttx/wqueue.h | 169 + nuttx/include/nxflat.h | 204 + nuttx/include/poll.h | 138 + nuttx/include/pthread.h | 395 + nuttx/include/queue.h | 129 + nuttx/include/sched.h | 167 + nuttx/include/semaphore.h | 118 + nuttx/include/signal.h | 238 + nuttx/include/stdbool.h | 89 + nuttx/include/stddef.h | 49 + nuttx/include/stdint.h | 305 + nuttx/include/stdio.h | 149 + nuttx/include/stdlib.h | 187 + nuttx/include/string.h | 99 + nuttx/include/sys/ioctl.h | 83 + nuttx/include/sys/mman.h | 113 + nuttx/include/sys/mount.h | 77 + nuttx/include/sys/select.h | 121 + nuttx/include/sys/socket.h | 207 + nuttx/include/sys/sockio.h | 120 + nuttx/include/sys/stat.h | 136 + nuttx/include/sys/statfs.h | 145 + nuttx/include/sys/syscall.h | 382 + nuttx/include/sys/time.h | 74 + nuttx/include/sys/types.h | 229 + nuttx/include/sys/vfs.h | 61 + nuttx/include/sys/wait.h | 118 + nuttx/include/syscall.h | 71 + nuttx/include/termios.h | 236 + nuttx/include/time.h | 192 + nuttx/include/unistd.h | 179 + nuttx/include/wdog.h | 109 + nuttx/lib/Makefile | 154 + nuttx/lib/README.txt | 47 + nuttx/lib/lib_internal.h | 188 + nuttx/lib/libgen/Make.defs | 37 + nuttx/lib/libgen/lib_basename.c | 131 + nuttx/lib/libgen/lib_dirname.c | 144 + nuttx/lib/math/Make.defs | 37 + nuttx/lib/math/lib_b16atan2.c | 108 + nuttx/lib/math/lib_b16cos.c | 64 + nuttx/lib/math/lib_b16sin.c | 110 + nuttx/lib/math/lib_fixedmath.c | 272 + nuttx/lib/math/lib_rint.c | 135 + nuttx/lib/misc/Make.defs | 51 + nuttx/lib/misc/lib_crc32.c | 123 + nuttx/lib/misc/lib_dbg.c | 112 + nuttx/lib/misc/lib_dumpbuffer.c | 129 + nuttx/lib/misc/lib_filesem.c | 145 + nuttx/lib/misc/lib_init.c | 207 + nuttx/lib/misc/lib_match.c | 148 + nuttx/lib/misc/lib_readdirr.c | 122 + nuttx/lib/misc/lib_streamsem.c | 90 + nuttx/lib/misc/lib_telldir.c | 91 + nuttx/lib/mqueue/Make.defs | 39 + nuttx/lib/mqueue/mq_getattr.c | 104 + nuttx/lib/mqueue/mq_setattr.c | 118 + nuttx/lib/net/Make.defs | 36 + nuttx/lib/net/lib_etherntoa.c | 69 + nuttx/lib/net/lib_htonl.c | 68 + nuttx/lib/net/lib_htons.c | 65 + nuttx/lib/net/lib_inetaddr.c | 74 + nuttx/lib/net/lib_inetntoa.c | 76 + nuttx/lib/pthread/Make.defs | 49 + nuttx/lib/pthread/pthread_attrdestroy.c | 108 + .../lib/pthread/pthread_attrgetinheritsched.c | 111 + nuttx/lib/pthread/pthread_attrgetschedparam.c | 110 + .../lib/pthread/pthread_attrgetschedpolicy.c | 105 + nuttx/lib/pthread/pthread_attrgetstacksize.c | 106 + nuttx/lib/pthread/pthread_attrinit.c | 123 + .../lib/pthread/pthread_attrsetinheritsched.c | 113 + nuttx/lib/pthread/pthread_attrsetschedparam.c | 108 + .../lib/pthread/pthread_attrsetschedpolicy.c | 111 + nuttx/lib/pthread/pthread_attrsetstacksize.c | 106 + .../lib/pthread/pthread_barrierattrdestroy.c | 102 + .../pthread/pthread_barrierattrgetpshared.c | 101 + nuttx/lib/pthread/pthread_barrierattrinit.c | 101 + .../pthread/pthread_barrierattrsetpshared.c | 111 + nuttx/lib/pthread/pthread_condattrdestroy.c | 82 + nuttx/lib/pthread/pthread_condattrinit.c | 85 + nuttx/lib/pthread/pthread_mutexattrdestroy.c | 104 + .../lib/pthread/pthread_mutexattrgetpshared.c | 104 + nuttx/lib/pthread/pthread_mutexattrgettype.c | 98 + nuttx/lib/pthread/pthread_mutexattrinit.c | 106 + .../lib/pthread/pthread_mutexattrsetpshared.c | 104 + nuttx/lib/pthread/pthread_mutexattrsettype.c | 98 + nuttx/lib/queue/Make.defs | 40 + nuttx/lib/queue/dq_addafter.c | 74 + nuttx/lib/queue/dq_addbefore.c | 69 + nuttx/lib/queue/dq_addfirst.c | 74 + nuttx/lib/queue/dq_addlast.c | 74 + nuttx/lib/queue/dq_rem.c | 84 + nuttx/lib/queue/dq_remfirst.c | 82 + nuttx/lib/queue/dq_remlast.c | 78 + nuttx/lib/queue/sq_addafter.c | 71 + nuttx/lib/queue/sq_addfirst.c | 67 + nuttx/lib/queue/sq_addlast.c | 72 + nuttx/lib/queue/sq_rem.c | 83 + nuttx/lib/queue/sq_remafter.c | 79 + nuttx/lib/queue/sq_remfirst.c | 76 + nuttx/lib/queue/sq_remlast.c | 87 + nuttx/lib/sched/Make.defs | 38 + nuttx/lib/sched/sched_getprioritymax.c | 100 + nuttx/lib/sched/sched_getprioritymin.c | 100 + nuttx/lib/semaphore/Make.defs | 36 + nuttx/lib/semaphore/sem_getvalue.c | 108 + nuttx/lib/semaphore/sem_init.c | 115 + nuttx/lib/signal/Make.defs | 40 + nuttx/lib/signal/sig_addset.c | 100 + nuttx/lib/signal/sig_delset.c | 100 + nuttx/lib/signal/sig_emptyset.c | 88 + nuttx/lib/signal/sig_fillset.c | 88 + nuttx/lib/signal/sig_ismember.c | 101 + nuttx/lib/stdio/Make.defs | 61 + nuttx/lib/stdio/lib_asprintf.c | 150 + nuttx/lib/stdio/lib_dtoa.c | 1537 ++ nuttx/lib/stdio/lib_fclose.c | 154 + nuttx/lib/stdio/lib_fflush.c | 118 + nuttx/lib/stdio/lib_fgetc.c | 101 + nuttx/lib/stdio/lib_fgetpos.c | 123 + nuttx/lib/stdio/lib_fgets.c | 343 + nuttx/lib/stdio/lib_fileno.c | 69 + nuttx/lib/stdio/lib_fopen.c | 180 + nuttx/lib/stdio/lib_fprintf.c | 93 + nuttx/lib/stdio/lib_fputc.c | 113 + nuttx/lib/stdio/lib_fputs.c | 220 + nuttx/lib/stdio/lib_fread.c | 101 + nuttx/lib/stdio/lib_fseek.c | 138 + nuttx/lib/stdio/lib_fsetpos.c | 116 + nuttx/lib/stdio/lib_ftell.c | 129 + nuttx/lib/stdio/lib_fwrite.c | 99 + nuttx/lib/stdio/lib_gets.c | 123 + nuttx/lib/stdio/lib_libdtoa.c | 365 + nuttx/lib/stdio/lib_libfflush.c | 196 + nuttx/lib/stdio/lib_libflushall.c | 139 + nuttx/lib/stdio/lib_libfread.c | 271 + nuttx/lib/stdio/lib_libfwrite.c | 179 + nuttx/lib/stdio/lib_libnoflush.c | 103 + nuttx/lib/stdio/lib_libsprintf.c | 90 + nuttx/lib/stdio/lib_libvsprintf.c | 1545 ++ nuttx/lib/stdio/lib_lowinstream.c | 91 + nuttx/lib/stdio/lib_lowoutstream.c | 94 + nuttx/lib/stdio/lib_lowprintf.c | 114 + nuttx/lib/stdio/lib_meminstream.c | 97 + nuttx/lib/stdio/lib_memoutstream.c | 101 + nuttx/lib/stdio/lib_nullinstream.c | 78 + nuttx/lib/stdio/lib_nulloutstream.c | 81 + nuttx/lib/stdio/lib_printf.c | 109 + nuttx/lib/stdio/lib_puts.c | 130 + nuttx/lib/stdio/lib_rawinstream.c | 102 + nuttx/lib/stdio/lib_rawoutstream.c | 101 + nuttx/lib/stdio/lib_rawprintf.c | 126 + nuttx/lib/stdio/lib_rdflush.c | 144 + nuttx/lib/stdio/lib_snprintf.c | 99 + nuttx/lib/stdio/lib_sprintf.c | 95 + nuttx/lib/stdio/lib_sscanf.c | 390 + nuttx/lib/stdio/lib_stdinstream.c | 94 + nuttx/lib/stdio/lib_stdoutstream.c | 110 + nuttx/lib/stdio/lib_ungetc.c | 121 + nuttx/lib/stdio/lib_vfprintf.c | 102 + nuttx/lib/stdio/lib_vprintf.c | 92 + nuttx/lib/stdio/lib_vsnprintf.c | 96 + nuttx/lib/stdio/lib_vsprintf.c | 92 + nuttx/lib/stdio/lib_wrflush.c | 116 + nuttx/lib/stdio/lib_zeroinstream.c | 79 + nuttx/lib/stdlib/Make.defs | 38 + nuttx/lib/stdlib/lib_abort.c | 81 + nuttx/lib/stdlib/lib_abs.c | 54 + nuttx/lib/stdlib/lib_imaxabs.c | 54 + nuttx/lib/stdlib/lib_labs.c | 54 + nuttx/lib/stdlib/lib_llabs.c | 57 + nuttx/lib/stdlib/lib_qsort.c | 238 + nuttx/lib/stdlib/lib_rand.c | 220 + nuttx/lib/string/Make.defs | 43 + nuttx/lib/string/lib_checkbase.c | 115 + nuttx/lib/string/lib_isbasedigit.c | 105 + nuttx/lib/string/lib_memcmp.c | 74 + nuttx/lib/string/lib_memcpy.c | 60 + nuttx/lib/string/lib_memmove.c | 72 + nuttx/lib/string/lib_memset.c | 59 + nuttx/lib/string/lib_skipspace.c | 69 + nuttx/lib/string/lib_strcasecmp.c | 65 + nuttx/lib/string/lib_strcat.c | 62 + nuttx/lib/string/lib_strchr.c | 67 + nuttx/lib/string/lib_strcmp.c | 59 + nuttx/lib/string/lib_strcpy.c | 55 + nuttx/lib/string/lib_strcspn.c | 67 + nuttx/lib/string/lib_strdup.c | 62 + nuttx/lib/string/lib_strerror.c | 237 + nuttx/lib/string/lib_strlen.c | 55 + nuttx/lib/string/lib_strncasecmp.c | 70 + nuttx/lib/string/lib_strncat.c | 62 + nuttx/lib/string/lib_strncmp.c | 65 + nuttx/lib/string/lib_strncpy.c | 57 + nuttx/lib/string/lib_strndup.c | 93 + nuttx/lib/string/lib_strnlen.c | 62 + nuttx/lib/string/lib_strpbrk.c | 85 + nuttx/lib/string/lib_strrchr.c | 68 + nuttx/lib/string/lib_strspn.c | 66 + nuttx/lib/string/lib_strstr.c | 104 + nuttx/lib/string/lib_strtod.c | 234 + nuttx/lib/string/lib_strtok.c | 87 + nuttx/lib/string/lib_strtokr.c | 157 + nuttx/lib/string/lib_strtol.c | 103 + nuttx/lib/string/lib_strtoll.c | 107 + nuttx/lib/string/lib_strtoul.c | 98 + nuttx/lib/string/lib_strtoull.c | 100 + nuttx/lib/time/Make.defs | 37 + nuttx/lib/time/lib_calendar2utc.c | 209 + nuttx/lib/time/lib_daysbeforemonth.c | 102 + nuttx/lib/time/lib_gmtime.c | 93 + nuttx/lib/time/lib_gmtimer.c | 355 + nuttx/lib/time/lib_isleapyear.c | 88 + nuttx/lib/time/lib_mktime.c | 141 + nuttx/lib/time/lib_strftime.c | 398 + nuttx/lib/time/lib_time.c | 110 + nuttx/lib/unistd/Make.defs | 42 + nuttx/lib/unistd/lib_chdir.c | 179 + nuttx/lib/unistd/lib_getcwd.c | 132 + nuttx/lib/unistd/lib_getopt.c | 269 + nuttx/lib/unistd/lib_getoptargp.c | 73 + nuttx/lib/unistd/lib_getoptindp.c | 73 + nuttx/lib/unistd/lib_getoptoptp.c | 73 + nuttx/libxx/Makefile | 80 + nuttx/libxx/README.txt | 17 + nuttx/libxx/libxx_cxapurevirtual.cxx | 69 + nuttx/libxx/libxx_delete.cxx | 62 + nuttx/libxx/libxx_deletea.cxx | 62 + nuttx/libxx/libxx_new.cxx | 102 + nuttx/libxx/libxx_newa.cxx | 102 + nuttx/mm/Makefile | 77 + nuttx/mm/Makefile.test | 64 + nuttx/mm/mm_addfreechunk.c | 91 + nuttx/mm/mm_calloc.c | 68 + nuttx/mm/mm_environment.h | 129 + nuttx/mm/mm_free.c | 152 + nuttx/mm/mm_initialize.c | 218 + nuttx/mm/mm_internal.h | 246 + nuttx/mm/mm_mallinfo.c | 145 + nuttx/mm/mm_malloc.c | 204 + nuttx/mm/mm_memalign.c | 210 + nuttx/mm/mm_realloc.c | 354 + nuttx/mm/mm_sem.c | 249 + nuttx/mm/mm_shrinkchunk.c | 140 + nuttx/mm/mm_size2ndx.c | 70 + nuttx/mm/mm_test.c | 473 + nuttx/mm/mm_zalloc.c | 68 + nuttx/net/Makefile | 123 + nuttx/net/accept.c | 457 + nuttx/net/bind.c | 157 + nuttx/net/connect.c | 563 + nuttx/net/getsockname.c | 216 + nuttx/net/getsockopt.c | 238 + nuttx/net/listen.c | 149 + nuttx/net/net_arptimer.c | 134 + nuttx/net/net_checksd.c | 88 + nuttx/net/net_clone.c | 119 + nuttx/net/net_close.c | 330 + nuttx/net/net_dsec2timeval.c | 80 + nuttx/net/net_dup.c | 149 + nuttx/net/net_dup2.c | 125 + nuttx/net/net_internal.h | 215 + nuttx/net/net_poll.c | 354 + nuttx/net/net_sockets.c | 312 + nuttx/net/net_timeo.c | 85 + nuttx/net/net_timeval2dsec.c | 76 + nuttx/net/net_vfcntl.c | 234 + nuttx/net/netdev_count.c | 102 + nuttx/net/netdev_findbyaddr.c | 129 + nuttx/net/netdev_findbyname.c | 111 + nuttx/net/netdev_foreach.c | 114 + nuttx/net/netdev_ioctl.c | 400 + nuttx/net/netdev_register.c | 171 + nuttx/net/netdev_txnotify.c | 106 + nuttx/net/netdev_unregister.c | 159 + nuttx/net/recv.c | 77 + nuttx/net/recvfrom.c | 1139 + nuttx/net/send.c | 528 + nuttx/net/sendto.c | 372 + nuttx/net/setsockopt.c | 249 + nuttx/net/socket.c | 225 + nuttx/net/uip/Make.defs | 106 + nuttx/net/uip/uip_arp.c | 431 + nuttx/net/uip/uip_arptab.c | 257 + nuttx/net/uip/uip_callback.c | 251 + nuttx/net/uip/uip_chksum.c | 230 + nuttx/net/uip/uip_icmpinput.c | 317 + nuttx/net/uip/uip_icmpping.c | 378 + nuttx/net/uip/uip_icmppoll.c | 103 + nuttx/net/uip/uip_icmpsend.c | 168 + nuttx/net/uip/uip_igmpgroup.c | 391 + nuttx/net/uip/uip_igmpinit.c | 122 + nuttx/net/uip/uip_igmpinput.c | 280 + nuttx/net/uip/uip_igmpjoin.c | 160 + nuttx/net/uip/uip_igmpleave.c | 182 + nuttx/net/uip/uip_igmpmsg.c | 139 + nuttx/net/uip/uip_igmppoll.c | 176 + nuttx/net/uip/uip_igmpsend.c | 182 + nuttx/net/uip/uip_igmptimer.c | 257 + nuttx/net/uip/uip_initialize.c | 155 + nuttx/net/uip/uip_input.c | 541 + nuttx/net/uip/uip_internal.h | 268 + nuttx/net/uip/uip_listen.c | 288 + nuttx/net/uip/uip_lock.c | 218 + nuttx/net/uip/uip_mcastmac.c | 132 + nuttx/net/uip/uip_neighbor.c | 162 + nuttx/net/uip/uip_neighbor.h | 61 + nuttx/net/uip/uip_poll.c | 353 + nuttx/net/uip/uip_send.c | 106 + nuttx/net/uip/uip_setipid.c | 78 + nuttx/net/uip/uip_tcpappsend.c | 215 + nuttx/net/uip/uip_tcpbacklog.c | 403 + nuttx/net/uip/uip_tcpcallback.c | 289 + nuttx/net/uip/uip_tcpconn.c | 636 + nuttx/net/uip/uip_tcpinput.c | 806 + nuttx/net/uip/uip_tcppoll.c | 127 + nuttx/net/uip/uip_tcpreadahead.c | 130 + nuttx/net/uip/uip_tcpsend.c | 369 + nuttx/net/uip/uip_tcpseqno.c | 173 + nuttx/net/uip/uip_tcptimer.c | 250 + nuttx/net/uip/uip_udpcallback.c | 90 + nuttx/net/uip/uip_udpconn.c | 491 + nuttx/net/uip/uip_udpinput.c | 156 + nuttx/net/uip/uip_udppoll.c | 126 + nuttx/net/uip/uip_udpsend.c | 177 + nuttx/sched/Makefile | 208 + nuttx/sched/atexit.c | 116 + nuttx/sched/clock_abstime2ticks.c | 128 + nuttx/sched/clock_getres.c | 121 + nuttx/sched/clock_gettime.c | 180 + nuttx/sched/clock_gettimeofday.c | 111 + nuttx/sched/clock_initialize.c | 211 + nuttx/sched/clock_internal.h | 91 + nuttx/sched/clock_settime.c | 149 + nuttx/sched/clock_systimer.c | 110 + nuttx/sched/clock_ticks2time.c | 94 + nuttx/sched/clock_time2ticks.c | 102 + nuttx/sched/env_clearenv.c | 83 + nuttx/sched/env_dup.c | 131 + nuttx/sched/env_dupenv.c | 112 + nuttx/sched/env_findvar.c | 127 + nuttx/sched/env_getenv.c | 136 + nuttx/sched/env_getenvironptr.c | 104 + nuttx/sched/env_internal.h | 95 + nuttx/sched/env_putenv.c | 123 + nuttx/sched/env_release.c | 122 + nuttx/sched/env_removevar.c | 118 + nuttx/sched/env_setenv.c | 208 + nuttx/sched/env_share.c | 115 + nuttx/sched/env_unsetenv.c | 138 + nuttx/sched/errno_get.c | 84 + nuttx/sched/errno_getptr.c | 117 + nuttx/sched/errno_set.c | 83 + nuttx/sched/exit.c | 106 + nuttx/sched/getpid.c | 84 + nuttx/sched/irq_attach.c | 113 + nuttx/sched/irq_dispatch.c | 105 + nuttx/sched/irq_initialize.c | 90 + nuttx/sched/irq_internal.h | 83 + nuttx/sched/irq_unexpectedisr.c | 85 + nuttx/sched/kmm_addregion.c | 113 + nuttx/sched/kmm_initialize.c | 113 + nuttx/sched/kmm_kfree.c | 110 + nuttx/sched/kmm_kmalloc.c | 110 + nuttx/sched/kmm_krealloc.c | 111 + nuttx/sched/kmm_kzalloc.c | 110 + nuttx/sched/kmm_semaphore.c | 140 + nuttx/sched/mq_close.c | 189 + nuttx/sched/mq_descreate.c | 156 + nuttx/sched/mq_findnamed.c | 104 + nuttx/sched/mq_initialize.c | 249 + nuttx/sched/mq_internal.h | 182 + nuttx/sched/mq_msgfree.c | 136 + nuttx/sched/mq_msgqfree.c | 108 + nuttx/sched/mq_notify.c | 212 + nuttx/sched/mq_open.c | 235 + nuttx/sched/mq_rcvinternal.c | 313 + nuttx/sched/mq_receive.c | 170 + nuttx/sched/mq_send.c | 181 + nuttx/sched/mq_sndinternal.c | 452 + nuttx/sched/mq_timedreceive.c | 309 + nuttx/sched/mq_timedsend.c | 320 + nuttx/sched/mq_unlink.c | 146 + nuttx/sched/mq_waitirq.c | 172 + nuttx/sched/os_bringup.c | 186 + nuttx/sched/os_internal.h | 307 + nuttx/sched/os_start.c | 464 + nuttx/sched/pg_internal.h | 126 + nuttx/sched/pg_miss.c | 179 + nuttx/sched/pg_worker.c | 675 + nuttx/sched/pthread_barrierdestroy.c | 110 + nuttx/sched/pthread_barrierinit.c | 121 + nuttx/sched/pthread_barrierwait.c | 182 + nuttx/sched/pthread_cancel.c | 147 + nuttx/sched/pthread_completejoin.c | 231 + nuttx/sched/pthread_condbroadcast.c | 144 + nuttx/sched/pthread_conddestroy.c | 88 + nuttx/sched/pthread_condinit.c | 93 + nuttx/sched/pthread_condsignal.c | 128 + nuttx/sched/pthread_condtimedwait.c | 308 + nuttx/sched/pthread_condwait.c | 139 + nuttx/sched/pthread_create.c | 434 + nuttx/sched/pthread_detach.c | 136 + nuttx/sched/pthread_exit.c | 133 + nuttx/sched/pthread_findjoininfo.c | 99 + nuttx/sched/pthread_getschedparam.c | 138 + nuttx/sched/pthread_getspecific.c | 126 + nuttx/sched/pthread_initialize.c | 199 + nuttx/sched/pthread_internal.h | 136 + nuttx/sched/pthread_join.c | 247 + nuttx/sched/pthread_keycreate.c | 141 + nuttx/sched/pthread_keydelete.c | 96 + nuttx/sched/pthread_kill.c | 95 + nuttx/sched/pthread_mutexdestroy.c | 129 + nuttx/sched/pthread_mutexinit.c | 138 + nuttx/sched/pthread_mutexlock.c | 183 + nuttx/sched/pthread_mutextrylock.c | 146 + nuttx/sched/pthread_mutexunlock.c | 164 + nuttx/sched/pthread_once.c | 126 + nuttx/sched/pthread_removejoininfo.c | 137 + nuttx/sched/pthread_setcancelstate.c | 127 + nuttx/sched/pthread_setschedparam.c | 138 + nuttx/sched/pthread_setschedprio.c | 120 + nuttx/sched/pthread_setspecific.c | 137 + nuttx/sched/pthread_sigmask.c | 107 + nuttx/sched/pthread_yield.c | 87 + nuttx/sched/sched_addblocked.c | 120 + nuttx/sched/sched_addprioritized.c | 175 + nuttx/sched/sched_addreadytorun.c | 149 + nuttx/sched/sched_foreach.c | 83 + nuttx/sched/sched_free.c | 115 + nuttx/sched/sched_garbage.c | 117 + nuttx/sched/sched_getfiles.c | 76 + nuttx/sched/sched_getparam.c | 143 + nuttx/sched/sched_getscheduler.c | 129 + nuttx/sched/sched_getsockets.c | 77 + nuttx/sched/sched_getstreams.c | 76 + nuttx/sched/sched_gettcb.c | 105 + nuttx/sched/sched_lock.c | 110 + nuttx/sched/sched_lockcount.c | 97 + nuttx/sched/sched_mergepending.c | 171 + nuttx/sched/sched_processtimer.c | 191 + nuttx/sched/sched_releasefiles.c | 102 + nuttx/sched/sched_releasetcb.c | 180 + nuttx/sched/sched_removeblocked.c | 112 + nuttx/sched/sched_removereadytorun.c | 123 + nuttx/sched/sched_reprioritize.c | 129 + nuttx/sched/sched_rrgetinterval.c | 155 + nuttx/sched/sched_self.c | 83 + nuttx/sched/sched_setparam.c | 153 + nuttx/sched/sched_setpriority.c | 232 + nuttx/sched/sched_setscheduler.c | 188 + nuttx/sched/sched_setupidlefiles.c | 150 + nuttx/sched/sched_setuppthreadfiles.c | 108 + nuttx/sched/sched_setupstreams.c | 83 + nuttx/sched/sched_setuptaskfiles.c | 179 + nuttx/sched/sched_unlock.c | 128 + nuttx/sched/sched_verifytcb.c | 86 + nuttx/sched/sched_waitpid.c | 246 + nuttx/sched/sched_yield.c | 101 + nuttx/sched/sem_close.c | 139 + nuttx/sched/sem_destroy.c | 126 + nuttx/sched/sem_findnamed.c | 101 + nuttx/sched/sem_holder.c | 905 + nuttx/sched/sem_initialize.c | 101 + nuttx/sched/sem_internal.h | 124 + nuttx/sched/sem_open.c | 206 + nuttx/sched/sem_post.c | 178 + nuttx/sched/sem_timedwait.c | 286 + nuttx/sched/sem_trywait.c | 144 + nuttx/sched/sem_unlink.c | 138 + nuttx/sched/sem_wait.c | 216 + nuttx/sched/sem_waitirq.c | 145 + nuttx/sched/sig_action.c | 272 + nuttx/sched/sig_allocatependingsigaction.c | 136 + nuttx/sched/sig_cleanup.c | 118 + nuttx/sched/sig_deliver.c | 167 + nuttx/sched/sig_findaction.c | 100 + nuttx/sched/sig_initialize.c | 265 + nuttx/sched/sig_internal.h | 191 + nuttx/sched/sig_kill.c | 139 + nuttx/sched/sig_lowest.c | 90 + nuttx/sched/sig_mqnotempty.c | 128 + nuttx/sched/sig_pending.c | 129 + nuttx/sched/sig_procmask.c | 179 + nuttx/sched/sig_queue.c | 161 + nuttx/sched/sig_received.c | 403 + nuttx/sched/sig_releasependingsigaction.c | 120 + nuttx/sched/sig_releasependingsignal.c | 126 + nuttx/sched/sig_removependingsignal.c | 109 + nuttx/sched/sig_suspend.c | 177 + nuttx/sched/sig_timedwait.c | 296 + nuttx/sched/sig_unmaskpendingsignal.c | 138 + nuttx/sched/sig_waitinfo.c | 89 + nuttx/sched/sleep.c | 102 + nuttx/sched/task_activate.c | 118 + nuttx/sched/task_create.c | 274 + nuttx/sched/task_delete.c | 166 + nuttx/sched/task_deletecurrent.c | 140 + nuttx/sched/task_exithook.c | 157 + nuttx/sched/task_init.c | 153 + nuttx/sched/task_restart.c | 183 + nuttx/sched/task_setup.c | 347 + nuttx/sched/task_start.c | 115 + nuttx/sched/timer_create.c | 237 + nuttx/sched/timer_delete.c | 103 + nuttx/sched/timer_getoverrun.c | 109 + nuttx/sched/timer_gettime.c | 121 + nuttx/sched/timer_initialize.c | 167 + nuttx/sched/timer_internal.h | 102 + nuttx/sched/timer_release.c | 159 + nuttx/sched/timer_settime.c | 395 + nuttx/sched/usleep.c | 98 + nuttx/sched/wd_cancel.c | 164 + nuttx/sched/wd_create.c | 108 + nuttx/sched/wd_delete.c | 127 + nuttx/sched/wd_gettime.c | 118 + nuttx/sched/wd_initialize.c | 138 + nuttx/sched/wd_internal.h | 121 + nuttx/sched/wd_start.c | 384 + nuttx/sched/work_cancel.c | 116 + nuttx/sched/work_internal.h | 112 + nuttx/sched/work_queue.c | 131 + nuttx/sched/work_thread.c | 215 + nuttx/syscall/Makefile | 113 + nuttx/syscall/README.txt | 143 + nuttx/syscall/proxies/Make.defs | 37 + nuttx/syscall/stub_lookup.c | 268 + nuttx/syscall/stub_lookup.h | 258 + nuttx/syscall/stubs/Make.defs | 38 + nuttx/syscall/syscall.csv | 140 + nuttx/tools/Makefile.export | 66 + nuttx/tools/Makefile.host | 67 + nuttx/tools/README.txt | 303 + nuttx/tools/bdf-converter.c | 675 + nuttx/tools/cfgparser.c | 168 + nuttx/tools/cfgparser.h | 64 + nuttx/tools/configure.sh | 168 + nuttx/tools/define.sh | 224 + nuttx/tools/incdir.sh | 211 + nuttx/tools/indent.sh | 85 + nuttx/tools/link.sh | 87 + nuttx/tools/mkconfig.c | 250 + nuttx/tools/mkdeps.sh | 196 + nuttx/tools/mkexport.sh | 309 + nuttx/tools/mkimage.sh | 289 + nuttx/tools/mknulldeps.sh | 34 + nuttx/tools/mkromfsimg.sh | 261 + nuttx/tools/mksyscall.c | 831 + nuttx/tools/mkversion.c | 106 + nuttx/tools/unlink.sh | 70 + nuttx/tools/version.sh | 135 + nuttx/tools/winlink.sh | 102 + nuttx/tools/zipme.sh | 178 + 4394 files changed, 1077774 insertions(+) create mode 100755 apps/ChangeLog.txt create mode 100755 apps/Make.defs create mode 100644 apps/Makefile create mode 100644 apps/README.txt create mode 100644 apps/examples/Makefile create mode 100644 apps/examples/README.txt create mode 100644 apps/examples/adc/Makefile create mode 100755 apps/examples/adc/adc.h create mode 100644 apps/examples/adc/adc_main.c create mode 100644 apps/examples/buttons/Makefile create mode 100644 apps/examples/buttons/main.c create mode 100644 apps/examples/dhcpd/Makefile create mode 100644 apps/examples/dhcpd/Makefile.host create mode 100644 apps/examples/dhcpd/host.c create mode 100644 apps/examples/dhcpd/target.c create mode 100644 apps/examples/ftpc/Makefile create mode 100644 apps/examples/ftpc/ftpc.h create mode 100755 apps/examples/ftpc/ftpc_cmds.c create mode 100755 apps/examples/ftpc/ftpc_main.c create mode 100644 apps/examples/hello/Makefile create mode 100644 apps/examples/hello/main.c create mode 100644 apps/examples/helloxx/Makefile create mode 100644 apps/examples/helloxx/main.cxx create mode 100644 apps/examples/hidkbd/Makefile create mode 100644 apps/examples/hidkbd/hidkbd_main.c create mode 100755 apps/examples/igmp/Makefile create mode 100755 apps/examples/igmp/igmp.c create mode 100755 apps/examples/igmp/igmp.h create mode 100644 apps/examples/lcdrw/Makefile create mode 100644 apps/examples/lcdrw/lcdrw_main.c create mode 100644 apps/examples/mm/Makefile create mode 100644 apps/examples/mm/mm_main.c create mode 100644 apps/examples/mount/Makefile create mode 100644 apps/examples/mount/mount.h create mode 100644 apps/examples/mount/mount_main.c create mode 100644 apps/examples/mount/ramdisk.c create mode 100644 apps/examples/nettest/Makefile create mode 100644 apps/examples/nettest/host.c create mode 100644 apps/examples/nettest/nettest.c create mode 100644 apps/examples/nettest/nettest.h create mode 100644 apps/examples/nettest/nettest_client.c create mode 100644 apps/examples/nettest/nettest_server.c create mode 100644 apps/examples/nsh/Makefile create mode 100644 apps/examples/nsh/nsh_main.c create mode 100644 apps/examples/null/Makefile create mode 100644 apps/examples/null/null_main.c create mode 100644 apps/examples/nx/Makefile create mode 100644 apps/examples/nx/nx_events.c create mode 100644 apps/examples/nx/nx_internal.h create mode 100644 apps/examples/nx/nx_kbdin.c create mode 100644 apps/examples/nx/nx_main.c create mode 100644 apps/examples/nx/nx_server.c create mode 100644 apps/examples/nxffs/Makefile create mode 100644 apps/examples/nxffs/nxffs_main.c create mode 100644 apps/examples/nxflat/Makefile create mode 100644 apps/examples/nxflat/nxflat_main.c create mode 100644 apps/examples/nxflat/tests/Makefile create mode 100644 apps/examples/nxflat/tests/errno/Makefile create mode 100644 apps/examples/nxflat/tests/errno/errno.c create mode 100644 apps/examples/nxflat/tests/hello++/Makefile create mode 100644 apps/examples/nxflat/tests/hello++/hello++1.cpp create mode 100644 apps/examples/nxflat/tests/hello++/hello++2.cpp create mode 100644 apps/examples/nxflat/tests/hello++/hello++3.cpp create mode 100644 apps/examples/nxflat/tests/hello++/hello++4.cpp create mode 100644 apps/examples/nxflat/tests/hello/Makefile create mode 100644 apps/examples/nxflat/tests/hello/hello.c create mode 100644 apps/examples/nxflat/tests/longjmp/Makefile create mode 100644 apps/examples/nxflat/tests/longjmp/longjmp.c create mode 100755 apps/examples/nxflat/tests/mkdirlist.sh create mode 100755 apps/examples/nxflat/tests/mksymtab.sh create mode 100644 apps/examples/nxflat/tests/mutex/Makefile create mode 100644 apps/examples/nxflat/tests/mutex/mutex.c create mode 100644 apps/examples/nxflat/tests/pthread/Makefile create mode 100644 apps/examples/nxflat/tests/pthread/pthread.c create mode 100644 apps/examples/nxflat/tests/signal/Makefile create mode 100644 apps/examples/nxflat/tests/signal/signal.c create mode 100644 apps/examples/nxflat/tests/struct/Makefile create mode 100644 apps/examples/nxflat/tests/struct/struct.h create mode 100644 apps/examples/nxflat/tests/struct/struct_dummy.c create mode 100644 apps/examples/nxflat/tests/struct/struct_main.c create mode 100644 apps/examples/nxflat/tests/task/Makefile create mode 100644 apps/examples/nxflat/tests/task/task.c create mode 100644 apps/examples/nxhello/Makefile create mode 100644 apps/examples/nxhello/nxhello.h create mode 100644 apps/examples/nxhello/nxhello_bkgd.c create mode 100644 apps/examples/nxhello/nxhello_main.c create mode 100755 apps/examples/nximage/Makefile create mode 100755 apps/examples/nximage/nximage.h create mode 100644 apps/examples/nximage/nximage_bitmap.c create mode 100755 apps/examples/nximage/nximage_bkgd.c create mode 100755 apps/examples/nximage/nximage_main.c create mode 100644 apps/examples/nxlines/Makefile create mode 100644 apps/examples/nxlines/nxlines.h create mode 100644 apps/examples/nxlines/nxlines_bkgd.c create mode 100644 apps/examples/nxlines/nxlines_main.c create mode 100644 apps/examples/nxtext/Makefile create mode 100644 apps/examples/nxtext/nxtext_bkgd.c create mode 100644 apps/examples/nxtext/nxtext_internal.h create mode 100644 apps/examples/nxtext/nxtext_main.c create mode 100644 apps/examples/nxtext/nxtext_popup.c create mode 100644 apps/examples/nxtext/nxtext_putc.c create mode 100644 apps/examples/nxtext/nxtext_server.c create mode 100644 apps/examples/ostest/Makefile create mode 100644 apps/examples/ostest/barrier.c create mode 100644 apps/examples/ostest/cancel.c create mode 100644 apps/examples/ostest/cond.c create mode 100644 apps/examples/ostest/dev_null.c create mode 100644 apps/examples/ostest/main.c create mode 100644 apps/examples/ostest/mqueue.c create mode 100644 apps/examples/ostest/mutex.c create mode 100644 apps/examples/ostest/ostest.h create mode 100644 apps/examples/ostest/posixtimer.c create mode 100644 apps/examples/ostest/prioinherit.c create mode 100644 apps/examples/ostest/rmutex.c create mode 100644 apps/examples/ostest/roundrobin.c create mode 100644 apps/examples/ostest/sem.c create mode 100644 apps/examples/ostest/sighand.c create mode 100644 apps/examples/ostest/timedmqueue.c create mode 100644 apps/examples/ostest/timedwait.c create mode 100644 apps/examples/pashello/Makefile create mode 100644 apps/examples/pashello/README.txt create mode 100644 apps/examples/pashello/device.c create mode 100644 apps/examples/pashello/hello.h create mode 100644 apps/examples/pashello/hello.pas create mode 100644 apps/examples/pashello/hello.pex create mode 100755 apps/examples/pashello/mkhello.sh create mode 100644 apps/examples/pashello/pashello.c create mode 100644 apps/examples/pashello/pashello.h create mode 100644 apps/examples/pipe/Makefile create mode 100644 apps/examples/pipe/interlock_test.c create mode 100644 apps/examples/pipe/pipe.h create mode 100644 apps/examples/pipe/pipe_main.c create mode 100644 apps/examples/pipe/redirect_test.c create mode 100644 apps/examples/pipe/transfer_test.c create mode 100644 apps/examples/poll/Makefile create mode 100644 apps/examples/poll/Makefile.host create mode 100644 apps/examples/poll/host.c create mode 100644 apps/examples/poll/net_listener.c create mode 100644 apps/examples/poll/net_reader.c create mode 100644 apps/examples/poll/poll_internal.h create mode 100644 apps/examples/poll/poll_listener.c create mode 100644 apps/examples/poll/poll_main.c create mode 100644 apps/examples/poll/select_listener.c create mode 100644 apps/examples/rgmp/Makefile create mode 100644 apps/examples/rgmp/main.c create mode 100644 apps/examples/romfs/Makefile create mode 100644 apps/examples/romfs/romfs_main.c create mode 100644 apps/examples/romfs/romfs_testdir.h create mode 100644 apps/examples/romfs/testdir.tar.gz create mode 100644 apps/examples/romfs/testdir.txt create mode 100644 apps/examples/sendmail/Makefile create mode 100644 apps/examples/sendmail/Makefile.host create mode 100644 apps/examples/sendmail/host.c create mode 100755 apps/examples/sendmail/hostdefs.h create mode 100644 apps/examples/sendmail/target.c create mode 100644 apps/examples/serloop/Makefile create mode 100644 apps/examples/serloop/main.c create mode 100644 apps/examples/thttpd/Makefile create mode 100644 apps/examples/thttpd/content/Makefile create mode 100644 apps/examples/thttpd/content/hello/Makefile create mode 100644 apps/examples/thttpd/content/hello/hello.c create mode 100644 apps/examples/thttpd/content/index.html create mode 100755 apps/examples/thttpd/content/mksymtab.sh create mode 100644 apps/examples/thttpd/content/netstat/Makefile create mode 100755 apps/examples/thttpd/content/netstat/netstat.c create mode 100644 apps/examples/thttpd/content/style.css create mode 100755 apps/examples/thttpd/content/tasks/Makefile create mode 100755 apps/examples/thttpd/content/tasks/tasks.c create mode 100644 apps/examples/thttpd/main.c create mode 100644 apps/examples/tiff/Makefile create mode 100644 apps/examples/tiff/tiff_main.c create mode 100644 apps/examples/touchscreen/Makefile create mode 100644 apps/examples/touchscreen/tc.h create mode 100644 apps/examples/touchscreen/tc_main.c create mode 100644 apps/examples/udp/Makefile create mode 100644 apps/examples/udp/host.c create mode 100644 apps/examples/udp/target.c create mode 100644 apps/examples/udp/udp-client.c create mode 100644 apps/examples/udp/udp-internal.h create mode 100644 apps/examples/udp/udp-server.c create mode 100644 apps/examples/uip/Makefile create mode 100644 apps/examples/uip/main.c create mode 100644 apps/examples/usbserial/Makefile create mode 100644 apps/examples/usbserial/Makefile.host create mode 100644 apps/examples/usbserial/host.c create mode 100644 apps/examples/usbserial/main.c create mode 100644 apps/examples/usbstorage/Makefile create mode 100644 apps/examples/usbstorage/usbstrg.h create mode 100644 apps/examples/usbstorage/usbstrg_main.c create mode 100644 apps/examples/usbterm/Makefile create mode 100644 apps/examples/usbterm/usbterm.h create mode 100644 apps/examples/usbterm/usbterm_main.c create mode 100644 apps/examples/wget/Makefile create mode 100644 apps/examples/wget/Makefile.host create mode 100644 apps/examples/wget/host.c create mode 100755 apps/examples/wget/hostdefs.h create mode 100644 apps/examples/wget/target.c create mode 100755 apps/examples/wlan/Makefile create mode 100755 apps/examples/wlan/wlan_main.c create mode 100644 apps/graphics/Makefile create mode 100644 apps/graphics/tiff/Makefile create mode 100644 apps/graphics/tiff/README.txt create mode 100644 apps/graphics/tiff/tiff_addstrip.c create mode 100644 apps/graphics/tiff/tiff_finalize.c create mode 100644 apps/graphics/tiff/tiff_initialize.c create mode 100644 apps/graphics/tiff/tiff_internal.h create mode 100644 apps/graphics/tiff/tiff_utils.c create mode 100644 apps/include/apps.h create mode 100644 apps/include/ftpc.h create mode 100644 apps/include/netutils/dhcpc.h create mode 100644 apps/include/netutils/dhcpd.h create mode 100644 apps/include/netutils/httpd.h create mode 100755 apps/include/netutils/ipmsfilter.h create mode 100644 apps/include/netutils/resolv.h create mode 100644 apps/include/netutils/smtp.h create mode 100644 apps/include/netutils/telnetd.h create mode 100644 apps/include/netutils/tftp.h create mode 100644 apps/include/netutils/thttpd.h create mode 100644 apps/include/netutils/uiplib.h create mode 100644 apps/include/netutils/webclient.h create mode 100644 apps/include/nsh.h create mode 100644 apps/include/tiff.h create mode 100644 apps/interpreters/Makefile create mode 100644 apps/interpreters/README.txt create mode 100644 apps/interpreters/ficl/Makefile create mode 100755 apps/interpreters/ficl/README.txt create mode 100755 apps/interpreters/ficl/configure.sh create mode 100644 apps/interpreters/ficl/src/nuttx.c create mode 100644 apps/interpreters/ficl/src/nuttx.h create mode 100644 apps/namedapp/Makefile create mode 100644 apps/namedapp/binfs.c create mode 100644 apps/namedapp/exec_namedapp.c create mode 100644 apps/namedapp/namedapp.c create mode 100644 apps/namedapp/namedapp.h create mode 100644 apps/netutils/Makefile create mode 100644 apps/netutils/README.txt create mode 100644 apps/netutils/dhcpc/Makefile create mode 100644 apps/netutils/dhcpc/dhcpc.c create mode 100644 apps/netutils/dhcpd/Makefile create mode 100644 apps/netutils/dhcpd/dhcpd.c create mode 100644 apps/netutils/ftpc/Makefile create mode 100644 apps/netutils/ftpc/README.txt create mode 100644 apps/netutils/ftpc/ftpc_cdup.c create mode 100644 apps/netutils/ftpc/ftpc_chdir.c create mode 100644 apps/netutils/ftpc/ftpc_chmod.c create mode 100644 apps/netutils/ftpc/ftpc_cmd.c create mode 100644 apps/netutils/ftpc/ftpc_config.h create mode 100644 apps/netutils/ftpc/ftpc_connect.c create mode 100644 apps/netutils/ftpc/ftpc_disconnect.c create mode 100644 apps/netutils/ftpc/ftpc_filesize.c create mode 100644 apps/netutils/ftpc/ftpc_filetime.c create mode 100644 apps/netutils/ftpc/ftpc_getfile.c create mode 100644 apps/netutils/ftpc/ftpc_getreply.c create mode 100644 apps/netutils/ftpc/ftpc_help.c create mode 100644 apps/netutils/ftpc/ftpc_idle.c create mode 100644 apps/netutils/ftpc/ftpc_internal.h create mode 100644 apps/netutils/ftpc/ftpc_listdir.c create mode 100644 apps/netutils/ftpc/ftpc_login.c create mode 100644 apps/netutils/ftpc/ftpc_mkdir.c create mode 100644 apps/netutils/ftpc/ftpc_noop.c create mode 100644 apps/netutils/ftpc/ftpc_putfile.c create mode 100644 apps/netutils/ftpc/ftpc_quit.c create mode 100644 apps/netutils/ftpc/ftpc_rename.c create mode 100644 apps/netutils/ftpc/ftpc_response.c create mode 100644 apps/netutils/ftpc/ftpc_rmdir.c create mode 100644 apps/netutils/ftpc/ftpc_rpwd.c create mode 100644 apps/netutils/ftpc/ftpc_socket.c create mode 100644 apps/netutils/ftpc/ftpc_transfer.c create mode 100644 apps/netutils/ftpc/ftpc_unlink.c create mode 100644 apps/netutils/ftpc/ftpc_utils.c create mode 100644 apps/netutils/resolv/Makefile create mode 100644 apps/netutils/resolv/resolv.c create mode 100644 apps/netutils/smtp/Makefile create mode 100644 apps/netutils/smtp/smtp.c create mode 100644 apps/netutils/telnetd/Makefile create mode 100644 apps/netutils/telnetd/README.txt create mode 100644 apps/netutils/telnetd/shell.c create mode 100644 apps/netutils/telnetd/shell.h create mode 100644 apps/netutils/telnetd/telnetd.c create mode 100644 apps/netutils/tftpc/Makefile create mode 100644 apps/netutils/tftpc/tftpc_get.c create mode 100644 apps/netutils/tftpc/tftpc_internal.h create mode 100644 apps/netutils/tftpc/tftpc_packets.c create mode 100644 apps/netutils/tftpc/tftpc_put.c create mode 100644 apps/netutils/thttpd/Makefile create mode 100644 apps/netutils/thttpd/cgi-src/Makefile create mode 100644 apps/netutils/thttpd/cgi-src/phf.c create mode 100644 apps/netutils/thttpd/cgi-src/redirect.c create mode 100644 apps/netutils/thttpd/cgi-src/ssi.c create mode 100644 apps/netutils/thttpd/config.h create mode 100644 apps/netutils/thttpd/fdwatch.c create mode 100644 apps/netutils/thttpd/fdwatch.h create mode 100644 apps/netutils/thttpd/libhttpd.c create mode 100644 apps/netutils/thttpd/libhttpd.h create mode 100644 apps/netutils/thttpd/mime_types.h create mode 100644 apps/netutils/thttpd/tdate_parse.c create mode 100644 apps/netutils/thttpd/tdate_parse.h create mode 100644 apps/netutils/thttpd/thttpd.c create mode 100755 apps/netutils/thttpd/thttpd_alloc.c create mode 100755 apps/netutils/thttpd/thttpd_alloc.h create mode 100755 apps/netutils/thttpd/thttpd_cgi.c create mode 100755 apps/netutils/thttpd/thttpd_cgi.h create mode 100755 apps/netutils/thttpd/thttpd_strings.c create mode 100755 apps/netutils/thttpd/thttpd_strings.h create mode 100644 apps/netutils/thttpd/timers.c create mode 100644 apps/netutils/thttpd/timers.h create mode 100644 apps/netutils/uiplib/Makefile create mode 100644 apps/netutils/uiplib/uip_gethostaddr.c create mode 100644 apps/netutils/uiplib/uip_getmacaddr.c create mode 100755 apps/netutils/uiplib/uip_ipmsfilter.c create mode 100644 apps/netutils/uiplib/uip_parsehttpurl.c create mode 100644 apps/netutils/uiplib/uip_server.c create mode 100644 apps/netutils/uiplib/uip_setdraddr.c create mode 100644 apps/netutils/uiplib/uip_sethostaddr.c create mode 100644 apps/netutils/uiplib/uip_setmacaddr.c create mode 100644 apps/netutils/uiplib/uip_setnetmask.c create mode 100644 apps/netutils/uiplib/uiplib.c create mode 100644 apps/netutils/webclient/Makefile create mode 100644 apps/netutils/webclient/webclient.c create mode 100644 apps/netutils/webserver/Makefile create mode 100644 apps/netutils/webserver/httpd.c create mode 100644 apps/netutils/webserver/httpd.h create mode 100644 apps/netutils/webserver/httpd_cgi.c create mode 100644 apps/netutils/webserver/httpd_cgi.h create mode 100644 apps/netutils/webserver/httpd_fs.c create mode 100644 apps/netutils/webserver/httpd_fsdata.c create mode 100644 apps/netutils/webserver/httpd_fsdata.h create mode 100755 apps/netutils/webserver/makefsdata create mode 100644 apps/nshlib/Makefile create mode 100644 apps/nshlib/README.txt create mode 100644 apps/nshlib/nsh.h create mode 100644 apps/nshlib/nsh_apps.c create mode 100644 apps/nshlib/nsh_dbgcmds.c create mode 100644 apps/nshlib/nsh_ddcmd.c create mode 100644 apps/nshlib/nsh_envcmds.c create mode 100644 apps/nshlib/nsh_fscmds.c create mode 100644 apps/nshlib/nsh_mmcmds.c create mode 100644 apps/nshlib/nsh_netcmds.c create mode 100644 apps/nshlib/nsh_netinit.c create mode 100644 apps/nshlib/nsh_parse.c create mode 100644 apps/nshlib/nsh_proccmds.c create mode 100644 apps/nshlib/nsh_romfsetc.c create mode 100644 apps/nshlib/nsh_romfsimg.h create mode 100644 apps/nshlib/nsh_serial.c create mode 100644 apps/nshlib/nsh_telnetd.c create mode 100644 apps/nshlib/nsh_test.c create mode 100644 apps/nshlib/nsh_timcmds.c create mode 100644 apps/nshlib/rcS.template create mode 100644 apps/system/Makefile create mode 100644 apps/system/free/Makefile create mode 100644 apps/system/free/README.txt create mode 100644 apps/system/free/free.c create mode 100644 apps/system/i2c/Makefile create mode 100755 apps/system/i2c/README.txt create mode 100644 apps/system/i2c/i2c_bus.c create mode 100644 apps/system/i2c/i2c_common.c create mode 100644 apps/system/i2c/i2c_dev.c create mode 100644 apps/system/i2c/i2c_get.c create mode 100644 apps/system/i2c/i2c_main.c create mode 100644 apps/system/i2c/i2c_set.c create mode 100644 apps/system/i2c/i2c_verf.c create mode 100644 apps/system/i2c/i2ctool.h create mode 100755 apps/system/install/Makefile create mode 100755 apps/system/install/README.txt create mode 100755 apps/system/install/install.c create mode 100644 apps/vsn/Makefile create mode 100644 apps/vsn/hello/Makefile create mode 100644 apps/vsn/hello/README.txt create mode 100644 apps/vsn/hello/hello.c create mode 100644 apps/vsn/poweroff/Makefile create mode 100644 apps/vsn/poweroff/README.txt create mode 100644 apps/vsn/poweroff/poweroff.c create mode 100644 apps/vsn/ramtron/Makefile create mode 100644 apps/vsn/ramtron/README.txt create mode 100644 apps/vsn/ramtron/ramtron.c create mode 100644 apps/vsn/sdcard/Makefile create mode 100644 apps/vsn/sdcard/README.txt create mode 100644 apps/vsn/sdcard/sdcard.c create mode 100644 apps/vsn/sysinfo/Makefile create mode 100644 apps/vsn/sysinfo/README.txt create mode 100644 apps/vsn/sysinfo/sysinfo.c create mode 100644 misc/LICENSING.txt create mode 100644 misc/buildroot/.defconfig create mode 100644 misc/buildroot/ChangeLog create mode 100644 misc/buildroot/Config.in create mode 100644 misc/buildroot/Makefile create mode 100644 misc/buildroot/ReleaseNotes create mode 100644 misc/buildroot/configs/README.txt create mode 100644 misc/buildroot/configs/arm-defconfig create mode 100644 misc/buildroot/configs/arm7tdmi-defconfig-4.2.4 create mode 100644 misc/buildroot/configs/arm7tdmi-defconfig-4.3.3 create mode 100644 misc/buildroot/configs/arm920t-defconfig-4.2.4 create mode 100644 misc/buildroot/configs/arm920t-defconfig-4.3.3 create mode 100644 misc/buildroot/configs/arm920t-eabi-defconfig-4.5.2 create mode 100644 misc/buildroot/configs/arm926t-defconfig-4.2.4 create mode 100644 misc/buildroot/configs/arm926t-defconfig-4.3.3 create mode 100644 misc/buildroot/configs/arm926t-defconfig-nxflat create mode 100644 misc/buildroot/configs/avr-defconfig-4.3.3 create mode 100644 misc/buildroot/configs/avr-defconfig-4.5.2 create mode 100644 misc/buildroot/configs/bfin-defconfig-4.2.4 create mode 100644 misc/buildroot/configs/cortexm3-defconfig-4.3.3 create mode 100644 misc/buildroot/configs/cortexm3-defconfig-nxflat create mode 100644 misc/buildroot/configs/gdb-6_8-cygwin-1_7.patch create mode 100644 misc/buildroot/configs/h8300_defconfig create mode 100644 misc/buildroot/configs/i486-defconfig-4.3.3 create mode 100644 misc/buildroot/configs/m32c-defconfig-4.2.4 create mode 100644 misc/buildroot/configs/m32c-defconfig-4.3.3 create mode 100644 misc/buildroot/configs/m68hc11-config create mode 100644 misc/buildroot/configs/m68hc12-config-3.4.6 create mode 100644 misc/buildroot/configs/m68hc12-config-4.3.3 create mode 100644 misc/buildroot/configs/m68k-defconfig create mode 100644 misc/buildroot/configs/m9s12x-config-3.3.6 create mode 100644 misc/buildroot/configs/sh-defconfig create mode 100644 misc/buildroot/package/Makefile.in create mode 100644 misc/buildroot/package/config/Kconfig-language.txt create mode 100644 misc/buildroot/package/config/Makefile create mode 100644 misc/buildroot/package/config/conf.c create mode 100644 misc/buildroot/package/config/confdata.c create mode 100644 misc/buildroot/package/config/expr.c create mode 100644 misc/buildroot/package/config/expr.h create mode 100644 misc/buildroot/package/config/lex.zconf.c_shipped create mode 100644 misc/buildroot/package/config/lkc.h create mode 100644 misc/buildroot/package/config/lkc_proto.h create mode 100644 misc/buildroot/package/config/lxdialog/BIG.FAT.WARNING create mode 100644 misc/buildroot/package/config/lxdialog/checklist.c create mode 100644 misc/buildroot/package/config/lxdialog/colors.h create mode 100644 misc/buildroot/package/config/lxdialog/dialog.h create mode 100644 misc/buildroot/package/config/lxdialog/inputbox.c create mode 100644 misc/buildroot/package/config/lxdialog/menubox.c create mode 100644 misc/buildroot/package/config/lxdialog/msgbox.c create mode 100644 misc/buildroot/package/config/lxdialog/textbox.c create mode 100644 misc/buildroot/package/config/lxdialog/util.c create mode 100644 misc/buildroot/package/config/lxdialog/yesno.c create mode 100644 misc/buildroot/package/config/mconf.c create mode 100644 misc/buildroot/package/config/menu.c create mode 100644 misc/buildroot/package/config/symbol.c create mode 100644 misc/buildroot/package/config/util.c create mode 100644 misc/buildroot/package/config/zconf.l create mode 100644 misc/buildroot/package/config/zconf.tab.c_shipped create mode 100644 misc/buildroot/package/config/zconf.tab.h_shipped create mode 100644 misc/buildroot/package/config/zconf.y create mode 100644 misc/buildroot/package/gnuconfig/ChangeLog create mode 100644 misc/buildroot/package/gnuconfig/Makefile create mode 100644 misc/buildroot/package/gnuconfig/README.buildroot create mode 100755 misc/buildroot/package/gnuconfig/config.guess create mode 100755 misc/buildroot/package/gnuconfig/config.sub create mode 100644 misc/buildroot/package/gnuconfig/gnuconfig.mk create mode 100644 misc/buildroot/package/gnuconfig/patches/config.sub.ps2.patch create mode 100644 misc/buildroot/package/gnuconfig/patches/config.sub.sh.patch create mode 100644 misc/buildroot/package/gnuconfig/testsuite/config-guess.data create mode 100644 misc/buildroot/package/gnuconfig/testsuite/config-guess.sh create mode 100644 misc/buildroot/package/gnuconfig/testsuite/config-sub.data create mode 100644 misc/buildroot/package/gnuconfig/testsuite/config-sub.sh create mode 100755 misc/buildroot/package/gnuconfig/testsuite/uname.in create mode 100755 misc/buildroot/package/gnuconfig/uname create mode 100644 misc/buildroot/toolchain/Config.in create mode 100644 misc/buildroot/toolchain/Makefile.in create mode 100644 misc/buildroot/toolchain/binutils/2.17/110-arm-eabi-conf.patch create mode 100644 misc/buildroot/toolchain/binutils/2.17/300-001_ld_makefile_patch.patch create mode 100644 misc/buildroot/toolchain/binutils/2.17/300-006_better_file_error.patch create mode 100644 misc/buildroot/toolchain/binutils/2.17/300-012_check_ldrunpath_length.patch create mode 100644 misc/buildroot/toolchain/binutils/2.17/400-makeinfo-version-check.patch create mode 100644 misc/buildroot/toolchain/binutils/2.17/400-mips-ELF_MAXPAGESIZE-4K.patch create mode 100644 misc/buildroot/toolchain/binutils/2.18/100-s12x-20100504.patch create mode 100644 misc/buildroot/toolchain/binutils/2.19.1/110-arm-eabi-conf.patch create mode 100644 misc/buildroot/toolchain/binutils/2.19.1/120-sh-conf.patch create mode 100644 misc/buildroot/toolchain/binutils/2.19.1/300-001_ld_makefile_patch.patch create mode 100644 misc/buildroot/toolchain/binutils/2.19.1/300-012_check_ldrunpath_length.patch create mode 100644 misc/buildroot/toolchain/binutils/2.19.1/400-thumb-cputype.patch create mode 100644 misc/buildroot/toolchain/binutils/2.19/110-arm-eabi-conf.patch create mode 100644 misc/buildroot/toolchain/binutils/2.19/120-sh-conf.patch create mode 100644 misc/buildroot/toolchain/binutils/2.19/300-001_ld_makefile_patch.patch create mode 100644 misc/buildroot/toolchain/binutils/2.19/300-012_check_ldrunpath_length.patch create mode 100644 misc/buildroot/toolchain/binutils/2.21/110-arm-eabi-conf.patch create mode 100644 misc/buildroot/toolchain/binutils/2.21/120-sh-conf.patch create mode 100644 misc/buildroot/toolchain/binutils/2.21/300-001_ld_makefile_patch.patch create mode 100644 misc/buildroot/toolchain/binutils/2.21/300-012_check_ldrunpath_length.patch create mode 100644 misc/buildroot/toolchain/binutils/Config.in create mode 100644 misc/buildroot/toolchain/binutils/binutils.mk create mode 100644 misc/buildroot/toolchain/dependencies/dependencies.mk create mode 100755 misc/buildroot/toolchain/dependencies/dependencies.sh create mode 100644 misc/buildroot/toolchain/gcc/3.3.6/120-softfloat.patch create mode 100644 misc/buildroot/toolchain/gcc/3.3.6/500-loop.patch create mode 100644 misc/buildroot/toolchain/gcc/3.3.6/800-arm-bigendian.patch create mode 100644 misc/buildroot/toolchain/gcc/3.3.6/810-mips-xgot.patch create mode 100644 misc/buildroot/toolchain/gcc/3.3.6/820-no-mips-empic-relocs.patch create mode 100644 misc/buildroot/toolchain/gcc/3.3.6/830-gcc-bug-num-22167.patch create mode 100644 misc/buildroot/toolchain/gcc/3.3.6/900-sx12-20101109.patch create mode 100644 misc/buildroot/toolchain/gcc/3.3.6/910-create-mode.patch create mode 100644 misc/buildroot/toolchain/gcc/3.4.6/300-libstdc++-pic.patch create mode 100644 misc/buildroot/toolchain/gcc/3.4.6/304-index_macro.patch create mode 100644 misc/buildroot/toolchain/gcc/3.4.6/600-gcc34-arm-ldm-peephole.patch create mode 100644 misc/buildroot/toolchain/gcc/3.4.6/601-gcc34-arm-ldm-peephole2.patch create mode 100644 misc/buildroot/toolchain/gcc/3.4.6/601-gcc34-arm-ldm.patch create mode 100644 misc/buildroot/toolchain/gcc/3.4.6/602-sdk-libstdc++-includes.patch create mode 100644 misc/buildroot/toolchain/gcc/3.4.6/700-pr15068-fix.patch create mode 100644 misc/buildroot/toolchain/gcc/3.4.6/71_all_sh-pr16665-fix.patch create mode 100644 misc/buildroot/toolchain/gcc/3.4.6/72_all_sh-no-reorder-blocks.patch create mode 100644 misc/buildroot/toolchain/gcc/3.4.6/73_all_sh-pr20617.patch create mode 100644 misc/buildroot/toolchain/gcc/3.4.6/800-arm-bigendian.patch create mode 100644 misc/buildroot/toolchain/gcc/3.4.6/810-mips-xgot.patch create mode 100644 misc/buildroot/toolchain/gcc/3.4.6/900-nios2.patch create mode 100644 misc/buildroot/toolchain/gcc/3.4.6/910-gcc-3.4.6-ocreatmode.patch create mode 100644 misc/buildroot/toolchain/gcc/3.4.6/arm-softfloat.patch.conditional create mode 100644 misc/buildroot/toolchain/gcc/4.2.4/300-libstdc++-pic.patch create mode 100644 misc/buildroot/toolchain/gcc/4.2.4/304-index_macro.patch create mode 100644 misc/buildroot/toolchain/gcc/4.2.4/305-libmudflap-susv3-legacy.patch create mode 100644 misc/buildroot/toolchain/gcc/4.2.4/307-locale_facets.patch create mode 100644 misc/buildroot/toolchain/gcc/4.2.4/402-libbackend_dep_gcov-iov.h.patch create mode 100644 misc/buildroot/toolchain/gcc/4.2.4/800-arm-bigendian.patch create mode 100644 misc/buildroot/toolchain/gcc/4.2.4/904-flatten-switch-stmt-00.patch create mode 100644 misc/buildroot/toolchain/gcc/4.2.4/910-soft-float.patch create mode 100644 misc/buildroot/toolchain/gcc/4.2.4/920-soft-float.patch create mode 100644 misc/buildroot/toolchain/gcc/4.2.4/930-nuttx-nolibc.patch create mode 100644 misc/buildroot/toolchain/gcc/4.2.4/940-nuttx-nolibstdc.patch create mode 100644 misc/buildroot/toolchain/gcc/4.3.3/300-libmudflap-susv3-legacy.patch create mode 100644 misc/buildroot/toolchain/gcc/4.3.3/310-arm-softfloat-libgcc.patch create mode 100644 misc/buildroot/toolchain/gcc/4.3.3/500-backport-fix-for-bug-39076.patch create mode 100644 misc/buildroot/toolchain/gcc/4.3.3/510-backport-fix-for-bug-32044.patch create mode 100644 misc/buildroot/toolchain/gcc/4.3.3/600-arm_insn-opinit-RTX_CODE-fixup.patch create mode 100644 misc/buildroot/toolchain/gcc/4.3.3/610-gcc-4.3.0-fix-header.00.patch create mode 100644 misc/buildroot/toolchain/gcc/4.3.3/620-gcc-4.3.2-armeabi-aapcs-linux.patch create mode 100644 misc/buildroot/toolchain/gcc/4.3.3/630-gcc-4.3.0-cris-pragma-pack-warning-remove.patch create mode 100644 misc/buildroot/toolchain/gcc/4.3.3/700-gcc-4.3.3-arm7arch.patch create mode 100755 misc/buildroot/toolchain/gcc/4.3.3/900-nuttx-nolibc.patch create mode 100644 misc/buildroot/toolchain/gcc/4.3.3/910-nuttx-nolibstdc.patch create mode 100644 misc/buildroot/toolchain/gcc/4.3.3/920-gcc-4.3.3-objext.patch create mode 100644 misc/buildroot/toolchain/gcc/4.5.2/305-libmudflap-susv3-legacy.patch create mode 100644 misc/buildroot/toolchain/gcc/4.5.2/810-arm-softfloat-libgcc.patch create mode 100644 misc/buildroot/toolchain/gcc/4.5.2/820-arm-unbreak-armv4t.patch create mode 100644 misc/buildroot/toolchain/gcc/4.5.2/830-arm-pr43440.patch create mode 100644 misc/buildroot/toolchain/gcc/4.5.2/850-arm-pr44392.patch create mode 100644 misc/buildroot/toolchain/gcc/4.5.2/900-nuttx-nolibstdc.patch create mode 100644 misc/buildroot/toolchain/gcc/Config.in create mode 100644 misc/buildroot/toolchain/gcc/Makefile.in create mode 100644 misc/buildroot/toolchain/gcc/gcc-nuttx-3.x.mk create mode 100644 misc/buildroot/toolchain/gcc/gcc-nuttx-4.x.mk create mode 100644 misc/buildroot/toolchain/gcc/i386-gcc-soft-float.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/400-mips-coredump.patch-2.4.23-29 create mode 100644 misc/buildroot/toolchain/gdb/6.3/500-thread-timeout.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/600-debian_10.selected-frame.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/620-debian_static-thread-db.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/630-debian_24.tracepoint-segv.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/640-debian_dwarf2-frame-signal-unwinder.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/650-debian_vsyscall-gdb-support.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/660-debian_dwarf-cfa-restore.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/680-debian_sim-destdir.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/690-debian_member-field-symtab.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/700-debian_cp-pass-by-reference.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/710-debian_thread-db-multiple-libraries.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/720-debian_static-threads-test.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/730-debian_gdb-fix-tracefork-check.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/740-debian_make-cv-type-crash.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/750-debian_sparc-singlestep.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/760-debian_vsyscall-bfd-close-result.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/770-debian_vfork-done-spelling.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/780-debian_gdbserver-rdynamic.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/790-debian_dwarf2-cfi-warning.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/800-debian_linux-use-underscore-exit.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/810-debian_bfd-no-kylix-crash.patch create mode 100644 misc/buildroot/toolchain/gdb/6.3/820-debian_disable-linux-fork-messages.patch create mode 100644 misc/buildroot/toolchain/gdb/6.4/400-mips-coredump.patch-2.4.23-29 create mode 100644 misc/buildroot/toolchain/gdb/6.4/500-thread-timeout.patch create mode 100644 misc/buildroot/toolchain/gdb/6.4/600-fix-compile-flag-mismatch.patch create mode 100644 misc/buildroot/toolchain/gdb/6.4/700-m68hc1x-20060122.patch create mode 100644 misc/buildroot/toolchain/gdb/6.8/600-fix-compile-flag-mismatch.patch create mode 100644 misc/buildroot/toolchain/gdb/Config.in create mode 100644 misc/buildroot/toolchain/gdb/gdb.mk create mode 100644 misc/buildroot/toolchain/gdb/snapshot/400-mips-coredump.patch-2.4.23-29 create mode 100644 misc/buildroot/toolchain/gdb/snapshot/400-mips-nptl-support.patch create mode 100644 misc/buildroot/toolchain/gdb/snapshot/500-thread-timeout.patch create mode 100644 misc/buildroot/toolchain/gdb/snapshot/680-debian_sim-destdir.patch create mode 100644 misc/buildroot/toolchain/gdb/snapshot/690-debian_member-field-symtab.patch create mode 100644 misc/buildroot/toolchain/genromfs/Config.in create mode 100755 misc/buildroot/toolchain/genromfs/genromfs-0.5.2.tar.gz create mode 100644 misc/buildroot/toolchain/genromfs/genromfs.mk create mode 100644 misc/buildroot/toolchain/nxflat/Config.in create mode 100644 misc/buildroot/toolchain/nxflat/Makefile create mode 100644 misc/buildroot/toolchain/nxflat/arm/Makefile create mode 100644 misc/buildroot/toolchain/nxflat/arm/arch.h create mode 100644 misc/buildroot/toolchain/nxflat/arm/disarm.c create mode 100644 misc/buildroot/toolchain/nxflat/arm/dyncall_skeleton.def create mode 100644 misc/buildroot/toolchain/nxflat/ldnxflat.c create mode 100644 misc/buildroot/toolchain/nxflat/mknxflat.c create mode 100644 misc/buildroot/toolchain/nxflat/nxflat.h create mode 100644 misc/buildroot/toolchain/nxflat/nxflat.mk create mode 100644 misc/buildroot/toolchain/nxflat/readnxflat.c create mode 100644 misc/buildroot/toolchain/nxflat/reloc-macros.h create mode 100644 misc/buildroot/toolchain/nxflat/thumb2/Makefile create mode 100644 misc/buildroot/toolchain/nxflat/thumb2/arch.h create mode 100644 misc/buildroot/toolchain/nxflat/thumb2/disthumb2.c create mode 100644 misc/buildroot/toolchain/nxflat/thumb2/dyncall_skeleton.def create mode 100755 misc/buildroot/toolchain/patch-kernel.sh create mode 100644 misc/buildroot/toolchain/sstrip/Config.in create mode 100644 misc/buildroot/toolchain/sstrip/sstrip.c create mode 100644 misc/buildroot/toolchain/sstrip/sstrip.mk create mode 100755 misc/buildroot/zipme.sh create mode 100755 misc/drivers/INSTALL.sh create mode 100755 misc/drivers/rtl8187x/INSTALL.sh create mode 100755 misc/drivers/rtl8187x/rtl8187x.c create mode 100755 misc/drivers/rtl8187x/rtl8187x.h create mode 100644 misc/pascal/ChangeLog create mode 100755 misc/pascal/Configure create mode 100644 misc/pascal/Make.config.h create mode 100644 misc/pascal/Make.defs create mode 100644 misc/pascal/Makefile create mode 100644 misc/pascal/README create mode 100755 misc/pascal/Reconfigure create mode 100644 misc/pascal/ReleaseNotes create mode 100755 misc/pascal/config.info create mode 100644 misc/pascal/doc/PascalGrammar.txt create mode 100644 misc/pascal/doc/PascalNotes.txt create mode 100644 misc/pascal/include/keywords.h create mode 100644 misc/pascal/include/paslib.h create mode 100644 misc/pascal/include/pdefs.h create mode 100644 misc/pascal/include/pedefs.h create mode 100644 misc/pascal/include/perr.h create mode 100644 misc/pascal/include/pfdefs.h create mode 100644 misc/pascal/include/pinsn.h create mode 100644 misc/pascal/include/podefs.h create mode 100644 misc/pascal/include/poff.h create mode 100644 misc/pascal/include/pofflib.h create mode 100644 misc/pascal/include/pxdefs.h create mode 100644 misc/pascal/insn16/Makefile create mode 100644 misc/pascal/insn16/doc/PascalOptimizations.txt create mode 100644 misc/pascal/insn16/doc/PascalTestStatus.txt create mode 100644 misc/pascal/insn16/include/pdbg.h create mode 100644 misc/pascal/insn16/include/pexec.h create mode 100644 misc/pascal/insn16/include/pinsn16.h create mode 100644 misc/pascal/insn16/libinsn/Makefile create mode 100644 misc/pascal/insn16/libinsn/paddopcode.c create mode 100644 misc/pascal/insn16/libinsn/paddtmpopcode.c create mode 100644 misc/pascal/insn16/libinsn/pdasm.c create mode 100644 misc/pascal/insn16/libinsn/pgen.c create mode 100644 misc/pascal/insn16/libinsn/pgetopcode.c create mode 100644 misc/pascal/insn16/libinsn/preloc.c create mode 100644 misc/pascal/insn16/plist/Makefile create mode 100644 misc/pascal/insn16/plist/plist.c create mode 100644 misc/pascal/insn16/popt/Makefile create mode 100644 misc/pascal/insn16/popt/pcopt.c create mode 100644 misc/pascal/insn16/popt/pcopt.h create mode 100644 misc/pascal/insn16/popt/pfopt.c create mode 100644 misc/pascal/insn16/popt/pfopt.h create mode 100644 misc/pascal/insn16/popt/pjopt.c create mode 100644 misc/pascal/insn16/popt/pjopt.h create mode 100644 misc/pascal/insn16/popt/plopt.c create mode 100644 misc/pascal/insn16/popt/plopt.h create mode 100644 misc/pascal/insn16/popt/polocal.c create mode 100644 misc/pascal/insn16/popt/polocal.h create mode 100644 misc/pascal/insn16/popt/popt.c create mode 100644 misc/pascal/insn16/popt/popt.h create mode 100644 misc/pascal/insn16/popt/psopt.c create mode 100644 misc/pascal/insn16/popt/psopt.h create mode 100644 misc/pascal/insn16/prun/Make.defs create mode 100644 misc/pascal/insn16/prun/Makefile create mode 100644 misc/pascal/insn16/prun/pdbg.c create mode 100644 misc/pascal/insn16/prun/pexec.c create mode 100644 misc/pascal/insn16/prun/pload.c create mode 100644 misc/pascal/insn16/prun/prun.c create mode 100644 misc/pascal/insn32/Makefile create mode 100644 misc/pascal/insn32/doc/insn32.txt create mode 100644 misc/pascal/insn32/include/builtins.h create mode 100644 misc/pascal/insn32/include/pexec.h create mode 100644 misc/pascal/insn32/include/pinsn32.h create mode 100644 misc/pascal/insn32/include/rinsn32.h create mode 100644 misc/pascal/insn32/libinsn/Makefile create mode 100644 misc/pascal/insn32/libinsn/paddopcode.c create mode 100644 misc/pascal/insn32/libinsn/paddtmpopcode.c create mode 100644 misc/pascal/insn32/libinsn/pdasm.c create mode 100644 misc/pascal/insn32/libinsn/pgen.c create mode 100644 misc/pascal/insn32/libinsn/pgetopcode.c create mode 100644 misc/pascal/insn32/libinsn/preloc.c create mode 100644 misc/pascal/insn32/libinsn/presettmpopcodewrite.c create mode 100644 misc/pascal/insn32/plist/Makefile create mode 100644 misc/pascal/insn32/plist/plist.c create mode 100644 misc/pascal/insn32/popt/Makefile create mode 100644 misc/pascal/insn32/popt/pcopt.c create mode 100644 misc/pascal/insn32/popt/pcopt.h create mode 100644 misc/pascal/insn32/popt/pfopt.c create mode 100644 misc/pascal/insn32/popt/pfopt.h create mode 100644 misc/pascal/insn32/popt/pjopt.c create mode 100644 misc/pascal/insn32/popt/pjopt.h create mode 100644 misc/pascal/insn32/popt/plopt.c create mode 100644 misc/pascal/insn32/popt/plopt.h create mode 100644 misc/pascal/insn32/popt/polocal.c create mode 100644 misc/pascal/insn32/popt/polocal.h create mode 100644 misc/pascal/insn32/popt/popt.c create mode 100644 misc/pascal/insn32/popt/popt.h create mode 100644 misc/pascal/insn32/popt/psopt.c create mode 100644 misc/pascal/insn32/popt/psopt.h create mode 100644 misc/pascal/insn32/regm/Makefile create mode 100644 misc/pascal/insn32/regm/regm.c create mode 100644 misc/pascal/insn32/regm/regm.h create mode 100644 misc/pascal/insn32/regm/regm_pass1.c create mode 100644 misc/pascal/insn32/regm/regm_pass1.h create mode 100644 misc/pascal/insn32/regm/regm_pass2.c create mode 100644 misc/pascal/insn32/regm/regm_pass2.h create mode 100644 misc/pascal/insn32/regm/regm_registers2.c create mode 100644 misc/pascal/insn32/regm/regm_registers2.h create mode 100644 misc/pascal/insn32/regm/regm_tree.c create mode 100644 misc/pascal/insn32/regm/regm_tree.h create mode 100644 misc/pascal/libpas/Make.defs create mode 100644 misc/pascal/libpas/Makefile create mode 100644 misc/pascal/libpas/pextension.c create mode 100644 misc/pascal/libpas/psignextend16.c create mode 100644 misc/pascal/libpas/pswap.c create mode 100644 misc/pascal/libpoff/Make.defs create mode 100644 misc/pascal/libpoff/Makefile create mode 100644 misc/pascal/libpoff/pfdbgcontainer.c create mode 100644 misc/pascal/libpoff/pfdbgdiscard.c create mode 100644 misc/pascal/libpoff/pfdbginfo.c create mode 100644 misc/pascal/libpoff/pfdhdr.c create mode 100644 misc/pascal/libpoff/pfdreloc.c create mode 100644 misc/pascal/libpoff/pfdsymbol.c create mode 100644 misc/pascal/libpoff/pfhandle.c create mode 100644 misc/pascal/libpoff/pfiprog.c create mode 100644 misc/pascal/libpoff/pfirodata.c create mode 100644 misc/pascal/libpoff/pflabel.c create mode 100644 misc/pascal/libpoff/pflineno.c create mode 100644 misc/pascal/libpoff/pfprivate.h create mode 100644 misc/pascal/libpoff/pfproghandle.c create mode 100644 misc/pascal/libpoff/pfrdbgfunc.c create mode 100644 misc/pascal/libpoff/pfread.c create mode 100644 misc/pascal/libpoff/pfrelease.c create mode 100644 misc/pascal/libpoff/pfrfname.c create mode 100644 misc/pascal/libpoff/pfrhdr.c create mode 100644 misc/pascal/libpoff/pfrlineno.c create mode 100644 misc/pascal/libpoff/pfrprog.c create mode 100644 misc/pascal/libpoff/pfrrawlineno.c create mode 100644 misc/pascal/libpoff/pfrrawreloc.c create mode 100644 misc/pascal/libpoff/pfrseek.c create mode 100644 misc/pascal/libpoff/pfrstring.c create mode 100644 misc/pascal/libpoff/pfrsymbol.c create mode 100644 misc/pascal/libpoff/pfswap.c create mode 100644 misc/pascal/libpoff/pfsymhandle.c create mode 100644 misc/pascal/libpoff/pftprog.c create mode 100644 misc/pascal/libpoff/pftsymbol.c create mode 100644 misc/pascal/libpoff/pfwdbgfunc.c create mode 100644 misc/pascal/libpoff/pfwfname.c create mode 100644 misc/pascal/libpoff/pfwhdr.c create mode 100644 misc/pascal/libpoff/pfwlineno.c create mode 100644 misc/pascal/libpoff/pfwprog.c create mode 100644 misc/pascal/libpoff/pfwreloc.c create mode 100644 misc/pascal/libpoff/pfwrite.c create mode 100644 misc/pascal/libpoff/pfwrodata.c create mode 100644 misc/pascal/libpoff/pfwstring.c create mode 100644 misc/pascal/libpoff/pfwsymbol.c create mode 100644 misc/pascal/libpoff/pfxprog.c create mode 100644 misc/pascal/libpoff/pfxrodata.c create mode 100644 misc/pascal/libpoff/pofferr.c create mode 100755 misc/pascal/nuttx/INSTALL.sh create mode 100644 misc/pascal/nuttx/Makefile create mode 100644 misc/pascal/nuttx/README.txt create mode 100644 misc/pascal/nuttx/keywords.h create mode 100644 misc/pascal/pascal/Makefile create mode 100644 misc/pascal/pascal/pas.c create mode 100644 misc/pascal/pascal/pas.h create mode 100644 misc/pascal/pascal/pasdefs.h create mode 100644 misc/pascal/pascal/pblck.c create mode 100644 misc/pascal/pascal/pblck.h create mode 100644 misc/pascal/pascal/pcexpr.c create mode 100644 misc/pascal/pascal/pcfunc.c create mode 100644 misc/pascal/pascal/perr.c create mode 100644 misc/pascal/pascal/pexpr.c create mode 100644 misc/pascal/pascal/pexpr.h create mode 100644 misc/pascal/pascal/pffunc.c create mode 100644 misc/pascal/pascal/pfunc.h create mode 100644 misc/pascal/pascal/pgen.c create mode 100644 misc/pascal/pascal/pgen.h create mode 100644 misc/pascal/pascal/pprgm.c create mode 100644 misc/pascal/pascal/pprgm.h create mode 100644 misc/pascal/pascal/pproc.c create mode 100644 misc/pascal/pascal/pproc.h create mode 100644 misc/pascal/pascal/pstm.c create mode 100644 misc/pascal/pascal/pstm.h create mode 100644 misc/pascal/pascal/ptbl.c create mode 100644 misc/pascal/pascal/ptbl.h create mode 100644 misc/pascal/pascal/ptdefs.h create mode 100644 misc/pascal/pascal/ptkn.c create mode 100644 misc/pascal/pascal/ptkn.h create mode 100644 misc/pascal/pascal/punit.c create mode 100644 misc/pascal/pascal/punit.h create mode 100644 misc/pascal/plink/Makefile create mode 100644 misc/pascal/plink/plink.c create mode 100644 misc/pascal/plink/plink.h create mode 100644 misc/pascal/plink/plreloc.c create mode 100644 misc/pascal/plink/plreloc.h create mode 100644 misc/pascal/plink/plsym.c create mode 100644 misc/pascal/plink/plsym.h create mode 100755 misc/pascal/tests/501-uses.sh create mode 100755 misc/pascal/tests/debug.sh create mode 100755 misc/pascal/tests/list.sh create mode 100644 misc/pascal/tests/src/001-beginend.pas create mode 100644 misc/pascal/tests/src/002-writeln.pas create mode 100644 misc/pascal/tests/src/003-for.inp create mode 100644 misc/pascal/tests/src/003-for.pas create mode 100644 misc/pascal/tests/src/004-repeat.inp create mode 100644 misc/pascal/tests/src/004-repeat.pas create mode 100644 misc/pascal/tests/src/005-while.inp create mode 100644 misc/pascal/tests/src/005-while.pas create mode 100644 misc/pascal/tests/src/006-optconst.pas create mode 100644 misc/pascal/tests/src/007-function.pas create mode 100644 misc/pascal/tests/src/101-cosine.inp create mode 100644 misc/pascal/tests/src/101-cosine.pas create mode 100644 misc/pascal/tests/src/102-cen2fahr.pas create mode 100644 misc/pascal/tests/src/103-sumharm.inp create mode 100644 misc/pascal/tests/src/103-sumharm.pas create mode 100644 misc/pascal/tests/src/104-primes.pas create mode 100644 misc/pascal/tests/src/105-inflation.pas create mode 100644 misc/pascal/tests/src/201-strcat.pas create mode 100644 misc/pascal/tests/src/202-strcmp.pas create mode 100644 misc/pascal/tests/src/501-unit-cosine.pas create mode 100644 misc/pascal/tests/src/501-unit-data.pas create mode 100644 misc/pascal/tests/src/501-unit-sine.pas create mode 100644 misc/pascal/tests/src/501-uses.inp create mode 100644 misc/pascal/tests/src/501-uses.pas create mode 100644 misc/pascal/tests/src/801-cgihello.pas create mode 100644 misc/pascal/tests/src/802-cgiinfo.pas create mode 100644 misc/pascal/tests/src/803-redirect.pas create mode 100644 misc/pascal/tests/src/804-cgiform.pas create mode 100644 misc/pascal/tests/src/805-cgimail.pas create mode 100644 misc/pascal/tests/src/806-cgicook.pas create mode 100644 misc/pascal/tests/src/901-pageutils.pas create mode 100644 misc/pascal/tests/src/README create mode 100755 misc/pascal/tests/testall.sh create mode 100755 misc/pascal/tests/testone.sh create mode 100755 misc/pascal/zipme create mode 100644 misc/sims/README.txt create mode 100644 misc/sims/z80sim/README.txt create mode 100644 misc/sims/z80sim/example/Makefile create mode 100644 misc/sims/z80sim/example/example.asm create mode 100644 misc/sims/z80sim/src/Makefile create mode 100644 misc/sims/z80sim/src/main.c create mode 100644 misc/tools/genromfs-0.5.2.tar.gz create mode 100755 nuttx/COPYING create mode 100644 nuttx/ChangeLog create mode 100644 nuttx/Documentation/NXGraphicsSubsystem.html create mode 100644 nuttx/Documentation/NXOrganization.gif create mode 100644 nuttx/Documentation/NuttShell.html create mode 100644 nuttx/Documentation/NuttX.html create mode 100755 nuttx/Documentation/NuttX.png create mode 100755 nuttx/Documentation/NuttX2-a.png create mode 100755 nuttx/Documentation/NuttX2-b.png create mode 100755 nuttx/Documentation/NuttX2.png create mode 100755 nuttx/Documentation/NuttX320.png create mode 100644 nuttx/Documentation/NuttXBanner.html create mode 100755 nuttx/Documentation/NuttXCommercial.html create mode 100755 nuttx/Documentation/NuttXDemandPaging.html create mode 100755 nuttx/Documentation/NuttXDocumentation.html create mode 100755 nuttx/Documentation/NuttXLinks.html create mode 100644 nuttx/Documentation/NuttXNxFlat.html create mode 100755 nuttx/Documentation/NuttXRelated.html create mode 100644 nuttx/Documentation/NuttXScreenShot.jpg create mode 100644 nuttx/Documentation/NuttxPortingGuide.html create mode 100644 nuttx/Documentation/NuttxUserGuide.html create mode 100755 nuttx/Documentation/README.html create mode 100755 nuttx/Documentation/UsbTrace.html create mode 100644 nuttx/Documentation/award2_151_50.png create mode 100644 nuttx/Documentation/backgd.gif create mode 100644 nuttx/Documentation/editor_pick_2.png create mode 100644 nuttx/Documentation/favicon.ico create mode 100644 nuttx/Documentation/freeports.gif create mode 100644 nuttx/Documentation/freeports.html create mode 100644 nuttx/Documentation/index.html create mode 100755 nuttx/Documentation/pm.png create mode 100755 nuttx/Documentation/rss.gif create mode 100644 nuttx/Makefile create mode 100755 nuttx/README.txt create mode 100644 nuttx/ReleaseNotes create mode 100644 nuttx/TODO create mode 100644 nuttx/arch/8051/include/arch.h create mode 100644 nuttx/arch/8051/include/irq.h create mode 100644 nuttx/arch/8051/include/limits.h create mode 100644 nuttx/arch/8051/include/syscall.h create mode 100644 nuttx/arch/8051/include/types.h create mode 100644 nuttx/arch/8051/src/Makefile create mode 100644 nuttx/arch/8051/src/up_allocateheap.c create mode 100644 nuttx/arch/8051/src/up_assert.c create mode 100644 nuttx/arch/8051/src/up_blocktask.c create mode 100644 nuttx/arch/8051/src/up_debug.c create mode 100644 nuttx/arch/8051/src/up_delay.c create mode 100644 nuttx/arch/8051/src/up_exit.c create mode 100644 nuttx/arch/8051/src/up_head.S create mode 100644 nuttx/arch/8051/src/up_idle.c create mode 100644 nuttx/arch/8051/src/up_initialize.c create mode 100644 nuttx/arch/8051/src/up_initialstate.c create mode 100644 nuttx/arch/8051/src/up_internal.h create mode 100644 nuttx/arch/8051/src/up_interruptcontext.c create mode 100644 nuttx/arch/8051/src/up_irq.c create mode 100644 nuttx/arch/8051/src/up_irqtest.c create mode 100644 nuttx/arch/8051/src/up_putc.c create mode 100644 nuttx/arch/8051/src/up_releasepending.c create mode 100644 nuttx/arch/8051/src/up_reprioritizertr.c create mode 100644 nuttx/arch/8051/src/up_restorecontext.c create mode 100644 nuttx/arch/8051/src/up_savecontext.c create mode 100644 nuttx/arch/8051/src/up_timerisr.c create mode 100644 nuttx/arch/8051/src/up_unblocktask.c create mode 100644 nuttx/arch/README.txt create mode 100644 nuttx/arch/arm/include/arch.h create mode 100644 nuttx/arch/arm/include/arm/irq.h create mode 100644 nuttx/arch/arm/include/arm/syscall.h create mode 100644 nuttx/arch/arm/include/armv7-m/irq.h create mode 100644 nuttx/arch/arm/include/armv7-m/syscall.h create mode 100644 nuttx/arch/arm/include/c5471/irq.h create mode 100644 nuttx/arch/arm/include/dm320/irq.h create mode 100644 nuttx/arch/arm/include/imx/irq.h create mode 100644 nuttx/arch/arm/include/irq.h create mode 100644 nuttx/arch/arm/include/kinetis/irq.h create mode 100644 nuttx/arch/arm/include/limits.h create mode 100644 nuttx/arch/arm/include/lm3s/irq.h create mode 100755 nuttx/arch/arm/include/lpc17xx/irq.h create mode 100644 nuttx/arch/arm/include/lpc214x/irq.h create mode 100755 nuttx/arch/arm/include/lpc2378/irq.h create mode 100755 nuttx/arch/arm/include/lpc31xx/irq.h create mode 100755 nuttx/arch/arm/include/sam3u/irq.h create mode 100644 nuttx/arch/arm/include/serial.h create mode 100644 nuttx/arch/arm/include/stm32/chip.h create mode 100644 nuttx/arch/arm/include/stm32/irq.h create mode 100644 nuttx/arch/arm/include/stm32/stm32f10xxx_irq.h create mode 100644 nuttx/arch/arm/include/stm32/stm32f40xxx_irq.h create mode 100644 nuttx/arch/arm/include/str71x/irq.h create mode 100644 nuttx/arch/arm/include/syscall.h create mode 100644 nuttx/arch/arm/include/types.h create mode 100644 nuttx/arch/arm/include/watchdog.h create mode 100644 nuttx/arch/arm/src/Makefile create mode 100644 nuttx/arch/arm/src/arm/arm.h create mode 100644 nuttx/arch/arm/src/arm/pg_macros.h create mode 100755 nuttx/arch/arm/src/arm/up_allocpage.c create mode 100644 nuttx/arch/arm/src/arm/up_assert.c create mode 100755 nuttx/arch/arm/src/arm/up_blocktask.c create mode 100644 nuttx/arch/arm/src/arm/up_cache.S create mode 100755 nuttx/arch/arm/src/arm/up_checkmapping.c create mode 100644 nuttx/arch/arm/src/arm/up_copystate.c create mode 100644 nuttx/arch/arm/src/arm/up_dataabort.c create mode 100644 nuttx/arch/arm/src/arm/up_doirq.c create mode 100644 nuttx/arch/arm/src/arm/up_fullcontextrestore.S create mode 100644 nuttx/arch/arm/src/arm/up_head.S create mode 100644 nuttx/arch/arm/src/arm/up_initialstate.c create mode 100644 nuttx/arch/arm/src/arm/up_nommuhead.S create mode 100755 nuttx/arch/arm/src/arm/up_pginitialize.c create mode 100644 nuttx/arch/arm/src/arm/up_prefetchabort.c create mode 100755 nuttx/arch/arm/src/arm/up_releasepending.c create mode 100755 nuttx/arch/arm/src/arm/up_reprioritizertr.c create mode 100644 nuttx/arch/arm/src/arm/up_saveusercontext.S create mode 100644 nuttx/arch/arm/src/arm/up_schedulesigaction.c create mode 100644 nuttx/arch/arm/src/arm/up_sigdeliver.c create mode 100644 nuttx/arch/arm/src/arm/up_syscall.c create mode 100755 nuttx/arch/arm/src/arm/up_unblocktask.c create mode 100644 nuttx/arch/arm/src/arm/up_undefinedinsn.c create mode 100755 nuttx/arch/arm/src/arm/up_va2pte.c create mode 100644 nuttx/arch/arm/src/arm/up_vectoraddrexcptn.S create mode 100644 nuttx/arch/arm/src/arm/up_vectors.S create mode 100644 nuttx/arch/arm/src/arm/up_vectortab.S create mode 100644 nuttx/arch/arm/src/armv7-m/exc_return.h create mode 100644 nuttx/arch/arm/src/armv7-m/mpu.h create mode 100644 nuttx/arch/arm/src/armv7-m/nvic.h create mode 100644 nuttx/arch/arm/src/armv7-m/psr.h create mode 100644 nuttx/arch/arm/src/armv7-m/svcall.h create mode 100644 nuttx/arch/arm/src/armv7-m/up_assert.c create mode 100755 nuttx/arch/arm/src/armv7-m/up_blocktask.c create mode 100644 nuttx/arch/arm/src/armv7-m/up_copystate.c create mode 100644 nuttx/arch/arm/src/armv7-m/up_doirq.c create mode 100644 nuttx/arch/arm/src/armv7-m/up_fpu.S create mode 100755 nuttx/arch/arm/src/armv7-m/up_fullcontextrestore.S create mode 100644 nuttx/arch/arm/src/armv7-m/up_hardfault.c create mode 100644 nuttx/arch/arm/src/armv7-m/up_initialstate.c create mode 100644 nuttx/arch/arm/src/armv7-m/up_memfault.c create mode 100644 nuttx/arch/arm/src/armv7-m/up_mpu.c create mode 100755 nuttx/arch/arm/src/armv7-m/up_releasepending.c create mode 100755 nuttx/arch/arm/src/armv7-m/up_reprioritizertr.c create mode 100755 nuttx/arch/arm/src/armv7-m/up_saveusercontext.S create mode 100644 nuttx/arch/arm/src/armv7-m/up_schedulesigaction.c create mode 100644 nuttx/arch/arm/src/armv7-m/up_sigdeliver.c create mode 100644 nuttx/arch/arm/src/armv7-m/up_svcall.c create mode 100755 nuttx/arch/arm/src/armv7-m/up_switchcontext.S create mode 100755 nuttx/arch/arm/src/armv7-m/up_unblocktask.c create mode 100644 nuttx/arch/arm/src/c5471/Make.defs create mode 100644 nuttx/arch/arm/src/c5471/c5471_ethernet.c create mode 100644 nuttx/arch/arm/src/c5471/c5471_irq.c create mode 100644 nuttx/arch/arm/src/c5471/c5471_lowputc.S create mode 100644 nuttx/arch/arm/src/c5471/c5471_serial.c create mode 100644 nuttx/arch/arm/src/c5471/c5471_timerisr.c create mode 100644 nuttx/arch/arm/src/c5471/c5471_vectors.S create mode 100644 nuttx/arch/arm/src/c5471/c5471_watchdog.c create mode 100644 nuttx/arch/arm/src/c5471/chip.h create mode 100644 nuttx/arch/arm/src/common/up_allocateheap.c create mode 100644 nuttx/arch/arm/src/common/up_arch.h create mode 100644 nuttx/arch/arm/src/common/up_checkstack.c create mode 100644 nuttx/arch/arm/src/common/up_createstack.c create mode 100755 nuttx/arch/arm/src/common/up_etherstub.c create mode 100644 nuttx/arch/arm/src/common/up_exit.c create mode 100644 nuttx/arch/arm/src/common/up_idle.c create mode 100644 nuttx/arch/arm/src/common/up_initialize.c create mode 100644 nuttx/arch/arm/src/common/up_internal.h create mode 100644 nuttx/arch/arm/src/common/up_interruptcontext.c create mode 100644 nuttx/arch/arm/src/common/up_lowputs.c create mode 100644 nuttx/arch/arm/src/common/up_mdelay.c create mode 100644 nuttx/arch/arm/src/common/up_modifyreg16.c create mode 100644 nuttx/arch/arm/src/common/up_modifyreg32.c create mode 100644 nuttx/arch/arm/src/common/up_modifyreg8.c create mode 100644 nuttx/arch/arm/src/common/up_puts.c create mode 100644 nuttx/arch/arm/src/common/up_releasestack.c create mode 100644 nuttx/arch/arm/src/common/up_udelay.c create mode 100644 nuttx/arch/arm/src/common/up_usestack.c create mode 100644 nuttx/arch/arm/src/dm320/Make.defs create mode 100644 nuttx/arch/arm/src/dm320/chip.h create mode 100644 nuttx/arch/arm/src/dm320/dm320_ahb.h create mode 100644 nuttx/arch/arm/src/dm320/dm320_allocateheap.c create mode 100644 nuttx/arch/arm/src/dm320/dm320_boot.c create mode 100644 nuttx/arch/arm/src/dm320/dm320_busc.h create mode 100644 nuttx/arch/arm/src/dm320/dm320_clkc.h create mode 100644 nuttx/arch/arm/src/dm320/dm320_decodeirq.c create mode 100644 nuttx/arch/arm/src/dm320/dm320_emif.h create mode 100644 nuttx/arch/arm/src/dm320/dm320_framebuffer.c create mode 100644 nuttx/arch/arm/src/dm320/dm320_gio.h create mode 100644 nuttx/arch/arm/src/dm320/dm320_intc.h create mode 100644 nuttx/arch/arm/src/dm320/dm320_irq.c create mode 100644 nuttx/arch/arm/src/dm320/dm320_lowputc.S create mode 100644 nuttx/arch/arm/src/dm320/dm320_memorymap.h create mode 100644 nuttx/arch/arm/src/dm320/dm320_osd.h create mode 100644 nuttx/arch/arm/src/dm320/dm320_restart.S create mode 100644 nuttx/arch/arm/src/dm320/dm320_serial.c create mode 100644 nuttx/arch/arm/src/dm320/dm320_timer.h create mode 100644 nuttx/arch/arm/src/dm320/dm320_timerisr.c create mode 100644 nuttx/arch/arm/src/dm320/dm320_uart.h create mode 100644 nuttx/arch/arm/src/dm320/dm320_usb.h create mode 100644 nuttx/arch/arm/src/dm320/dm320_usbdev.c create mode 100644 nuttx/arch/arm/src/imx/Make.defs create mode 100644 nuttx/arch/arm/src/imx/chip.h create mode 100644 nuttx/arch/arm/src/imx/imx_aitc.h create mode 100644 nuttx/arch/arm/src/imx/imx_allocateheap.c create mode 100644 nuttx/arch/arm/src/imx/imx_boot.c create mode 100755 nuttx/arch/arm/src/imx/imx_cspi.h create mode 100644 nuttx/arch/arm/src/imx/imx_decodeirq.c create mode 100755 nuttx/arch/arm/src/imx/imx_dma.h create mode 100755 nuttx/arch/arm/src/imx/imx_eim.h create mode 100644 nuttx/arch/arm/src/imx/imx_gpio.c create mode 100755 nuttx/arch/arm/src/imx/imx_gpio.h create mode 100755 nuttx/arch/arm/src/imx/imx_i2c.h create mode 100644 nuttx/arch/arm/src/imx/imx_irq.c create mode 100644 nuttx/arch/arm/src/imx/imx_lowputc.S create mode 100644 nuttx/arch/arm/src/imx/imx_memorymap.h create mode 100755 nuttx/arch/arm/src/imx/imx_rtc.h create mode 100644 nuttx/arch/arm/src/imx/imx_serial.c create mode 100755 nuttx/arch/arm/src/imx/imx_spi.c create mode 100755 nuttx/arch/arm/src/imx/imx_system.h create mode 100644 nuttx/arch/arm/src/imx/imx_timer.h create mode 100644 nuttx/arch/arm/src/imx/imx_timerisr.c create mode 100644 nuttx/arch/arm/src/imx/imx_uart.h create mode 100755 nuttx/arch/arm/src/imx/imx_usbd.h create mode 100755 nuttx/arch/arm/src/imx/imx_wdog.h create mode 100644 nuttx/arch/arm/src/kinetis/Make.defs create mode 100644 nuttx/arch/arm/src/kinetis/chip.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_adc.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_aips.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_axbs.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_clockconfig.c create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_clrpend.c create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_cmp.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_cmt.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_config.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_crc.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_dac.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_dma.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_dmamux.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_dspi.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_enet.c create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_enet.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_ewm.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_flexbus.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_flexcan.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_fmc.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_ftfl.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_ftm.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_gpio.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_i2c.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_i2s.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_idle.c create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_internal.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_irq.c create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_k40pinmux.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_k60pinmux.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_llwu.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_lowputc.c create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_lptmr.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_mcg.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_mcm.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_memorymap.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_mmcau.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_mpu.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_osc.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_pdb.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_pin.c create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_pindma.c create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_pingpio.c create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_pinirq.c create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_pinmux.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_pit.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_pmc.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_port.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_rngb.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_rtc.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_sdhc.c create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_sdhc.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_serial.c create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_sim.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_slcd.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_smc.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_start.c create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_timerisr.c create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_tsi.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_uart.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_usbdcd.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_usbotg.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_vectors.S create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_vrefv1.h create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_wdog.c create mode 100644 nuttx/arch/arm/src/kinetis/kinetis_wdog.h create mode 100644 nuttx/arch/arm/src/lm3s/Make.defs create mode 100644 nuttx/arch/arm/src/lm3s/chip.h create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_dumpgpio.c create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_ethernet.c create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_ethernet.h create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_flash.h create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_gpio.c create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_gpio.h create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_gpioirq.c create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_i2c.h create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_internal.h create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_irq.c create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_lowputc.c create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_memorymap.h create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_serial.c create mode 100755 nuttx/arch/arm/src/lm3s/lm3s_ssi.c create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_ssi.h create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_start.c create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_syscontrol.c create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_syscontrol.h create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_timerisr.c create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_uart.h create mode 100644 nuttx/arch/arm/src/lm3s/lm3s_vectors.S create mode 100755 nuttx/arch/arm/src/lpc17xx/Make.defs create mode 100755 nuttx/arch/arm/src/lpc17xx/chip.h create mode 100644 nuttx/arch/arm/src/lpc17xx/lpc17_adc.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_adc.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_allocateheap.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_can.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_can.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_clockconfig.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_clrpend.c create mode 100644 nuttx/arch/arm/src/lpc17xx/lpc17_dac.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_dac.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_emacram.h create mode 100644 nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_gpdma.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_gpdma.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_gpio.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_gpiodbg.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_i2c.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_i2c.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_i2s.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_idle.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_internal.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_irq.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_lowputc.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_mcpwm.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_memorymap.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_ohciram.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_pinconn.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_pwm.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_qei.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_rit.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_rtc.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_serial.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_serial.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_spi.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_spi.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_ssp.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_ssp.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_start.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_syscon.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_timer.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_timerisr.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_uart.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_usb.h create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_vectors.S create mode 100755 nuttx/arch/arm/src/lpc17xx/lpc17_wdt.h create mode 100644 nuttx/arch/arm/src/lpc214x/Make.defs create mode 100644 nuttx/arch/arm/src/lpc214x/README.txt create mode 100644 nuttx/arch/arm/src/lpc214x/chip.h create mode 100644 nuttx/arch/arm/src/lpc214x/lpc214x_apb.h create mode 100644 nuttx/arch/arm/src/lpc214x/lpc214x_decodeirq.c create mode 100644 nuttx/arch/arm/src/lpc214x/lpc214x_head.S create mode 100644 nuttx/arch/arm/src/lpc214x/lpc214x_i2c.h create mode 100644 nuttx/arch/arm/src/lpc214x/lpc214x_irq.c create mode 100644 nuttx/arch/arm/src/lpc214x/lpc214x_lowputc.S create mode 100644 nuttx/arch/arm/src/lpc214x/lpc214x_pinsel.h create mode 100644 nuttx/arch/arm/src/lpc214x/lpc214x_pll.h create mode 100644 nuttx/arch/arm/src/lpc214x/lpc214x_power.h create mode 100644 nuttx/arch/arm/src/lpc214x/lpc214x_serial.c create mode 100644 nuttx/arch/arm/src/lpc214x/lpc214x_spi.h create mode 100644 nuttx/arch/arm/src/lpc214x/lpc214x_timer.h create mode 100644 nuttx/arch/arm/src/lpc214x/lpc214x_timerisr.c create mode 100755 nuttx/arch/arm/src/lpc214x/lpc214x_uart.h create mode 100644 nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c create mode 100644 nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.h create mode 100755 nuttx/arch/arm/src/lpc214x/lpc214x_vic.h create mode 100755 nuttx/arch/arm/src/lpc2378/Make.defs create mode 100755 nuttx/arch/arm/src/lpc2378/chip.h create mode 100755 nuttx/arch/arm/src/lpc2378/internal.h create mode 100755 nuttx/arch/arm/src/lpc2378/lpc23xx_decodeirq.c create mode 100755 nuttx/arch/arm/src/lpc2378/lpc23xx_gpio.h create mode 100755 nuttx/arch/arm/src/lpc2378/lpc23xx_head.S create mode 100755 nuttx/arch/arm/src/lpc2378/lpc23xx_io.c create mode 100755 nuttx/arch/arm/src/lpc2378/lpc23xx_irq.c create mode 100755 nuttx/arch/arm/src/lpc2378/lpc23xx_lowputc.S create mode 100755 nuttx/arch/arm/src/lpc2378/lpc23xx_pinsel.h create mode 100755 nuttx/arch/arm/src/lpc2378/lpc23xx_pllsetup.c create mode 100755 nuttx/arch/arm/src/lpc2378/lpc23xx_scb.h create mode 100755 nuttx/arch/arm/src/lpc2378/lpc23xx_serial.c create mode 100755 nuttx/arch/arm/src/lpc2378/lpc23xx_timer.h create mode 100755 nuttx/arch/arm/src/lpc2378/lpc23xx_timerisr.c create mode 100755 nuttx/arch/arm/src/lpc2378/lpc23xx_uart.h create mode 100755 nuttx/arch/arm/src/lpc2378/lpc23xx_vic.h create mode 100755 nuttx/arch/arm/src/lpc31xx/Make.defs create mode 100755 nuttx/arch/arm/src/lpc31xx/chip.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_adc.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_allocateheap.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_analogdie.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_bcrndx.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_boot.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_cgu.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_cgudrvr.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_clkdomain.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_clkexten.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_clkfreq.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_clkinit.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_decodeirq.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_defclk.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_dma.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_esrndx.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_evntrtr.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_fdcndx.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_fdivinit.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_freqin.c create mode 100644 nuttx/arch/arm/src/lpc31xx/lpc31_i2c.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_i2c.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_i2s.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_intc.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_internal.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_ioconfig.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_irq.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_lcd.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_lowputc.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_mci.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_memorymap.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_mpmc.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_nand.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_otp.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_pcm.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_pllconfig.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_pwm.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_resetclks.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_rng.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_serial.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_setfdiv.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_setfreqin.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_softreset.c create mode 100644 nuttx/arch/arm/src/lpc31xx/lpc31_spi.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_spi.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_syscreg.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_timer.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_timerisr.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_uart.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_usbdev.c create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_usbotg.h create mode 100755 nuttx/arch/arm/src/lpc31xx/lpc31_wdt.h create mode 100644 nuttx/arch/arm/src/sam3u/Make.defs create mode 100644 nuttx/arch/arm/src/sam3u/chip.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_adc.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_allocateheap.c create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_chipid.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_clockconfig.c create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_dmac.c create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_dmac.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_eefc.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_gpbr.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_gpioirq.c create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_hsmci.c create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_hsmci.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_internal.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_irq.c create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_lowputc.c create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_matrix.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_memorymap.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_mpuinit.c create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_pdc.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_pio.c create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_pio.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_pmc.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_pwm.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_rstc.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_rtc.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_rtt.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_serial.c create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_smc.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_spi.c create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_spi.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_ssc.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_start.c create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_supc.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_tc.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_timerisr.c create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_twi.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_uart.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_udphs.h create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_userspace.c create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_vectors.S create mode 100644 nuttx/arch/arm/src/sam3u/sam3u_wdt.h create mode 100644 nuttx/arch/arm/src/stm32/Make.defs create mode 100644 nuttx/arch/arm/src/stm32/chip.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32_adc.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32_bkp.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32_can.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32_dac.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32_dbgmcu.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32_eth.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32_exti.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32_flash.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32_i2c.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32_memorymap.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32_pwr.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32_sdio.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32_spi.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32_syscfg.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32_tim.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32_uart.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32_usbdev.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32_wdg.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32f103re_pinmap.h create mode 100755 nuttx/arch/arm/src/stm32/chip/stm32f103vc_pinmap.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32f103ze_pinmap.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32f107vc_pinmap.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32f10xxx_dma.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32f10xxx_gpio.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32f10xxx_memorymap.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32f10xxx_rcc.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32f10xxx_rtc.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32f10xxx_vectors.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32f40xxx_dma.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32f40xxx_gpio.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32f40xxx_memorymap.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32f40xxx_pinmap.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32f40xxx_rcc.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32f40xxx_rtc.h create mode 100644 nuttx/arch/arm/src/stm32/chip/stm32f40xxx_vectors.h create mode 100644 nuttx/arch/arm/src/stm32/stm32.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_adc.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_adc.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_allocateheap.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_bkp.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_can.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_dac.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_dac.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_dbgmcu.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_dma.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_dma.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_dumpgpio.c create mode 100755 nuttx/arch/arm/src/stm32/stm32_eth.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_eth.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_exti.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_exti.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_flash.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_flash.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_fsmc.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_gpio.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_gpio.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_i2c.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_i2c.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_idle.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_internal.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_irq.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_lowputc.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_lowputc.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_lse.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_pwm.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_pwm.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_pwr.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_pwr.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_rcc.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_rcc.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_rcclock.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_rtc.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_rtc.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_sdio.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_sdio.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_serial.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_spi.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_spi.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_start.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_syscfg.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_tim.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_tim.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_timerisr.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_uart.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_usbdev.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_usbdev.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_vectors.S create mode 100644 nuttx/arch/arm/src/stm32/stm32_waste.c create mode 100644 nuttx/arch/arm/src/stm32/stm32_waste.h create mode 100644 nuttx/arch/arm/src/stm32/stm32_wdg.h create mode 100644 nuttx/arch/arm/src/stm32/stm32f10xxx_dma.c create mode 100644 nuttx/arch/arm/src/stm32/stm32f10xxx_rcc.c create mode 100644 nuttx/arch/arm/src/stm32/stm32f10xxx_rtc.c create mode 100644 nuttx/arch/arm/src/stm32/stm32f40xxx_dma.c create mode 100644 nuttx/arch/arm/src/stm32/stm32f40xxx_rcc.c create mode 100644 nuttx/arch/arm/src/stm32/stm32f40xxx_rtc.c create mode 100644 nuttx/arch/arm/src/str71x/Make.defs create mode 100644 nuttx/arch/arm/src/str71x/chip.h create mode 100644 nuttx/arch/arm/src/str71x/str71x_adc12.h create mode 100644 nuttx/arch/arm/src/str71x/str71x_apb.h create mode 100644 nuttx/arch/arm/src/str71x/str71x_bspi.h create mode 100644 nuttx/arch/arm/src/str71x/str71x_can.h create mode 100644 nuttx/arch/arm/src/str71x/str71x_decodeirq.c create mode 100644 nuttx/arch/arm/src/str71x/str71x_eic.h create mode 100644 nuttx/arch/arm/src/str71x/str71x_emi.h create mode 100644 nuttx/arch/arm/src/str71x/str71x_flash.h create mode 100644 nuttx/arch/arm/src/str71x/str71x_gpio.h create mode 100644 nuttx/arch/arm/src/str71x/str71x_head.S create mode 100644 nuttx/arch/arm/src/str71x/str71x_i2c.h create mode 100644 nuttx/arch/arm/src/str71x/str71x_internal.h create mode 100644 nuttx/arch/arm/src/str71x/str71x_irq.c create mode 100644 nuttx/arch/arm/src/str71x/str71x_lowputc.c create mode 100644 nuttx/arch/arm/src/str71x/str71x_map.h create mode 100644 nuttx/arch/arm/src/str71x/str71x_pcu.h create mode 100644 nuttx/arch/arm/src/str71x/str71x_prccu.c create mode 100644 nuttx/arch/arm/src/str71x/str71x_rccu.h create mode 100644 nuttx/arch/arm/src/str71x/str71x_rtc.h create mode 100644 nuttx/arch/arm/src/str71x/str71x_serial.c create mode 100644 nuttx/arch/arm/src/str71x/str71x_timer.h create mode 100644 nuttx/arch/arm/src/str71x/str71x_timerisr.c create mode 100644 nuttx/arch/arm/src/str71x/str71x_uart.h create mode 100644 nuttx/arch/arm/src/str71x/str71x_usb.h create mode 100644 nuttx/arch/arm/src/str71x/str71x_wdog.h create mode 100755 nuttx/arch/arm/src/str71x/str71x_xti.c create mode 100644 nuttx/arch/arm/src/str71x/str71x_xti.h create mode 100644 nuttx/arch/avr/include/arch.h create mode 100755 nuttx/arch/avr/include/at32uc3/irq.h create mode 100644 nuttx/arch/avr/include/at90usb/irq.h create mode 100644 nuttx/arch/avr/include/atmega/irq.h create mode 100755 nuttx/arch/avr/include/avr/avr.h create mode 100644 nuttx/arch/avr/include/avr/irq.h create mode 100644 nuttx/arch/avr/include/avr/limits.h create mode 100644 nuttx/arch/avr/include/avr/syscall.h create mode 100644 nuttx/arch/avr/include/avr/types.h create mode 100755 nuttx/arch/avr/include/avr32/avr32.h create mode 100644 nuttx/arch/avr/include/avr32/irq.h create mode 100644 nuttx/arch/avr/include/avr32/limits.h create mode 100644 nuttx/arch/avr/include/avr32/syscall.h create mode 100644 nuttx/arch/avr/include/avr32/types.h create mode 100644 nuttx/arch/avr/include/irq.h create mode 100644 nuttx/arch/avr/include/limits.h create mode 100644 nuttx/arch/avr/include/syscall.h create mode 100644 nuttx/arch/avr/include/types.h create mode 100644 nuttx/arch/avr/src/Makefile create mode 100644 nuttx/arch/avr/src/at32uc3/Make.defs create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_abdac.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_adc.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_clkinit.c create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_config.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_eic.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_flashc.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_gpio.c create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_gpio.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_gpioirq.c create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_hmatrix.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_intc.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_internal.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_irq.c create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_lowconsole.c create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_lowinit.c create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_memorymap.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_pdca.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_pinmux.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_pm.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_pwm.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_rtc.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_serial.c create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_spi.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_ssc.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_tc.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_timerisr.c create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_twi.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_usart.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_usbb.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3_wdt.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3a_pinmux.h create mode 100644 nuttx/arch/avr/src/at32uc3/at32uc3b_pinmux.h create mode 100644 nuttx/arch/avr/src/at32uc3/chip.h create mode 100644 nuttx/arch/avr/src/at90usb/Make.defs create mode 100644 nuttx/arch/avr/src/at90usb/at90usb_config.h create mode 100755 nuttx/arch/avr/src/at90usb/at90usb_exceptions.S create mode 100755 nuttx/arch/avr/src/at90usb/at90usb_head.S create mode 100644 nuttx/arch/avr/src/at90usb/at90usb_internal.h create mode 100644 nuttx/arch/avr/src/at90usb/at90usb_lowconsole.c create mode 100644 nuttx/arch/avr/src/at90usb/at90usb_lowinit.c create mode 100644 nuttx/arch/avr/src/at90usb/at90usb_memorymap.h create mode 100644 nuttx/arch/avr/src/at90usb/at90usb_serial.c create mode 100644 nuttx/arch/avr/src/at90usb/at90usb_timerisr.c create mode 100644 nuttx/arch/avr/src/at90usb/at90usb_usbdev.c create mode 100644 nuttx/arch/avr/src/at90usb/chip.h create mode 100644 nuttx/arch/avr/src/atmega/Make.defs create mode 100644 nuttx/arch/avr/src/atmega/atmega_config.h create mode 100755 nuttx/arch/avr/src/atmega/atmega_exceptions.S create mode 100755 nuttx/arch/avr/src/atmega/atmega_head.S create mode 100644 nuttx/arch/avr/src/atmega/atmega_internal.h create mode 100644 nuttx/arch/avr/src/atmega/atmega_lowconsole.c create mode 100644 nuttx/arch/avr/src/atmega/atmega_lowinit.c create mode 100644 nuttx/arch/avr/src/atmega/atmega_memorymap.h create mode 100644 nuttx/arch/avr/src/atmega/atmega_serial.c create mode 100644 nuttx/arch/avr/src/atmega/atmega_timerisr.c create mode 100644 nuttx/arch/avr/src/atmega/chip.h create mode 100644 nuttx/arch/avr/src/avr/README.txt create mode 100644 nuttx/arch/avr/src/avr/avr_internal.h create mode 100755 nuttx/arch/avr/src/avr/excptmacros.h create mode 100755 nuttx/arch/avr/src/avr/up_blocktask.c create mode 100644 nuttx/arch/avr/src/avr/up_checkstack.c create mode 100644 nuttx/arch/avr/src/avr/up_copystate.c create mode 100644 nuttx/arch/avr/src/avr/up_createstack.c create mode 100644 nuttx/arch/avr/src/avr/up_doirq.c create mode 100644 nuttx/arch/avr/src/avr/up_dumpstate.c create mode 100644 nuttx/arch/avr/src/avr/up_initialstate.c create mode 100644 nuttx/arch/avr/src/avr/up_irq.c create mode 100755 nuttx/arch/avr/src/avr/up_releasepending.c create mode 100755 nuttx/arch/avr/src/avr/up_reprioritizertr.c create mode 100644 nuttx/arch/avr/src/avr/up_romgetc.c create mode 100644 nuttx/arch/avr/src/avr/up_schedulesigaction.c create mode 100644 nuttx/arch/avr/src/avr/up_sigdeliver.c create mode 100644 nuttx/arch/avr/src/avr/up_spi.c create mode 100755 nuttx/arch/avr/src/avr/up_switchcontext.S create mode 100755 nuttx/arch/avr/src/avr/up_unblocktask.c create mode 100644 nuttx/arch/avr/src/avr/up_usestack.c create mode 100644 nuttx/arch/avr/src/avr32/avr32_internal.h create mode 100755 nuttx/arch/avr/src/avr32/up_blocktask.c create mode 100644 nuttx/arch/avr/src/avr32/up_copystate.c create mode 100644 nuttx/arch/avr/src/avr32/up_createstack.c create mode 100644 nuttx/arch/avr/src/avr32/up_doirq.c create mode 100644 nuttx/arch/avr/src/avr32/up_dumpstate.c create mode 100755 nuttx/arch/avr/src/avr32/up_exceptions.S create mode 100755 nuttx/arch/avr/src/avr32/up_fullcontextrestore.S create mode 100644 nuttx/arch/avr/src/avr32/up_initialstate.c create mode 100644 nuttx/arch/avr/src/avr32/up_nommuhead.S create mode 100755 nuttx/arch/avr/src/avr32/up_releasepending.c create mode 100755 nuttx/arch/avr/src/avr32/up_reprioritizertr.c create mode 100644 nuttx/arch/avr/src/avr32/up_schedulesigaction.c create mode 100644 nuttx/arch/avr/src/avr32/up_sigdeliver.c create mode 100755 nuttx/arch/avr/src/avr32/up_switchcontext.S create mode 100755 nuttx/arch/avr/src/avr32/up_syscall6.S create mode 100755 nuttx/arch/avr/src/avr32/up_unblocktask.c create mode 100644 nuttx/arch/avr/src/avr32/up_usestack.c create mode 100644 nuttx/arch/avr/src/common/up_allocateheap.c create mode 100644 nuttx/arch/avr/src/common/up_arch.h create mode 100644 nuttx/arch/avr/src/common/up_assert.c create mode 100644 nuttx/arch/avr/src/common/up_exit.c create mode 100644 nuttx/arch/avr/src/common/up_idle.c create mode 100644 nuttx/arch/avr/src/common/up_initialize.c create mode 100644 nuttx/arch/avr/src/common/up_internal.h create mode 100644 nuttx/arch/avr/src/common/up_interruptcontext.c create mode 100644 nuttx/arch/avr/src/common/up_lowputs.c create mode 100644 nuttx/arch/avr/src/common/up_mdelay.c create mode 100644 nuttx/arch/avr/src/common/up_modifyreg16.c create mode 100644 nuttx/arch/avr/src/common/up_modifyreg32.c create mode 100644 nuttx/arch/avr/src/common/up_modifyreg8.c create mode 100644 nuttx/arch/avr/src/common/up_puts.c create mode 100644 nuttx/arch/avr/src/common/up_releasestack.c create mode 100644 nuttx/arch/avr/src/common/up_udelay.c create mode 100755 nuttx/arch/hc/include/arch.h create mode 100755 nuttx/arch/hc/include/hc12/irq.h create mode 100755 nuttx/arch/hc/include/hc12/limits.h create mode 100755 nuttx/arch/hc/include/hc12/types.h create mode 100755 nuttx/arch/hc/include/hcs12/irq.h create mode 100755 nuttx/arch/hc/include/hcs12/limits.h create mode 100755 nuttx/arch/hc/include/hcs12/types.h create mode 100755 nuttx/arch/hc/include/irq.h create mode 100755 nuttx/arch/hc/include/limits.h create mode 100755 nuttx/arch/hc/include/m9s12/irq.h create mode 100644 nuttx/arch/hc/include/syscall.h create mode 100755 nuttx/arch/hc/include/types.h create mode 100755 nuttx/arch/hc/src/Makefile create mode 100755 nuttx/arch/hc/src/common/up_allocateheap.c create mode 100755 nuttx/arch/hc/src/common/up_arch.h create mode 100755 nuttx/arch/hc/src/common/up_blocktask.c create mode 100644 nuttx/arch/hc/src/common/up_copystate.c create mode 100755 nuttx/arch/hc/src/common/up_createstack.c create mode 100644 nuttx/arch/hc/src/common/up_doirq.c create mode 100644 nuttx/arch/hc/src/common/up_exit.c create mode 100755 nuttx/arch/hc/src/common/up_idle.c create mode 100755 nuttx/arch/hc/src/common/up_initialize.c create mode 100755 nuttx/arch/hc/src/common/up_internal.h create mode 100755 nuttx/arch/hc/src/common/up_interruptcontext.c create mode 100755 nuttx/arch/hc/src/common/up_mdelay.c create mode 100755 nuttx/arch/hc/src/common/up_modifyreg16.c create mode 100755 nuttx/arch/hc/src/common/up_modifyreg32.c create mode 100755 nuttx/arch/hc/src/common/up_modifyreg8.c create mode 100755 nuttx/arch/hc/src/common/up_puts.c create mode 100755 nuttx/arch/hc/src/common/up_releasepending.c create mode 100755 nuttx/arch/hc/src/common/up_releasestack.c create mode 100755 nuttx/arch/hc/src/common/up_reprioritizertr.c create mode 100755 nuttx/arch/hc/src/common/up_udelay.c create mode 100755 nuttx/arch/hc/src/common/up_unblocktask.c create mode 100755 nuttx/arch/hc/src/common/up_usestack.c create mode 100755 nuttx/arch/hc/src/m9s12/Make.defs create mode 100755 nuttx/arch/hc/src/m9s12/chip.h create mode 100644 nuttx/arch/hc/src/m9s12/m9s12_assert.c create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_atd.h create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_crg.h create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_dumpgpio.c create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_emac.h create mode 100644 nuttx/arch/hc/src/m9s12/m9s12_ethernet.c create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_flash.h create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_gpio.c create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_gpioirq.c create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_iic.h create mode 100644 nuttx/arch/hc/src/m9s12/m9s12_initialstate.c create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_int.h create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_internal.h create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_irq.c create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_lowputc.S create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_mebi.h create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_mmc.h create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_phy.h create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_pim.h create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_saveusercontext.S create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_sci.h create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_serial.c create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_serial.h create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_spi.h create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_start.S create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_tim.h create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_timerisr.c create mode 100755 nuttx/arch/hc/src/m9s12/m9s12_vectors.S create mode 100644 nuttx/arch/mips/include/arch.h create mode 100644 nuttx/arch/mips/include/irq.h create mode 100644 nuttx/arch/mips/include/limits.h create mode 100755 nuttx/arch/mips/include/mips32/cp0.h create mode 100755 nuttx/arch/mips/include/mips32/irq.h create mode 100755 nuttx/arch/mips/include/mips32/registers.h create mode 100644 nuttx/arch/mips/include/mips32/syscall.h create mode 100644 nuttx/arch/mips/include/pic32mx/chip.h create mode 100755 nuttx/arch/mips/include/pic32mx/cp0.h create mode 100755 nuttx/arch/mips/include/pic32mx/irq.h create mode 100755 nuttx/arch/mips/include/pic32mx/irq_3xx4xx.h create mode 100755 nuttx/arch/mips/include/pic32mx/irq_5xx6xx7xx.h create mode 100644 nuttx/arch/mips/include/syscall.h create mode 100644 nuttx/arch/mips/include/types.h create mode 100644 nuttx/arch/mips/src/Makefile create mode 100644 nuttx/arch/mips/src/common/up_allocateheap.c create mode 100644 nuttx/arch/mips/src/common/up_arch.h create mode 100644 nuttx/arch/mips/src/common/up_createstack.c create mode 100755 nuttx/arch/mips/src/common/up_etherstub.c create mode 100644 nuttx/arch/mips/src/common/up_exit.c create mode 100644 nuttx/arch/mips/src/common/up_idle.c create mode 100644 nuttx/arch/mips/src/common/up_initialize.c create mode 100755 nuttx/arch/mips/src/common/up_internal.h create mode 100644 nuttx/arch/mips/src/common/up_interruptcontext.c create mode 100644 nuttx/arch/mips/src/common/up_lowputs.c create mode 100644 nuttx/arch/mips/src/common/up_mdelay.c create mode 100644 nuttx/arch/mips/src/common/up_modifyreg16.c create mode 100644 nuttx/arch/mips/src/common/up_modifyreg32.c create mode 100644 nuttx/arch/mips/src/common/up_modifyreg8.c create mode 100644 nuttx/arch/mips/src/common/up_puts.c create mode 100644 nuttx/arch/mips/src/common/up_releasestack.c create mode 100644 nuttx/arch/mips/src/common/up_udelay.c create mode 100644 nuttx/arch/mips/src/common/up_usestack.c create mode 100755 nuttx/arch/mips/src/mips32/mips32-memorymap.h create mode 100644 nuttx/arch/mips/src/mips32/up_assert.c create mode 100755 nuttx/arch/mips/src/mips32/up_blocktask.c create mode 100644 nuttx/arch/mips/src/mips32/up_copystate.c create mode 100644 nuttx/arch/mips/src/mips32/up_doirq.c create mode 100644 nuttx/arch/mips/src/mips32/up_dumpstate.c create mode 100644 nuttx/arch/mips/src/mips32/up_initialstate.c create mode 100644 nuttx/arch/mips/src/mips32/up_irq.c create mode 100755 nuttx/arch/mips/src/mips32/up_releasepending.c create mode 100755 nuttx/arch/mips/src/mips32/up_reprioritizertr.c create mode 100644 nuttx/arch/mips/src/mips32/up_schedulesigaction.c create mode 100644 nuttx/arch/mips/src/mips32/up_sigdeliver.c create mode 100644 nuttx/arch/mips/src/mips32/up_swint0.c create mode 100644 nuttx/arch/mips/src/mips32/up_syscall0.S create mode 100755 nuttx/arch/mips/src/mips32/up_unblocktask.c create mode 100644 nuttx/arch/mips/src/pic32mx/Make.defs create mode 100644 nuttx/arch/mips/src/pic32mx/chip.h create mode 100644 nuttx/arch/mips/src/pic32mx/excptmacros.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-adc.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-bmx.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-can.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-che.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-cm.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-config.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-cvr.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-ddp.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-decodeirq.c create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-devcfg.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-dma.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-ethernet.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-exception.c create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-flash.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-gpio.c create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-gpioirq.c create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-head.S create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-i2c.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-ic.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-int.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-internal.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-ioport.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-irq.c create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-lowconsole.c create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-lowinit.c create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-memorymap.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-oc.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-osc.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-pmp.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-reset.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-rtcc.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-serial.c create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-spi.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-timer.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-timerisr.c create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-uart.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-usbotg.h create mode 100644 nuttx/arch/mips/src/pic32mx/pic32mx-wdt.h create mode 100644 nuttx/arch/rgmp/include/arch.h create mode 100644 nuttx/arch/rgmp/include/arm/arch/subarch/arch.h create mode 100644 nuttx/arch/rgmp/include/irq.h create mode 100644 nuttx/arch/rgmp/include/limits.h create mode 100644 nuttx/arch/rgmp/include/math.h create mode 100644 nuttx/arch/rgmp/include/stdbool.h create mode 100644 nuttx/arch/rgmp/include/stdint.h create mode 100644 nuttx/arch/rgmp/include/types.h create mode 100644 nuttx/arch/rgmp/include/x86/arch/com.h create mode 100644 nuttx/arch/rgmp/include/x86/arch/subarch/arch.h create mode 100644 nuttx/arch/rgmp/src/Makefile create mode 100644 nuttx/arch/rgmp/src/arm/Make.defs create mode 100644 nuttx/arch/rgmp/src/arm/arch_nuttx.c create mode 100644 nuttx/arch/rgmp/src/arm/sigentry.S create mode 100644 nuttx/arch/rgmp/src/bridge.c create mode 100644 nuttx/arch/rgmp/src/nuttx.c create mode 100644 nuttx/arch/rgmp/src/rgmp.c create mode 100644 nuttx/arch/rgmp/src/x86/Make.defs create mode 100644 nuttx/arch/rgmp/src/x86/arch_nuttx.c create mode 100644 nuttx/arch/rgmp/src/x86/com.c create mode 100644 nuttx/arch/rgmp/src/x86/sigentry.S create mode 100644 nuttx/arch/sh/include/README.txt create mode 100644 nuttx/arch/sh/include/arch.h create mode 100644 nuttx/arch/sh/include/irq.h create mode 100644 nuttx/arch/sh/include/limits.h create mode 100644 nuttx/arch/sh/include/m16c/README.txt create mode 100644 nuttx/arch/sh/include/m16c/irq.h create mode 100644 nuttx/arch/sh/include/m16c/limits.h create mode 100644 nuttx/arch/sh/include/m16c/types.h create mode 100644 nuttx/arch/sh/include/serial.h create mode 100644 nuttx/arch/sh/include/sh1/README.txt create mode 100644 nuttx/arch/sh/include/sh1/irq.h create mode 100644 nuttx/arch/sh/include/sh1/limits.h create mode 100644 nuttx/arch/sh/include/sh1/types.h create mode 100644 nuttx/arch/sh/include/syscall.h create mode 100644 nuttx/arch/sh/include/types.h create mode 100644 nuttx/arch/sh/include/watchdog.h create mode 100644 nuttx/arch/sh/src/Makefile create mode 100644 nuttx/arch/sh/src/README.txt create mode 100644 nuttx/arch/sh/src/common/README.txt create mode 100644 nuttx/arch/sh/src/common/up_allocateheap.c create mode 100644 nuttx/arch/sh/src/common/up_arch.h create mode 100644 nuttx/arch/sh/src/common/up_assert.c create mode 100644 nuttx/arch/sh/src/common/up_blocktask.c create mode 100644 nuttx/arch/sh/src/common/up_createstack.c create mode 100644 nuttx/arch/sh/src/common/up_doirq.c create mode 100644 nuttx/arch/sh/src/common/up_exit.c create mode 100644 nuttx/arch/sh/src/common/up_idle.c create mode 100644 nuttx/arch/sh/src/common/up_initialize.c create mode 100644 nuttx/arch/sh/src/common/up_internal.h create mode 100644 nuttx/arch/sh/src/common/up_interruptcontext.c create mode 100644 nuttx/arch/sh/src/common/up_lowputs.c create mode 100644 nuttx/arch/sh/src/common/up_mdelay.c create mode 100644 nuttx/arch/sh/src/common/up_puts.c create mode 100644 nuttx/arch/sh/src/common/up_releasepending.c create mode 100644 nuttx/arch/sh/src/common/up_releasestack.c create mode 100644 nuttx/arch/sh/src/common/up_reprioritizertr.c create mode 100644 nuttx/arch/sh/src/common/up_udelay.c create mode 100644 nuttx/arch/sh/src/common/up_unblocktask.c create mode 100644 nuttx/arch/sh/src/common/up_usestack.c create mode 100644 nuttx/arch/sh/src/m16c/Make.defs create mode 100644 nuttx/arch/sh/src/m16c/README.txt create mode 100644 nuttx/arch/sh/src/m16c/chip.h create mode 100644 nuttx/arch/sh/src/m16c/m16c_copystate.c create mode 100755 nuttx/arch/sh/src/m16c/m16c_dumpstate.c create mode 100644 nuttx/arch/sh/src/m16c/m16c_head.S create mode 100644 nuttx/arch/sh/src/m16c/m16c_initialstate.c create mode 100644 nuttx/arch/sh/src/m16c/m16c_irq.c create mode 100644 nuttx/arch/sh/src/m16c/m16c_lowputc.c create mode 100644 nuttx/arch/sh/src/m16c/m16c_schedulesigaction.c create mode 100644 nuttx/arch/sh/src/m16c/m16c_serial.c create mode 100644 nuttx/arch/sh/src/m16c/m16c_sigdeliver.c create mode 100644 nuttx/arch/sh/src/m16c/m16c_timer.h create mode 100644 nuttx/arch/sh/src/m16c/m16c_timerisr.c create mode 100644 nuttx/arch/sh/src/m16c/m16c_uart.h create mode 100644 nuttx/arch/sh/src/m16c/m16c_vectors.S create mode 100644 nuttx/arch/sh/src/sh1/Make.defs create mode 100644 nuttx/arch/sh/src/sh1/README.txt create mode 100644 nuttx/arch/sh/src/sh1/chip.h create mode 100644 nuttx/arch/sh/src/sh1/sh1_703x.h create mode 100644 nuttx/arch/sh/src/sh1/sh1_copystate.c create mode 100755 nuttx/arch/sh/src/sh1/sh1_dumpstate.c create mode 100644 nuttx/arch/sh/src/sh1/sh1_head.S create mode 100644 nuttx/arch/sh/src/sh1/sh1_initialstate.c create mode 100644 nuttx/arch/sh/src/sh1/sh1_irq.c create mode 100644 nuttx/arch/sh/src/sh1/sh1_lowputc.c create mode 100644 nuttx/arch/sh/src/sh1/sh1_saveusercontext.S create mode 100644 nuttx/arch/sh/src/sh1/sh1_schedulesigaction.c create mode 100644 nuttx/arch/sh/src/sh1/sh1_serial.c create mode 100644 nuttx/arch/sh/src/sh1/sh1_sigdeliver.c create mode 100644 nuttx/arch/sh/src/sh1/sh1_timerisr.c create mode 100644 nuttx/arch/sh/src/sh1/sh1_vector.S create mode 100644 nuttx/arch/sim/include/arch.h create mode 100644 nuttx/arch/sim/include/irq.h create mode 100644 nuttx/arch/sim/include/limits.h create mode 100644 nuttx/arch/sim/include/syscall.h create mode 100644 nuttx/arch/sim/include/types.h create mode 100644 nuttx/arch/sim/src/Makefile create mode 100644 nuttx/arch/sim/src/nuttx-names.dat create mode 100644 nuttx/arch/sim/src/up_allocateheap.c create mode 100644 nuttx/arch/sim/src/up_blockdevice.c create mode 100644 nuttx/arch/sim/src/up_blocktask.c create mode 100644 nuttx/arch/sim/src/up_createstack.c create mode 100644 nuttx/arch/sim/src/up_devconsole.c create mode 100644 nuttx/arch/sim/src/up_deviceimage.c create mode 100644 nuttx/arch/sim/src/up_exit.c create mode 100644 nuttx/arch/sim/src/up_framebuffer.c create mode 100644 nuttx/arch/sim/src/up_head.c create mode 100644 nuttx/arch/sim/src/up_hostusleep.c create mode 100644 nuttx/arch/sim/src/up_idle.c create mode 100644 nuttx/arch/sim/src/up_initialize.c create mode 100644 nuttx/arch/sim/src/up_initialstate.c create mode 100644 nuttx/arch/sim/src/up_internal.h create mode 100644 nuttx/arch/sim/src/up_interruptcontext.c create mode 100644 nuttx/arch/sim/src/up_lcd.c create mode 100644 nuttx/arch/sim/src/up_netdev.c create mode 100644 nuttx/arch/sim/src/up_releasepending.c create mode 100644 nuttx/arch/sim/src/up_releasestack.c create mode 100644 nuttx/arch/sim/src/up_reprioritizertr.c create mode 100644 nuttx/arch/sim/src/up_romgetc.c create mode 100644 nuttx/arch/sim/src/up_schedulesigaction.c create mode 100644 nuttx/arch/sim/src/up_setjmp.S create mode 100644 nuttx/arch/sim/src/up_stdio.c create mode 100644 nuttx/arch/sim/src/up_tapdev.c create mode 100644 nuttx/arch/sim/src/up_touchscreen.c create mode 100644 nuttx/arch/sim/src/up_uipdriver.c create mode 100644 nuttx/arch/sim/src/up_unblocktask.c create mode 100644 nuttx/arch/sim/src/up_usestack.c create mode 100644 nuttx/arch/sim/src/up_wpcap.c create mode 100644 nuttx/arch/sim/src/up_x11eventloop.c create mode 100644 nuttx/arch/sim/src/up_x11framebuffer.c create mode 100755 nuttx/arch/x86/include/README.txt create mode 100755 nuttx/arch/x86/include/arch.h create mode 100755 nuttx/arch/x86/include/i486/arch.h create mode 100644 nuttx/arch/x86/include/i486/io.h create mode 100755 nuttx/arch/x86/include/i486/irq.h create mode 100755 nuttx/arch/x86/include/i486/limits.h create mode 100644 nuttx/arch/x86/include/i486/syscall.h create mode 100755 nuttx/arch/x86/include/i486/types.h create mode 100755 nuttx/arch/x86/include/io.h create mode 100755 nuttx/arch/x86/include/irq.h create mode 100755 nuttx/arch/x86/include/limits.h create mode 100755 nuttx/arch/x86/include/qemu/arch.h create mode 100755 nuttx/arch/x86/include/qemu/irq.h create mode 100644 nuttx/arch/x86/include/syscall.h create mode 100755 nuttx/arch/x86/include/types.h create mode 100644 nuttx/arch/x86/src/Makefile create mode 100755 nuttx/arch/x86/src/README.txt create mode 100644 nuttx/arch/x86/src/common/up_allocateheap.c create mode 100644 nuttx/arch/x86/src/common/up_arch.h create mode 100644 nuttx/arch/x86/src/common/up_assert.c create mode 100755 nuttx/arch/x86/src/common/up_blocktask.c create mode 100644 nuttx/arch/x86/src/common/up_copystate.c create mode 100644 nuttx/arch/x86/src/common/up_exit.c create mode 100644 nuttx/arch/x86/src/common/up_initialize.c create mode 100644 nuttx/arch/x86/src/common/up_internal.h create mode 100644 nuttx/arch/x86/src/common/up_interruptcontext.c create mode 100644 nuttx/arch/x86/src/common/up_lowputs.c create mode 100644 nuttx/arch/x86/src/common/up_mdelay.c create mode 100644 nuttx/arch/x86/src/common/up_modifyreg16.c create mode 100644 nuttx/arch/x86/src/common/up_modifyreg32.c create mode 100644 nuttx/arch/x86/src/common/up_modifyreg8.c create mode 100644 nuttx/arch/x86/src/common/up_puts.c create mode 100755 nuttx/arch/x86/src/common/up_releasepending.c create mode 100755 nuttx/arch/x86/src/common/up_reprioritizertr.c create mode 100644 nuttx/arch/x86/src/common/up_udelay.c create mode 100755 nuttx/arch/x86/src/common/up_unblocktask.c create mode 100644 nuttx/arch/x86/src/i486/i486_utils.S create mode 100644 nuttx/arch/x86/src/i486/up_createstack.c create mode 100644 nuttx/arch/x86/src/i486/up_initialstate.c create mode 100755 nuttx/arch/x86/src/i486/up_irq.c create mode 100644 nuttx/arch/x86/src/i486/up_regdump.c create mode 100644 nuttx/arch/x86/src/i486/up_releasestack.c create mode 100644 nuttx/arch/x86/src/i486/up_savestate.c create mode 100644 nuttx/arch/x86/src/i486/up_schedulesigaction.c create mode 100644 nuttx/arch/x86/src/i486/up_sigdeliver.c create mode 100755 nuttx/arch/x86/src/i486/up_syscall6.S create mode 100644 nuttx/arch/x86/src/i486/up_usestack.c create mode 100755 nuttx/arch/x86/src/qemu/Make.defs create mode 100755 nuttx/arch/x86/src/qemu/chip.h create mode 100644 nuttx/arch/x86/src/qemu/qemu_fullcontextrestore.S create mode 100644 nuttx/arch/x86/src/qemu/qemu_handlers.c create mode 100755 nuttx/arch/x86/src/qemu/qemu_head.S create mode 100644 nuttx/arch/x86/src/qemu/qemu_idle.c create mode 100755 nuttx/arch/x86/src/qemu/qemu_internal.h create mode 100644 nuttx/arch/x86/src/qemu/qemu_lowputc.c create mode 100644 nuttx/arch/x86/src/qemu/qemu_lowsetup.c create mode 100755 nuttx/arch/x86/src/qemu/qemu_memorymap.h create mode 100644 nuttx/arch/x86/src/qemu/qemu_saveusercontext.S create mode 100644 nuttx/arch/x86/src/qemu/qemu_serial.c create mode 100755 nuttx/arch/x86/src/qemu/qemu_timerisr.c create mode 100755 nuttx/arch/x86/src/qemu/qemu_vectors.S create mode 100644 nuttx/arch/z16/include/arch.h create mode 100644 nuttx/arch/z16/include/irq.h create mode 100644 nuttx/arch/z16/include/limits.h create mode 100644 nuttx/arch/z16/include/serial.h create mode 100644 nuttx/arch/z16/include/syscall.h create mode 100644 nuttx/arch/z16/include/types.h create mode 100644 nuttx/arch/z16/include/z16f/arch.h create mode 100644 nuttx/arch/z16/include/z16f/irq.h create mode 100644 nuttx/arch/z16/src/Makefile create mode 100644 nuttx/arch/z16/src/common/up_allocateheap.c create mode 100644 nuttx/arch/z16/src/common/up_assert.c create mode 100644 nuttx/arch/z16/src/common/up_blocktask.c create mode 100644 nuttx/arch/z16/src/common/up_copystate.c create mode 100644 nuttx/arch/z16/src/common/up_createstack.c create mode 100644 nuttx/arch/z16/src/common/up_doirq.c create mode 100644 nuttx/arch/z16/src/common/up_exit.c create mode 100644 nuttx/arch/z16/src/common/up_idle.c create mode 100644 nuttx/arch/z16/src/common/up_initialize.c create mode 100644 nuttx/arch/z16/src/common/up_initialstate.c create mode 100644 nuttx/arch/z16/src/common/up_internal.h create mode 100644 nuttx/arch/z16/src/common/up_interruptcontext.c create mode 100644 nuttx/arch/z16/src/common/up_mdelay.c create mode 100644 nuttx/arch/z16/src/common/up_registerdump.c create mode 100644 nuttx/arch/z16/src/common/up_releasepending.c create mode 100644 nuttx/arch/z16/src/common/up_releasestack.c create mode 100644 nuttx/arch/z16/src/common/up_reprioritizertr.c create mode 100644 nuttx/arch/z16/src/common/up_schedulesigaction.c create mode 100644 nuttx/arch/z16/src/common/up_sigdeliver.c create mode 100644 nuttx/arch/z16/src/common/up_stackdump.c create mode 100644 nuttx/arch/z16/src/common/up_udelay.c create mode 100644 nuttx/arch/z16/src/common/up_unblocktask.c create mode 100644 nuttx/arch/z16/src/common/up_usestack.c create mode 100644 nuttx/arch/z16/src/z16f/Make.defs create mode 100644 nuttx/arch/z16/src/z16f/chip.h create mode 100644 nuttx/arch/z16/src/z16f/z16f_clkinit.c create mode 100755 nuttx/arch/z16/src/z16f/z16f_head.S create mode 100644 nuttx/arch/z16/src/z16f/z16f_irq.c create mode 100755 nuttx/arch/z16/src/z16f/z16f_lowuart.S create mode 100755 nuttx/arch/z16/src/z16f/z16f_restoreusercontext.S create mode 100644 nuttx/arch/z16/src/z16f/z16f_saveusercontext.S create mode 100644 nuttx/arch/z16/src/z16f/z16f_serial.c create mode 100644 nuttx/arch/z16/src/z16f/z16f_sysexec.c create mode 100644 nuttx/arch/z16/src/z16f/z16f_timerisr.c create mode 100644 nuttx/arch/z80/include/arch.h create mode 100644 nuttx/arch/z80/include/ez80/arch.h create mode 100644 nuttx/arch/z80/include/ez80/io.h create mode 100644 nuttx/arch/z80/include/ez80/irq.h create mode 100755 nuttx/arch/z80/include/ez80/limits.h create mode 100644 nuttx/arch/z80/include/ez80/types.h create mode 100644 nuttx/arch/z80/include/io.h create mode 100644 nuttx/arch/z80/include/irq.h create mode 100644 nuttx/arch/z80/include/limits.h create mode 100644 nuttx/arch/z80/include/serial.h create mode 100644 nuttx/arch/z80/include/syscall.h create mode 100644 nuttx/arch/z80/include/types.h create mode 100644 nuttx/arch/z80/include/z8/arch.h create mode 100644 nuttx/arch/z80/include/z8/irq.h create mode 100755 nuttx/arch/z80/include/z8/limits.h create mode 100644 nuttx/arch/z80/include/z8/types.h create mode 100644 nuttx/arch/z80/include/z80/arch.h create mode 100644 nuttx/arch/z80/include/z80/io.h create mode 100644 nuttx/arch/z80/include/z80/irq.h create mode 100755 nuttx/arch/z80/include/z80/limits.h create mode 100644 nuttx/arch/z80/include/z80/types.h create mode 100644 nuttx/arch/z80/src/Makefile create mode 100644 nuttx/arch/z80/src/Makefile.sdcc create mode 100644 nuttx/arch/z80/src/Makefile.zdsii create mode 100644 nuttx/arch/z80/src/common/up_allocateheap.c create mode 100644 nuttx/arch/z80/src/common/up_arch.h create mode 100644 nuttx/arch/z80/src/common/up_assert.c create mode 100644 nuttx/arch/z80/src/common/up_blocktask.c create mode 100644 nuttx/arch/z80/src/common/up_createstack.c create mode 100644 nuttx/arch/z80/src/common/up_doirq.c create mode 100644 nuttx/arch/z80/src/common/up_exit.c create mode 100644 nuttx/arch/z80/src/common/up_idle.c create mode 100644 nuttx/arch/z80/src/common/up_initialize.c create mode 100644 nuttx/arch/z80/src/common/up_internal.h create mode 100644 nuttx/arch/z80/src/common/up_interruptcontext.c create mode 100644 nuttx/arch/z80/src/common/up_mdelay.c create mode 100644 nuttx/arch/z80/src/common/up_puts.c create mode 100644 nuttx/arch/z80/src/common/up_releasepending.c create mode 100644 nuttx/arch/z80/src/common/up_releasestack.c create mode 100644 nuttx/arch/z80/src/common/up_reprioritizertr.c create mode 100644 nuttx/arch/z80/src/common/up_stackdump.c create mode 100644 nuttx/arch/z80/src/common/up_udelay.c create mode 100644 nuttx/arch/z80/src/common/up_unblocktask.c create mode 100644 nuttx/arch/z80/src/common/up_usestack.c create mode 100644 nuttx/arch/z80/src/ez80/Make.defs create mode 100644 nuttx/arch/z80/src/ez80/chip.h create mode 100644 nuttx/arch/z80/src/ez80/ez80_clock.c create mode 100644 nuttx/arch/z80/src/ez80/ez80_copystate.c create mode 100644 nuttx/arch/z80/src/ez80/ez80_emac.c create mode 100644 nuttx/arch/z80/src/ez80/ez80_i2c.c create mode 100644 nuttx/arch/z80/src/ez80/ez80_initialstate.c create mode 100644 nuttx/arch/z80/src/ez80/ez80_io.asm create mode 100644 nuttx/arch/z80/src/ez80/ez80_irq.c create mode 100644 nuttx/arch/z80/src/ez80/ez80_irqsave.asm create mode 100644 nuttx/arch/z80/src/ez80/ez80_lowuart.c create mode 100644 nuttx/arch/z80/src/ez80/ez80_registerdump.c create mode 100644 nuttx/arch/z80/src/ez80/ez80_restorecontext.asm create mode 100644 nuttx/arch/z80/src/ez80/ez80_saveusercontext.asm create mode 100644 nuttx/arch/z80/src/ez80/ez80_schedulesigaction.c create mode 100644 nuttx/arch/z80/src/ez80/ez80_serial.c create mode 100644 nuttx/arch/z80/src/ez80/ez80_sigdeliver.c create mode 100755 nuttx/arch/z80/src/ez80/ez80_spi.c create mode 100644 nuttx/arch/z80/src/ez80/ez80_startup.asm create mode 100644 nuttx/arch/z80/src/ez80/ez80_timerisr.c create mode 100644 nuttx/arch/z80/src/ez80/ez80_vectors.asm create mode 100644 nuttx/arch/z80/src/ez80/ez80f91.h create mode 100644 nuttx/arch/z80/src/ez80/ez80f91_emac.h create mode 100644 nuttx/arch/z80/src/ez80/ez80f91_i2c.h create mode 100644 nuttx/arch/z80/src/ez80/ez80f91_init.asm create mode 100644 nuttx/arch/z80/src/ez80/ez80f91_spi.h create mode 100644 nuttx/arch/z80/src/ez80/switch.h create mode 100644 nuttx/arch/z80/src/ez80/up_mem.h create mode 100755 nuttx/arch/z80/src/mkhpbase.sh create mode 100644 nuttx/arch/z80/src/z8/Make.defs create mode 100644 nuttx/arch/z80/src/z8/chip.h create mode 100644 nuttx/arch/z80/src/z8/switch.h create mode 100644 nuttx/arch/z80/src/z8/up_mem.h create mode 100755 nuttx/arch/z80/src/z8/z8_head.S create mode 100755 nuttx/arch/z80/src/z8/z8_i2c.c create mode 100644 nuttx/arch/z80/src/z8/z8_initialstate.c create mode 100644 nuttx/arch/z80/src/z8/z8_irq.c create mode 100644 nuttx/arch/z80/src/z8/z8_lowuart.c create mode 100644 nuttx/arch/z80/src/z8/z8_registerdump.c create mode 100755 nuttx/arch/z80/src/z8/z8_restorecontext.S create mode 100644 nuttx/arch/z80/src/z8/z8_saveirqcontext.c create mode 100755 nuttx/arch/z80/src/z8/z8_saveusercontext.S create mode 100644 nuttx/arch/z80/src/z8/z8_schedulesigaction.c create mode 100755 nuttx/arch/z80/src/z8/z8_serial.c create mode 100644 nuttx/arch/z80/src/z8/z8_sigdeliver.c create mode 100644 nuttx/arch/z80/src/z8/z8_timerisr.c create mode 100755 nuttx/arch/z80/src/z8/z8_vector.S create mode 100644 nuttx/arch/z80/src/z80/Make.defs create mode 100644 nuttx/arch/z80/src/z80/README.txt create mode 100644 nuttx/arch/z80/src/z80/chip.h create mode 100644 nuttx/arch/z80/src/z80/switch.h create mode 100644 nuttx/arch/z80/src/z80/z80_copystate.c create mode 100644 nuttx/arch/z80/src/z80/z80_head.asm create mode 100644 nuttx/arch/z80/src/z80/z80_initialstate.c create mode 100644 nuttx/arch/z80/src/z80/z80_io.c create mode 100644 nuttx/arch/z80/src/z80/z80_irq.c create mode 100644 nuttx/arch/z80/src/z80/z80_registerdump.c create mode 100644 nuttx/arch/z80/src/z80/z80_restoreusercontext.asm create mode 100644 nuttx/arch/z80/src/z80/z80_rom.asm create mode 100644 nuttx/arch/z80/src/z80/z80_saveusercontext.asm create mode 100644 nuttx/arch/z80/src/z80/z80_schedulesigaction.c create mode 100644 nuttx/arch/z80/src/z80/z80_sigdeliver.c create mode 100644 nuttx/binfmt/Makefile create mode 100644 nuttx/binfmt/binfmt_dumpmodule.c create mode 100644 nuttx/binfmt/binfmt_exec.c create mode 100644 nuttx/binfmt/binfmt_execmodule.c create mode 100644 nuttx/binfmt/binfmt_globals.c create mode 100644 nuttx/binfmt/binfmt_internal.h create mode 100644 nuttx/binfmt/binfmt_loadmodule.c create mode 100644 nuttx/binfmt/binfmt_register.c create mode 100644 nuttx/binfmt/binfmt_unloadmodule.c create mode 100644 nuttx/binfmt/binfmt_unregister.c create mode 100644 nuttx/binfmt/libnxflat/Make.defs create mode 100644 nuttx/binfmt/libnxflat/gnu-nxflat.ld create mode 100644 nuttx/binfmt/libnxflat/libnxflat_bind.c create mode 100644 nuttx/binfmt/libnxflat/libnxflat_init.c create mode 100644 nuttx/binfmt/libnxflat/libnxflat_load.c create mode 100644 nuttx/binfmt/libnxflat/libnxflat_read.c create mode 100644 nuttx/binfmt/libnxflat/libnxflat_uninit.c create mode 100644 nuttx/binfmt/libnxflat/libnxflat_unload.c create mode 100644 nuttx/binfmt/libnxflat/libnxflat_verify.c create mode 100644 nuttx/binfmt/nxflat.c create mode 100644 nuttx/binfmt/symtab_findbyname.c create mode 100644 nuttx/binfmt/symtab_findbyvalue.c create mode 100644 nuttx/binfmt/symtab_findorderedbyname.c create mode 100644 nuttx/binfmt/symtab_findorderedbyvalue.c create mode 100644 nuttx/configs/README.txt create mode 100644 nuttx/configs/amber/README.txt create mode 100644 nuttx/configs/amber/hello/Make.defs create mode 100644 nuttx/configs/amber/hello/appconfig create mode 100644 nuttx/configs/amber/hello/defconfig create mode 100644 nuttx/configs/amber/hello/ld.script create mode 100755 nuttx/configs/amber/hello/setenv.sh create mode 100755 nuttx/configs/amber/include/board.h create mode 100755 nuttx/configs/amber/src/Makefile create mode 100755 nuttx/configs/amber/src/amber_internal.h create mode 100755 nuttx/configs/amber/src/up_boot.c create mode 100755 nuttx/configs/avr32dev1/README.txt create mode 100755 nuttx/configs/avr32dev1/include/board.h create mode 100755 nuttx/configs/avr32dev1/nsh/Make.defs create mode 100644 nuttx/configs/avr32dev1/nsh/appconfig create mode 100755 nuttx/configs/avr32dev1/nsh/defconfig create mode 100755 nuttx/configs/avr32dev1/nsh/ld.script create mode 100755 nuttx/configs/avr32dev1/nsh/setenv.sh create mode 100755 nuttx/configs/avr32dev1/ostest/Make.defs create mode 100644 nuttx/configs/avr32dev1/ostest/appconfig create mode 100755 nuttx/configs/avr32dev1/ostest/defconfig create mode 100755 nuttx/configs/avr32dev1/ostest/ld.script create mode 100755 nuttx/configs/avr32dev1/ostest/setenv.sh create mode 100755 nuttx/configs/avr32dev1/ostest/test-result.txt create mode 100755 nuttx/configs/avr32dev1/src/Makefile create mode 100755 nuttx/configs/avr32dev1/src/avr32dev1_internal.h create mode 100755 nuttx/configs/avr32dev1/src/up_boot.c create mode 100755 nuttx/configs/avr32dev1/src/up_buttons.c create mode 100755 nuttx/configs/avr32dev1/src/up_leds.c create mode 100755 nuttx/configs/avr32dev1/tools/doisp.sh create mode 100644 nuttx/configs/c5471evm/README.txt create mode 100644 nuttx/configs/c5471evm/doc/test-result.txt create mode 100644 nuttx/configs/c5471evm/httpd/Make.defs create mode 100644 nuttx/configs/c5471evm/httpd/appconfig create mode 100644 nuttx/configs/c5471evm/httpd/defconfig create mode 100644 nuttx/configs/c5471evm/httpd/ld.script create mode 100755 nuttx/configs/c5471evm/httpd/setenv.sh create mode 100644 nuttx/configs/c5471evm/include/README.txt create mode 100644 nuttx/configs/c5471evm/include/board.h create mode 100644 nuttx/configs/c5471evm/nettest/Make.defs create mode 100644 nuttx/configs/c5471evm/nettest/appconfig create mode 100644 nuttx/configs/c5471evm/nettest/defconfig create mode 100644 nuttx/configs/c5471evm/nettest/ld.script create mode 100755 nuttx/configs/c5471evm/nettest/setenv.sh create mode 100644 nuttx/configs/c5471evm/nsh/Make.defs create mode 100644 nuttx/configs/c5471evm/nsh/appconfig create mode 100644 nuttx/configs/c5471evm/nsh/defconfig create mode 100644 nuttx/configs/c5471evm/nsh/ld.script create mode 100755 nuttx/configs/c5471evm/nsh/setenv.sh create mode 100644 nuttx/configs/c5471evm/ostest/Make.defs create mode 100644 nuttx/configs/c5471evm/ostest/appconfig create mode 100644 nuttx/configs/c5471evm/ostest/defconfig create mode 100644 nuttx/configs/c5471evm/ostest/ld.script create mode 100755 nuttx/configs/c5471evm/ostest/setenv.sh create mode 100644 nuttx/configs/c5471evm/src/Makefile create mode 100644 nuttx/configs/c5471evm/src/README.txt create mode 100644 nuttx/configs/c5471evm/src/up_leds.c create mode 100755 nuttx/configs/demo9s12ne64/README.txt create mode 100755 nuttx/configs/demo9s12ne64/include/board.h create mode 100755 nuttx/configs/demo9s12ne64/ostest/Make.defs create mode 100644 nuttx/configs/demo9s12ne64/ostest/appconfig create mode 100755 nuttx/configs/demo9s12ne64/ostest/defconfig create mode 100755 nuttx/configs/demo9s12ne64/ostest/ld.script.banked create mode 100755 nuttx/configs/demo9s12ne64/ostest/ld.script.nonbanked create mode 100755 nuttx/configs/demo9s12ne64/ostest/setenv.sh create mode 100755 nuttx/configs/demo9s12ne64/src/Makefile create mode 100755 nuttx/configs/demo9s12ne64/src/demo9s12ne64.h create mode 100755 nuttx/configs/demo9s12ne64/src/up_boot.c create mode 100755 nuttx/configs/demo9s12ne64/src/up_buttons.c create mode 100755 nuttx/configs/demo9s12ne64/src/up_leds.c create mode 100755 nuttx/configs/demo9s12ne64/src/up_nsh.c create mode 100755 nuttx/configs/demo9s12ne64/src/up_spi.c create mode 100755 nuttx/configs/detron/README.txt create mode 100755 nuttx/configs/detron/hidkbd/Make.defs create mode 100644 nuttx/configs/detron/hidkbd/appconfig create mode 100755 nuttx/configs/detron/hidkbd/defconfig create mode 100755 nuttx/configs/detron/hidkbd/ld.script create mode 100755 nuttx/configs/detron/hidkbd/setenv.sh create mode 100755 nuttx/configs/detron/include/board.h create mode 100755 nuttx/configs/detron/nsh/Make.defs create mode 100644 nuttx/configs/detron/nsh/appconfig create mode 100755 nuttx/configs/detron/nsh/defconfig create mode 100755 nuttx/configs/detron/nsh/ld.script create mode 100755 nuttx/configs/detron/nsh/setenv.sh create mode 100755 nuttx/configs/detron/ostest/Make.defs create mode 100644 nuttx/configs/detron/ostest/appconfig create mode 100755 nuttx/configs/detron/ostest/defconfig create mode 100755 nuttx/configs/detron/ostest/ld.script create mode 100755 nuttx/configs/detron/ostest/setenv.sh create mode 100755 nuttx/configs/detron/src/Makefile create mode 100755 nuttx/configs/detron/src/detron_internal.h create mode 100755 nuttx/configs/detron/src/up_boot.c create mode 100644 nuttx/configs/detron/src/up_buttons.c create mode 100755 nuttx/configs/detron/src/up_nsh.c create mode 100755 nuttx/configs/detron/wlan/Make.defs create mode 100644 nuttx/configs/detron/wlan/appconfig create mode 100755 nuttx/configs/detron/wlan/defconfig create mode 100755 nuttx/configs/detron/wlan/ld.script create mode 100755 nuttx/configs/detron/wlan/setenv.sh create mode 100644 nuttx/configs/ea3131/README.txt create mode 100644 nuttx/configs/ea3131/include/board.h create mode 100644 nuttx/configs/ea3131/include/board_memorymap.h create mode 100644 nuttx/configs/ea3131/locked/Makefile create mode 100644 nuttx/configs/ea3131/locked/ld-locked.script create mode 100755 nuttx/configs/ea3131/locked/mklocked.sh create mode 100644 nuttx/configs/ea3131/nsh/Make.defs create mode 100644 nuttx/configs/ea3131/nsh/appconfig create mode 100644 nuttx/configs/ea3131/nsh/defconfig create mode 100644 nuttx/configs/ea3131/nsh/ld.script create mode 100755 nuttx/configs/ea3131/nsh/setenv.sh create mode 100644 nuttx/configs/ea3131/ostest/Make.defs create mode 100644 nuttx/configs/ea3131/ostest/appconfig create mode 100644 nuttx/configs/ea3131/ostest/defconfig create mode 100644 nuttx/configs/ea3131/ostest/ld.script create mode 100755 nuttx/configs/ea3131/ostest/setenv.sh create mode 100644 nuttx/configs/ea3131/pgnsh/Make.defs create mode 100644 nuttx/configs/ea3131/pgnsh/appconfig create mode 100644 nuttx/configs/ea3131/pgnsh/defconfig create mode 100644 nuttx/configs/ea3131/pgnsh/ld.script create mode 100755 nuttx/configs/ea3131/pgnsh/setenv.sh create mode 100644 nuttx/configs/ea3131/src/Makefile create mode 100644 nuttx/configs/ea3131/src/ea3131_internal.h create mode 100644 nuttx/configs/ea3131/src/up_boot.c create mode 100644 nuttx/configs/ea3131/src/up_buttons.c create mode 100644 nuttx/configs/ea3131/src/up_clkinit.c create mode 100644 nuttx/configs/ea3131/src/up_fillpage.c create mode 100644 nuttx/configs/ea3131/src/up_leds.c create mode 100644 nuttx/configs/ea3131/src/up_mem.c create mode 100644 nuttx/configs/ea3131/src/up_nsh.c create mode 100644 nuttx/configs/ea3131/src/up_spi.c create mode 100644 nuttx/configs/ea3131/src/up_usbstrg.c create mode 100644 nuttx/configs/ea3131/tools/Makefile create mode 100644 nuttx/configs/ea3131/tools/armusbocd.cfg create mode 100644 nuttx/configs/ea3131/tools/crc32.c create mode 100644 nuttx/configs/ea3131/tools/lpchdr.c create mode 100644 nuttx/configs/ea3131/tools/lpchdr.h create mode 100755 nuttx/configs/ea3131/tools/mklpc.sh create mode 100755 nuttx/configs/ea3131/tools/oocd.sh create mode 100644 nuttx/configs/ea3131/usbserial/Make.defs create mode 100644 nuttx/configs/ea3131/usbserial/appconfig create mode 100644 nuttx/configs/ea3131/usbserial/defconfig create mode 100644 nuttx/configs/ea3131/usbserial/ld.script create mode 100755 nuttx/configs/ea3131/usbserial/setenv.sh create mode 100644 nuttx/configs/ea3131/usbstorage/Make.defs create mode 100644 nuttx/configs/ea3131/usbstorage/appconfig create mode 100644 nuttx/configs/ea3131/usbstorage/defconfig create mode 100644 nuttx/configs/ea3131/usbstorage/ld.script create mode 100755 nuttx/configs/ea3131/usbstorage/setenv.sh create mode 100644 nuttx/configs/ea3152/README.txt create mode 100644 nuttx/configs/ea3152/include/board.h create mode 100644 nuttx/configs/ea3152/include/board_memorymap.h create mode 100644 nuttx/configs/ea3152/ostest/Make.defs create mode 100644 nuttx/configs/ea3152/ostest/appconfig create mode 100644 nuttx/configs/ea3152/ostest/defconfig create mode 100644 nuttx/configs/ea3152/ostest/ld.script create mode 100755 nuttx/configs/ea3152/ostest/setenv.sh create mode 100644 nuttx/configs/ea3152/src/Makefile create mode 100644 nuttx/configs/ea3152/src/ea3152_internal.h create mode 100644 nuttx/configs/ea3152/src/up_boot.c create mode 100644 nuttx/configs/ea3152/src/up_buttons.c create mode 100644 nuttx/configs/ea3152/src/up_clkinit.c create mode 100644 nuttx/configs/ea3152/src/up_fillpage.c create mode 100644 nuttx/configs/ea3152/src/up_leds.c create mode 100644 nuttx/configs/ea3152/src/up_mem.c create mode 100644 nuttx/configs/ea3152/src/up_nsh.c create mode 100644 nuttx/configs/ea3152/src/up_spi.c create mode 100644 nuttx/configs/ea3152/src/up_usbstrg.c create mode 100644 nuttx/configs/ea3152/tools/Makefile create mode 100644 nuttx/configs/ea3152/tools/armusbocd.cfg create mode 100644 nuttx/configs/ea3152/tools/crc32.c create mode 100644 nuttx/configs/ea3152/tools/jlink.cfg create mode 100644 nuttx/configs/ea3152/tools/lpc3152.cfg create mode 100644 nuttx/configs/ea3152/tools/lpchdr.c create mode 100644 nuttx/configs/ea3152/tools/lpchdr.h create mode 100755 nuttx/configs/ea3152/tools/mklpc.sh create mode 100644 nuttx/configs/ea3152/tools/olimex-arm-usb-ocd.cfg create mode 100755 nuttx/configs/ea3152/tools/oocd.sh create mode 100644 nuttx/configs/eagle100/README.txt create mode 100644 nuttx/configs/eagle100/httpd/Make.defs create mode 100644 nuttx/configs/eagle100/httpd/appconfig create mode 100644 nuttx/configs/eagle100/httpd/defconfig create mode 100644 nuttx/configs/eagle100/httpd/ld.script create mode 100755 nuttx/configs/eagle100/httpd/setenv.sh create mode 100644 nuttx/configs/eagle100/include/README.txt create mode 100644 nuttx/configs/eagle100/include/board.h create mode 100644 nuttx/configs/eagle100/nettest/Make.defs create mode 100644 nuttx/configs/eagle100/nettest/appconfig create mode 100644 nuttx/configs/eagle100/nettest/defconfig create mode 100644 nuttx/configs/eagle100/nettest/ld.script create mode 100755 nuttx/configs/eagle100/nettest/setenv.sh create mode 100644 nuttx/configs/eagle100/nsh/Make.defs create mode 100644 nuttx/configs/eagle100/nsh/appconfig create mode 100644 nuttx/configs/eagle100/nsh/defconfig create mode 100644 nuttx/configs/eagle100/nsh/ld.script create mode 100755 nuttx/configs/eagle100/nsh/setenv.sh create mode 100644 nuttx/configs/eagle100/nxflat/Make.defs create mode 100644 nuttx/configs/eagle100/nxflat/appconfig create mode 100644 nuttx/configs/eagle100/nxflat/defconfig create mode 100644 nuttx/configs/eagle100/nxflat/ld.script create mode 100755 nuttx/configs/eagle100/nxflat/setenv.sh create mode 100644 nuttx/configs/eagle100/ostest/Make.defs create mode 100644 nuttx/configs/eagle100/ostest/appconfig create mode 100644 nuttx/configs/eagle100/ostest/defconfig create mode 100644 nuttx/configs/eagle100/ostest/ld.script create mode 100755 nuttx/configs/eagle100/ostest/setenv.sh create mode 100644 nuttx/configs/eagle100/ostest/test-result.txt create mode 100644 nuttx/configs/eagle100/src/Makefile create mode 100644 nuttx/configs/eagle100/src/README.txt create mode 100644 nuttx/configs/eagle100/src/eagle100_internal.h create mode 100644 nuttx/configs/eagle100/src/up_boot.c create mode 100644 nuttx/configs/eagle100/src/up_ethernet.c create mode 100644 nuttx/configs/eagle100/src/up_leds.c create mode 100644 nuttx/configs/eagle100/src/up_nsh.c create mode 100644 nuttx/configs/eagle100/src/up_ssi.c create mode 100644 nuttx/configs/eagle100/thttpd/Make.defs create mode 100644 nuttx/configs/eagle100/thttpd/appconfig create mode 100644 nuttx/configs/eagle100/thttpd/defconfig create mode 100644 nuttx/configs/eagle100/thttpd/ld.script create mode 100755 nuttx/configs/eagle100/thttpd/setenv.sh create mode 100644 nuttx/configs/ez80f910200kitg/README.txt create mode 100644 nuttx/configs/ez80f910200kitg/include/board.h create mode 100644 nuttx/configs/ez80f910200kitg/ostest/Make.defs create mode 100644 nuttx/configs/ez80f910200kitg/ostest/README.txt create mode 100644 nuttx/configs/ez80f910200kitg/ostest/appconfig create mode 100644 nuttx/configs/ez80f910200kitg/ostest/defconfig create mode 100755 nuttx/configs/ez80f910200kitg/ostest/ostest.linkcmd create mode 100755 nuttx/configs/ez80f910200kitg/ostest/ostest.zdsproj create mode 100755 nuttx/configs/ez80f910200kitg/ostest/setenv.sh create mode 100644 nuttx/configs/ez80f910200kitg/ostest/test-result.txt create mode 100644 nuttx/configs/ez80f910200kitg/src/Makefile create mode 100644 nuttx/configs/ez80f910200kitg/src/ez80_leds.c create mode 100644 nuttx/configs/ez80f910200kitg/src/ez80_lowinit.c create mode 100644 nuttx/configs/ez80f910200zco/README.txt create mode 100644 nuttx/configs/ez80f910200zco/dhcpd/Make.defs create mode 100644 nuttx/configs/ez80f910200zco/dhcpd/README.txt create mode 100644 nuttx/configs/ez80f910200zco/dhcpd/appconfig create mode 100644 nuttx/configs/ez80f910200zco/dhcpd/defconfig create mode 100755 nuttx/configs/ez80f910200zco/dhcpd/dhcpd.linkcmd create mode 100755 nuttx/configs/ez80f910200zco/dhcpd/dhcpd.zdsproj create mode 100755 nuttx/configs/ez80f910200zco/dhcpd/setenv.sh create mode 100644 nuttx/configs/ez80f910200zco/httpd/Make.defs create mode 100644 nuttx/configs/ez80f910200zco/httpd/README.txt create mode 100644 nuttx/configs/ez80f910200zco/httpd/appconfig create mode 100644 nuttx/configs/ez80f910200zco/httpd/defconfig create mode 100755 nuttx/configs/ez80f910200zco/httpd/httpd.linkcmd create mode 100755 nuttx/configs/ez80f910200zco/httpd/httpd.zdsproj create mode 100755 nuttx/configs/ez80f910200zco/httpd/setenv.sh create mode 100644 nuttx/configs/ez80f910200zco/include/board.h create mode 100644 nuttx/configs/ez80f910200zco/nettest/Make.defs create mode 100644 nuttx/configs/ez80f910200zco/nettest/README.txt create mode 100644 nuttx/configs/ez80f910200zco/nettest/appconfig create mode 100644 nuttx/configs/ez80f910200zco/nettest/defconfig create mode 100755 nuttx/configs/ez80f910200zco/nettest/nettest.linkcmd create mode 100755 nuttx/configs/ez80f910200zco/nettest/nettest.zdsproj create mode 100755 nuttx/configs/ez80f910200zco/nettest/setenv.sh create mode 100644 nuttx/configs/ez80f910200zco/nsh/Make.defs create mode 100644 nuttx/configs/ez80f910200zco/nsh/README.txt create mode 100644 nuttx/configs/ez80f910200zco/nsh/appconfig create mode 100644 nuttx/configs/ez80f910200zco/nsh/defconfig create mode 100755 nuttx/configs/ez80f910200zco/nsh/nsh.linkcmd create mode 100755 nuttx/configs/ez80f910200zco/nsh/nsh.zdsproj create mode 100755 nuttx/configs/ez80f910200zco/nsh/sample-run.txt create mode 100755 nuttx/configs/ez80f910200zco/nsh/setenv.sh create mode 100644 nuttx/configs/ez80f910200zco/ostest/Make.defs create mode 100644 nuttx/configs/ez80f910200zco/ostest/README.txt create mode 100644 nuttx/configs/ez80f910200zco/ostest/appconfig create mode 100644 nuttx/configs/ez80f910200zco/ostest/defconfig create mode 100755 nuttx/configs/ez80f910200zco/ostest/ostest.linkcmd create mode 100755 nuttx/configs/ez80f910200zco/ostest/ostest.zdsproj create mode 100755 nuttx/configs/ez80f910200zco/ostest/setenv.sh create mode 100644 nuttx/configs/ez80f910200zco/ostest/test-result.txt create mode 100644 nuttx/configs/ez80f910200zco/poll/Make.defs create mode 100644 nuttx/configs/ez80f910200zco/poll/README.txt create mode 100644 nuttx/configs/ez80f910200zco/poll/appconfig create mode 100644 nuttx/configs/ez80f910200zco/poll/defconfig create mode 100755 nuttx/configs/ez80f910200zco/poll/poll.linkcmd create mode 100755 nuttx/configs/ez80f910200zco/poll/poll.zdsproj create mode 100755 nuttx/configs/ez80f910200zco/poll/setenv.sh create mode 100644 nuttx/configs/ez80f910200zco/src/Makefile create mode 100755 nuttx/configs/ez80f910200zco/src/ez80_buttons.c create mode 100644 nuttx/configs/ez80f910200zco/src/ez80_leds.c create mode 100644 nuttx/configs/ez80f910200zco/src/ez80_lowinit.c create mode 100644 nuttx/configs/ez80f910200zco/src/ez80f910200zco.h create mode 100755 nuttx/configs/hymini-stm32v/README.txt create mode 100644 nuttx/configs/hymini-stm32v/buttons/Make.defs create mode 100644 nuttx/configs/hymini-stm32v/buttons/appconfig create mode 100644 nuttx/configs/hymini-stm32v/buttons/defconfig create mode 100644 nuttx/configs/hymini-stm32v/buttons/ld.script create mode 100644 nuttx/configs/hymini-stm32v/buttons/ld.script.dfu create mode 100755 nuttx/configs/hymini-stm32v/buttons/setenv.sh create mode 100755 nuttx/configs/hymini-stm32v/include/README.txt create mode 100755 nuttx/configs/hymini-stm32v/include/board.h create mode 100644 nuttx/configs/hymini-stm32v/nsh/Make.defs create mode 100644 nuttx/configs/hymini-stm32v/nsh/appconfig create mode 100755 nuttx/configs/hymini-stm32v/nsh/defconfig create mode 100755 nuttx/configs/hymini-stm32v/nsh/ld.script create mode 100755 nuttx/configs/hymini-stm32v/nsh/ld.script.dfu create mode 100755 nuttx/configs/hymini-stm32v/nsh/setenv.sh create mode 100644 nuttx/configs/hymini-stm32v/nsh2/Make.defs create mode 100644 nuttx/configs/hymini-stm32v/nsh2/appconfig create mode 100644 nuttx/configs/hymini-stm32v/nsh2/defconfig create mode 100644 nuttx/configs/hymini-stm32v/nsh2/ld.script create mode 100644 nuttx/configs/hymini-stm32v/nsh2/ld.script.dfu create mode 100755 nuttx/configs/hymini-stm32v/nsh2/setenv.sh create mode 100644 nuttx/configs/hymini-stm32v/nx/Make.defs create mode 100644 nuttx/configs/hymini-stm32v/nx/appconfig create mode 100644 nuttx/configs/hymini-stm32v/nx/defconfig create mode 100644 nuttx/configs/hymini-stm32v/nx/ld.script create mode 100644 nuttx/configs/hymini-stm32v/nx/ld.script.dfu create mode 100755 nuttx/configs/hymini-stm32v/nx/setenv.sh create mode 100644 nuttx/configs/hymini-stm32v/nxlines/Make.defs create mode 100644 nuttx/configs/hymini-stm32v/nxlines/appconfig create mode 100644 nuttx/configs/hymini-stm32v/nxlines/defconfig create mode 100644 nuttx/configs/hymini-stm32v/nxlines/ld.script create mode 100644 nuttx/configs/hymini-stm32v/nxlines/ld.script.dfu create mode 100755 nuttx/configs/hymini-stm32v/nxlines/setenv.sh create mode 100644 nuttx/configs/hymini-stm32v/src/Makefile create mode 100644 nuttx/configs/hymini-stm32v/src/README.txt create mode 100644 nuttx/configs/hymini-stm32v/src/hymini_stm32v-internal.h create mode 100644 nuttx/configs/hymini-stm32v/src/ssd1289.c create mode 100644 nuttx/configs/hymini-stm32v/src/ssd1289.h create mode 100644 nuttx/configs/hymini-stm32v/src/up_boot.c create mode 100644 nuttx/configs/hymini-stm32v/src/up_buttons.c create mode 100644 nuttx/configs/hymini-stm32v/src/up_leds.c create mode 100644 nuttx/configs/hymini-stm32v/src/up_nsh.c create mode 100644 nuttx/configs/hymini-stm32v/src/up_spi.c create mode 100644 nuttx/configs/hymini-stm32v/src/up_ts.c create mode 100644 nuttx/configs/hymini-stm32v/src/up_usbdev.c create mode 100644 nuttx/configs/hymini-stm32v/src/up_usbstrg.c create mode 100644 nuttx/configs/hymini-stm32v/usbserial/Make.defs create mode 100644 nuttx/configs/hymini-stm32v/usbserial/appconfig create mode 100755 nuttx/configs/hymini-stm32v/usbserial/defconfig create mode 100755 nuttx/configs/hymini-stm32v/usbserial/ld.script create mode 100755 nuttx/configs/hymini-stm32v/usbserial/ld.script.dfu create mode 100755 nuttx/configs/hymini-stm32v/usbserial/setenv.sh create mode 100755 nuttx/configs/hymini-stm32v/usbstorage/Make.defs create mode 100644 nuttx/configs/hymini-stm32v/usbstorage/appconfig create mode 100755 nuttx/configs/hymini-stm32v/usbstorage/defconfig create mode 100755 nuttx/configs/hymini-stm32v/usbstorage/ld.script create mode 100755 nuttx/configs/hymini-stm32v/usbstorage/ld.script.dfu create mode 100755 nuttx/configs/hymini-stm32v/usbstorage/setenv.sh create mode 100644 nuttx/configs/kwikstik-k40/README.txt create mode 100755 nuttx/configs/kwikstik-k40/include/board.h create mode 100644 nuttx/configs/kwikstik-k40/ostest/Make.defs create mode 100644 nuttx/configs/kwikstik-k40/ostest/appconfig create mode 100755 nuttx/configs/kwikstik-k40/ostest/defconfig create mode 100755 nuttx/configs/kwikstik-k40/ostest/ld.script create mode 100755 nuttx/configs/kwikstik-k40/ostest/setenv.sh create mode 100755 nuttx/configs/kwikstik-k40/src/Makefile create mode 100755 nuttx/configs/kwikstik-k40/src/kwikstik-internal.h create mode 100755 nuttx/configs/kwikstik-k40/src/up_boot.c create mode 100644 nuttx/configs/kwikstik-k40/src/up_buttons.c create mode 100755 nuttx/configs/kwikstik-k40/src/up_lcd.c create mode 100755 nuttx/configs/kwikstik-k40/src/up_leds.c create mode 100755 nuttx/configs/kwikstik-k40/src/up_nsh.c create mode 100755 nuttx/configs/kwikstik-k40/src/up_spi.c create mode 100644 nuttx/configs/kwikstik-k40/src/up_usbdev.c create mode 100755 nuttx/configs/kwikstik-k40/src/up_usbstrg.c create mode 100755 nuttx/configs/lm3s6965-ek/README.txt create mode 100755 nuttx/configs/lm3s6965-ek/include/README.txt create mode 100755 nuttx/configs/lm3s6965-ek/include/board.h create mode 100755 nuttx/configs/lm3s6965-ek/nsh/Make.defs create mode 100644 nuttx/configs/lm3s6965-ek/nsh/appconfig create mode 100755 nuttx/configs/lm3s6965-ek/nsh/defconfig create mode 100755 nuttx/configs/lm3s6965-ek/nsh/ld.script create mode 100755 nuttx/configs/lm3s6965-ek/nsh/setenv.sh create mode 100755 nuttx/configs/lm3s6965-ek/nx/Make.defs create mode 100644 nuttx/configs/lm3s6965-ek/nx/appconfig create mode 100755 nuttx/configs/lm3s6965-ek/nx/defconfig create mode 100755 nuttx/configs/lm3s6965-ek/nx/ld.script create mode 100755 nuttx/configs/lm3s6965-ek/nx/setenv.sh create mode 100755 nuttx/configs/lm3s6965-ek/ostest/Make.defs create mode 100644 nuttx/configs/lm3s6965-ek/ostest/appconfig create mode 100755 nuttx/configs/lm3s6965-ek/ostest/defconfig create mode 100755 nuttx/configs/lm3s6965-ek/ostest/ld.script create mode 100755 nuttx/configs/lm3s6965-ek/ostest/setenv.sh create mode 100755 nuttx/configs/lm3s6965-ek/src/Makefile create mode 100755 nuttx/configs/lm3s6965-ek/src/README.txt create mode 100755 nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h create mode 100755 nuttx/configs/lm3s6965-ek/src/up_boot.c create mode 100755 nuttx/configs/lm3s6965-ek/src/up_ethernet.c create mode 100755 nuttx/configs/lm3s6965-ek/src/up_leds.c create mode 100755 nuttx/configs/lm3s6965-ek/src/up_nsh.c create mode 100755 nuttx/configs/lm3s6965-ek/src/up_oled.c create mode 100755 nuttx/configs/lm3s6965-ek/src/up_ssi.c create mode 100755 nuttx/configs/lm3s8962-ek/README.txt create mode 100755 nuttx/configs/lm3s8962-ek/include/README.txt create mode 100755 nuttx/configs/lm3s8962-ek/include/board.h create mode 100755 nuttx/configs/lm3s8962-ek/nsh/Make.defs create mode 100644 nuttx/configs/lm3s8962-ek/nsh/appconfig create mode 100755 nuttx/configs/lm3s8962-ek/nsh/defconfig create mode 100755 nuttx/configs/lm3s8962-ek/nsh/ld.script create mode 100755 nuttx/configs/lm3s8962-ek/nsh/setenv.sh create mode 100755 nuttx/configs/lm3s8962-ek/nx/Make.defs create mode 100644 nuttx/configs/lm3s8962-ek/nx/appconfig create mode 100755 nuttx/configs/lm3s8962-ek/nx/defconfig create mode 100755 nuttx/configs/lm3s8962-ek/nx/ld.script create mode 100755 nuttx/configs/lm3s8962-ek/nx/setenv.sh create mode 100755 nuttx/configs/lm3s8962-ek/ostest/Make.defs create mode 100644 nuttx/configs/lm3s8962-ek/ostest/appconfig create mode 100755 nuttx/configs/lm3s8962-ek/ostest/defconfig create mode 100755 nuttx/configs/lm3s8962-ek/ostest/ld.script create mode 100755 nuttx/configs/lm3s8962-ek/ostest/setenv.sh create mode 100755 nuttx/configs/lm3s8962-ek/src/Makefile create mode 100755 nuttx/configs/lm3s8962-ek/src/README.txt create mode 100755 nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h create mode 100755 nuttx/configs/lm3s8962-ek/src/up_boot.c create mode 100755 nuttx/configs/lm3s8962-ek/src/up_ethernet.c create mode 100755 nuttx/configs/lm3s8962-ek/src/up_leds.c create mode 100755 nuttx/configs/lm3s8962-ek/src/up_nsh.c create mode 100755 nuttx/configs/lm3s8962-ek/src/up_oled.c create mode 100755 nuttx/configs/lm3s8962-ek/src/up_ssi.c create mode 100755 nuttx/configs/lpcxpresso-lpc1768/README.txt create mode 100755 nuttx/configs/lpcxpresso-lpc1768/dhcpd/Make.defs create mode 100644 nuttx/configs/lpcxpresso-lpc1768/dhcpd/appconfig create mode 100755 nuttx/configs/lpcxpresso-lpc1768/dhcpd/defconfig create mode 100755 nuttx/configs/lpcxpresso-lpc1768/dhcpd/ld.script create mode 100755 nuttx/configs/lpcxpresso-lpc1768/dhcpd/setenv.sh create mode 100755 nuttx/configs/lpcxpresso-lpc1768/include/board.h create mode 100755 nuttx/configs/lpcxpresso-lpc1768/nsh/Make.defs create mode 100644 nuttx/configs/lpcxpresso-lpc1768/nsh/appconfig create mode 100755 nuttx/configs/lpcxpresso-lpc1768/nsh/defconfig create mode 100755 nuttx/configs/lpcxpresso-lpc1768/nsh/ld.script create mode 100755 nuttx/configs/lpcxpresso-lpc1768/nsh/setenv.sh create mode 100755 nuttx/configs/lpcxpresso-lpc1768/nx/Make.defs create mode 100644 nuttx/configs/lpcxpresso-lpc1768/nx/appconfig create mode 100755 nuttx/configs/lpcxpresso-lpc1768/nx/defconfig create mode 100755 nuttx/configs/lpcxpresso-lpc1768/nx/ld.script create mode 100755 nuttx/configs/lpcxpresso-lpc1768/nx/setenv.sh create mode 100755 nuttx/configs/lpcxpresso-lpc1768/ostest/Make.defs create mode 100644 nuttx/configs/lpcxpresso-lpc1768/ostest/appconfig create mode 100755 nuttx/configs/lpcxpresso-lpc1768/ostest/defconfig create mode 100755 nuttx/configs/lpcxpresso-lpc1768/ostest/ld.script create mode 100755 nuttx/configs/lpcxpresso-lpc1768/ostest/setenv.sh create mode 100755 nuttx/configs/lpcxpresso-lpc1768/src/Makefile create mode 100755 nuttx/configs/lpcxpresso-lpc1768/src/lpcxpresso_internal.h create mode 100755 nuttx/configs/lpcxpresso-lpc1768/src/up_boot.c create mode 100755 nuttx/configs/lpcxpresso-lpc1768/src/up_leds.c create mode 100755 nuttx/configs/lpcxpresso-lpc1768/src/up_nsh.c create mode 100755 nuttx/configs/lpcxpresso-lpc1768/src/up_oled.c create mode 100755 nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c create mode 100755 nuttx/configs/lpcxpresso-lpc1768/src/up_usbstrg.c create mode 100755 nuttx/configs/lpcxpresso-lpc1768/thttpd/Make.defs create mode 100644 nuttx/configs/lpcxpresso-lpc1768/thttpd/appconfig create mode 100755 nuttx/configs/lpcxpresso-lpc1768/thttpd/defconfig create mode 100755 nuttx/configs/lpcxpresso-lpc1768/thttpd/ld.script create mode 100755 nuttx/configs/lpcxpresso-lpc1768/thttpd/setenv.sh create mode 100755 nuttx/configs/lpcxpresso-lpc1768/tools/flash.sh create mode 100755 nuttx/configs/lpcxpresso-lpc1768/usbstorage/Make.defs create mode 100644 nuttx/configs/lpcxpresso-lpc1768/usbstorage/appconfig create mode 100755 nuttx/configs/lpcxpresso-lpc1768/usbstorage/defconfig create mode 100755 nuttx/configs/lpcxpresso-lpc1768/usbstorage/ld.script create mode 100755 nuttx/configs/lpcxpresso-lpc1768/usbstorage/setenv.sh create mode 100644 nuttx/configs/m68332evb/Make.defs create mode 100644 nuttx/configs/m68332evb/appconfig create mode 100644 nuttx/configs/m68332evb/defconfig create mode 100644 nuttx/configs/m68332evb/doc/m68k-defconfig create mode 100644 nuttx/configs/m68332evb/include/README.txt create mode 100644 nuttx/configs/m68332evb/ld.script create mode 100755 nuttx/configs/m68332evb/setenv.sh create mode 100644 nuttx/configs/m68332evb/src/Makefile create mode 100644 nuttx/configs/m68332evb/src/README.txt create mode 100755 nuttx/configs/mbed/README.txt create mode 100644 nuttx/configs/mbed/hidkbd/Make.defs create mode 100644 nuttx/configs/mbed/hidkbd/appconfig create mode 100644 nuttx/configs/mbed/hidkbd/defconfig create mode 100644 nuttx/configs/mbed/hidkbd/ld.script create mode 100644 nuttx/configs/mbed/hidkbd/setenv.sh create mode 100755 nuttx/configs/mbed/include/board.h create mode 100755 nuttx/configs/mbed/nsh/Make.defs create mode 100644 nuttx/configs/mbed/nsh/appconfig create mode 100755 nuttx/configs/mbed/nsh/defconfig create mode 100755 nuttx/configs/mbed/nsh/ld.script create mode 100755 nuttx/configs/mbed/nsh/setenv.sh create mode 100755 nuttx/configs/mbed/src/Makefile create mode 100755 nuttx/configs/mbed/src/mbed_internal.h create mode 100755 nuttx/configs/mbed/src/up_boot.c create mode 100755 nuttx/configs/mbed/src/up_leds.c create mode 100755 nuttx/configs/mbed/src/up_nsh.c create mode 100644 nuttx/configs/mcu123-lpc214x/README.txt create mode 100644 nuttx/configs/mcu123-lpc214x/include/README.txt create mode 100644 nuttx/configs/mcu123-lpc214x/include/board.h create mode 100644 nuttx/configs/mcu123-lpc214x/lpc21isp-1.60.diff create mode 100644 nuttx/configs/mcu123-lpc214x/nsh/Make.defs create mode 100644 nuttx/configs/mcu123-lpc214x/nsh/appconfig create mode 100644 nuttx/configs/mcu123-lpc214x/nsh/defconfig create mode 100644 nuttx/configs/mcu123-lpc214x/nsh/ld.script create mode 100755 nuttx/configs/mcu123-lpc214x/nsh/setenv.sh create mode 100644 nuttx/configs/mcu123-lpc214x/ostest/Make.defs create mode 100644 nuttx/configs/mcu123-lpc214x/ostest/appconfig create mode 100644 nuttx/configs/mcu123-lpc214x/ostest/defconfig create mode 100644 nuttx/configs/mcu123-lpc214x/ostest/ld.script create mode 100755 nuttx/configs/mcu123-lpc214x/ostest/setenv.sh create mode 100755 nuttx/configs/mcu123-lpc214x/scripts/lpc21isp.sh create mode 100644 nuttx/configs/mcu123-lpc214x/src/Makefile create mode 100644 nuttx/configs/mcu123-lpc214x/src/README.txt create mode 100644 nuttx/configs/mcu123-lpc214x/src/up_leds.c create mode 100644 nuttx/configs/mcu123-lpc214x/src/up_nsh.c create mode 100644 nuttx/configs/mcu123-lpc214x/src/up_spi.c create mode 100755 nuttx/configs/mcu123-lpc214x/src/up_usbstrg.c create mode 100644 nuttx/configs/mcu123-lpc214x/usbserial/Make.defs create mode 100644 nuttx/configs/mcu123-lpc214x/usbserial/appconfig create mode 100644 nuttx/configs/mcu123-lpc214x/usbserial/defconfig create mode 100644 nuttx/configs/mcu123-lpc214x/usbserial/ld.script create mode 100755 nuttx/configs/mcu123-lpc214x/usbserial/setenv.sh create mode 100644 nuttx/configs/mcu123-lpc214x/usbstorage/Make.defs create mode 100644 nuttx/configs/mcu123-lpc214x/usbstorage/appconfig create mode 100644 nuttx/configs/mcu123-lpc214x/usbstorage/defconfig create mode 100644 nuttx/configs/mcu123-lpc214x/usbstorage/ld.script create mode 100755 nuttx/configs/mcu123-lpc214x/usbstorage/setenv.sh create mode 100644 nuttx/configs/micropendous3/README.txt create mode 100644 nuttx/configs/micropendous3/hello/Make.defs create mode 100644 nuttx/configs/micropendous3/hello/appconfig create mode 100644 nuttx/configs/micropendous3/hello/defconfig create mode 100644 nuttx/configs/micropendous3/hello/ld.script create mode 100755 nuttx/configs/micropendous3/hello/setenv.sh create mode 100755 nuttx/configs/micropendous3/include/board.h create mode 100755 nuttx/configs/micropendous3/src/Makefile create mode 100755 nuttx/configs/micropendous3/src/micropendous3_internal.h create mode 100755 nuttx/configs/micropendous3/src/up_boot.c create mode 100644 nuttx/configs/mx1ads/README.txt create mode 100644 nuttx/configs/mx1ads/include/README.txt create mode 100644 nuttx/configs/mx1ads/include/board.h create mode 100644 nuttx/configs/mx1ads/ostest/Make.defs create mode 100644 nuttx/configs/mx1ads/ostest/appconfig create mode 100644 nuttx/configs/mx1ads/ostest/defconfig create mode 100644 nuttx/configs/mx1ads/ostest/ld.script create mode 100755 nuttx/configs/mx1ads/ostest/setenv.sh create mode 100644 nuttx/configs/mx1ads/src/Makefile create mode 100644 nuttx/configs/mx1ads/src/README.txt create mode 100755 nuttx/configs/mx1ads/src/up_boot.c create mode 100644 nuttx/configs/mx1ads/src/up_leds.c create mode 100644 nuttx/configs/mx1ads/src/up_network.c create mode 100755 nuttx/configs/ne64badge/README.txt create mode 100755 nuttx/configs/ne64badge/include/board.h create mode 100755 nuttx/configs/ne64badge/ostest/Make.defs create mode 100644 nuttx/configs/ne64badge/ostest/appconfig create mode 100755 nuttx/configs/ne64badge/ostest/defconfig create mode 100755 nuttx/configs/ne64badge/ostest/ld.script.banked create mode 100755 nuttx/configs/ne64badge/ostest/ld.script.nonbanked create mode 100755 nuttx/configs/ne64badge/ostest/setenv.sh create mode 100755 nuttx/configs/ne64badge/src/Makefile create mode 100755 nuttx/configs/ne64badge/src/ne64badge_internal.h create mode 100755 nuttx/configs/ne64badge/src/up_boot.c create mode 100755 nuttx/configs/ne64badge/src/up_buttons.c create mode 100755 nuttx/configs/ne64badge/src/up_leds.c create mode 100755 nuttx/configs/ne64badge/src/up_nsh.c create mode 100755 nuttx/configs/ne64badge/src/up_spi.c create mode 100644 nuttx/configs/ntosd-dm320/README.txt create mode 100644 nuttx/configs/ntosd-dm320/doc/README.txt create mode 100644 nuttx/configs/ntosd-dm320/doc/test-result.txt create mode 100644 nuttx/configs/ntosd-dm320/include/README.txt create mode 100644 nuttx/configs/ntosd-dm320/include/board.h create mode 100644 nuttx/configs/ntosd-dm320/nettest/Make.defs create mode 100644 nuttx/configs/ntosd-dm320/nettest/appconfig create mode 100644 nuttx/configs/ntosd-dm320/nettest/defconfig create mode 100644 nuttx/configs/ntosd-dm320/nettest/ld.script create mode 100755 nuttx/configs/ntosd-dm320/nettest/setenv.sh create mode 100644 nuttx/configs/ntosd-dm320/nsh/Make.defs create mode 100644 nuttx/configs/ntosd-dm320/nsh/appconfig create mode 100644 nuttx/configs/ntosd-dm320/nsh/defconfig create mode 100644 nuttx/configs/ntosd-dm320/nsh/ld.script create mode 100755 nuttx/configs/ntosd-dm320/nsh/setenv.sh create mode 100644 nuttx/configs/ntosd-dm320/ostest/Make.defs create mode 100644 nuttx/configs/ntosd-dm320/ostest/appconfig create mode 100644 nuttx/configs/ntosd-dm320/ostest/defconfig create mode 100644 nuttx/configs/ntosd-dm320/ostest/ld.script create mode 100755 nuttx/configs/ntosd-dm320/ostest/setenv.sh create mode 100644 nuttx/configs/ntosd-dm320/poll/Make.defs create mode 100644 nuttx/configs/ntosd-dm320/poll/appconfig create mode 100644 nuttx/configs/ntosd-dm320/poll/defconfig create mode 100644 nuttx/configs/ntosd-dm320/poll/ld.script create mode 100755 nuttx/configs/ntosd-dm320/poll/setenv.sh create mode 100644 nuttx/configs/ntosd-dm320/src/Makefile create mode 100644 nuttx/configs/ntosd-dm320/src/README.txt create mode 100644 nuttx/configs/ntosd-dm320/src/up_leds.c create mode 100644 nuttx/configs/ntosd-dm320/src/up_network.c create mode 100644 nuttx/configs/ntosd-dm320/thttpd/Make.defs create mode 100644 nuttx/configs/ntosd-dm320/thttpd/appconfig create mode 100644 nuttx/configs/ntosd-dm320/thttpd/defconfig create mode 100644 nuttx/configs/ntosd-dm320/thttpd/ld.script create mode 100755 nuttx/configs/ntosd-dm320/thttpd/setenv.sh create mode 100644 nuttx/configs/ntosd-dm320/udp/Make.defs create mode 100644 nuttx/configs/ntosd-dm320/udp/appconfig create mode 100644 nuttx/configs/ntosd-dm320/udp/defconfig create mode 100644 nuttx/configs/ntosd-dm320/udp/ld.script create mode 100755 nuttx/configs/ntosd-dm320/udp/setenv.sh create mode 100644 nuttx/configs/ntosd-dm320/uip/Make.defs create mode 100644 nuttx/configs/ntosd-dm320/uip/appconfig create mode 100644 nuttx/configs/ntosd-dm320/uip/defconfig create mode 100644 nuttx/configs/ntosd-dm320/uip/ld.script create mode 100755 nuttx/configs/ntosd-dm320/uip/setenv.sh create mode 100755 nuttx/configs/nucleus2g/README.txt create mode 100755 nuttx/configs/nucleus2g/include/board.h create mode 100755 nuttx/configs/nucleus2g/nsh/Make.defs create mode 100644 nuttx/configs/nucleus2g/nsh/appconfig create mode 100755 nuttx/configs/nucleus2g/nsh/defconfig create mode 100755 nuttx/configs/nucleus2g/nsh/ld.script create mode 100755 nuttx/configs/nucleus2g/nsh/setenv.sh create mode 100755 nuttx/configs/nucleus2g/ostest/Make.defs create mode 100644 nuttx/configs/nucleus2g/ostest/appconfig create mode 100755 nuttx/configs/nucleus2g/ostest/defconfig create mode 100755 nuttx/configs/nucleus2g/ostest/ld.script create mode 100755 nuttx/configs/nucleus2g/ostest/setenv.sh create mode 100755 nuttx/configs/nucleus2g/ostest/test-result.txt create mode 100755 nuttx/configs/nucleus2g/src/Makefile create mode 100755 nuttx/configs/nucleus2g/src/nucleus2g_internal.h create mode 100755 nuttx/configs/nucleus2g/src/up_boot.c create mode 100755 nuttx/configs/nucleus2g/src/up_leds.c create mode 100755 nuttx/configs/nucleus2g/src/up_nsh.c create mode 100755 nuttx/configs/nucleus2g/src/up_ssp.c create mode 100755 nuttx/configs/nucleus2g/src/up_usbstrg.c create mode 100755 nuttx/configs/nucleus2g/tools/olimex.cfg create mode 100755 nuttx/configs/nucleus2g/tools/oocd.sh create mode 100755 nuttx/configs/nucleus2g/tools/scarab.cfg create mode 100755 nuttx/configs/nucleus2g/usbserial/Make.defs create mode 100644 nuttx/configs/nucleus2g/usbserial/appconfig create mode 100755 nuttx/configs/nucleus2g/usbserial/defconfig create mode 100755 nuttx/configs/nucleus2g/usbserial/ld.script create mode 100755 nuttx/configs/nucleus2g/usbserial/setenv.sh create mode 100755 nuttx/configs/nucleus2g/usbstorage/Make.defs create mode 100644 nuttx/configs/nucleus2g/usbstorage/appconfig create mode 100755 nuttx/configs/nucleus2g/usbstorage/defconfig create mode 100755 nuttx/configs/nucleus2g/usbstorage/ld.script create mode 100755 nuttx/configs/nucleus2g/usbstorage/setenv.sh create mode 100755 nuttx/configs/olimex-lpc1766stk/README.txt create mode 100755 nuttx/configs/olimex-lpc1766stk/ftpc/Make.defs create mode 100644 nuttx/configs/olimex-lpc1766stk/ftpc/appconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/ftpc/defconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/ftpc/ld.script create mode 100755 nuttx/configs/olimex-lpc1766stk/ftpc/setenv.sh create mode 100755 nuttx/configs/olimex-lpc1766stk/hidkbd/Make.defs create mode 100644 nuttx/configs/olimex-lpc1766stk/hidkbd/appconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/hidkbd/ld.script create mode 100755 nuttx/configs/olimex-lpc1766stk/hidkbd/setenv.sh create mode 100755 nuttx/configs/olimex-lpc1766stk/include/board.h create mode 100755 nuttx/configs/olimex-lpc1766stk/nettest/Make.defs create mode 100644 nuttx/configs/olimex-lpc1766stk/nettest/appconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/nettest/defconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/nettest/ld.script create mode 100755 nuttx/configs/olimex-lpc1766stk/nettest/setenv.sh create mode 100755 nuttx/configs/olimex-lpc1766stk/nsh/Make.defs create mode 100644 nuttx/configs/olimex-lpc1766stk/nsh/appconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/nsh/defconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/nsh/ld.script create mode 100755 nuttx/configs/olimex-lpc1766stk/nsh/setenv.sh create mode 100755 nuttx/configs/olimex-lpc1766stk/nx/Make.defs create mode 100644 nuttx/configs/olimex-lpc1766stk/nx/appconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/nx/defconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/nx/ld.script create mode 100755 nuttx/configs/olimex-lpc1766stk/nx/setenv.sh create mode 100755 nuttx/configs/olimex-lpc1766stk/ostest/Make.defs create mode 100644 nuttx/configs/olimex-lpc1766stk/ostest/appconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/ostest/defconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/ostest/ld.script create mode 100755 nuttx/configs/olimex-lpc1766stk/ostest/setenv.sh create mode 100755 nuttx/configs/olimex-lpc1766stk/slip-httpd/Make.defs create mode 100644 nuttx/configs/olimex-lpc1766stk/slip-httpd/appconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/slip-httpd/defconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/slip-httpd/ld.script create mode 100755 nuttx/configs/olimex-lpc1766stk/slip-httpd/setenv.sh create mode 100755 nuttx/configs/olimex-lpc1766stk/src/Makefile create mode 100755 nuttx/configs/olimex-lpc1766stk/src/lpc1766stk_internal.h create mode 100755 nuttx/configs/olimex-lpc1766stk/src/up_boot.c create mode 100755 nuttx/configs/olimex-lpc1766stk/src/up_lcd.c create mode 100755 nuttx/configs/olimex-lpc1766stk/src/up_leds.c create mode 100755 nuttx/configs/olimex-lpc1766stk/src/up_nsh.c create mode 100755 nuttx/configs/olimex-lpc1766stk/src/up_ssp.c create mode 100755 nuttx/configs/olimex-lpc1766stk/src/up_usbstrg.c create mode 100755 nuttx/configs/olimex-lpc1766stk/thttpd/Make.defs create mode 100644 nuttx/configs/olimex-lpc1766stk/thttpd/appconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/thttpd/defconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/thttpd/ld.script create mode 100755 nuttx/configs/olimex-lpc1766stk/thttpd/setenv.sh create mode 100755 nuttx/configs/olimex-lpc1766stk/tools/olimex.cfg create mode 100755 nuttx/configs/olimex-lpc1766stk/tools/oocd.sh create mode 100755 nuttx/configs/olimex-lpc1766stk/usbserial/Make.defs create mode 100644 nuttx/configs/olimex-lpc1766stk/usbserial/appconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/usbserial/defconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/usbserial/ld.script create mode 100755 nuttx/configs/olimex-lpc1766stk/usbserial/setenv.sh create mode 100755 nuttx/configs/olimex-lpc1766stk/usbstorage/Make.defs create mode 100644 nuttx/configs/olimex-lpc1766stk/usbstorage/appconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/usbstorage/defconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/usbstorage/ld.script create mode 100755 nuttx/configs/olimex-lpc1766stk/usbstorage/setenv.sh create mode 100755 nuttx/configs/olimex-lpc1766stk/wlan/Make.defs create mode 100644 nuttx/configs/olimex-lpc1766stk/wlan/appconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/wlan/defconfig create mode 100755 nuttx/configs/olimex-lpc1766stk/wlan/ld.script create mode 100755 nuttx/configs/olimex-lpc1766stk/wlan/setenv.sh create mode 100644 nuttx/configs/olimex-lpc2378/README.txt create mode 100644 nuttx/configs/olimex-lpc2378/include/README.txt create mode 100755 nuttx/configs/olimex-lpc2378/include/board.h create mode 100755 nuttx/configs/olimex-lpc2378/nsh/Make.defs create mode 100644 nuttx/configs/olimex-lpc2378/nsh/appconfig create mode 100755 nuttx/configs/olimex-lpc2378/nsh/defconfig create mode 100755 nuttx/configs/olimex-lpc2378/nsh/ld.script create mode 100755 nuttx/configs/olimex-lpc2378/nsh/setenv.sh create mode 100755 nuttx/configs/olimex-lpc2378/ostest/Make.defs create mode 100644 nuttx/configs/olimex-lpc2378/ostest/appconfig create mode 100755 nuttx/configs/olimex-lpc2378/ostest/defconfig create mode 100755 nuttx/configs/olimex-lpc2378/ostest/ld.script create mode 100755 nuttx/configs/olimex-lpc2378/ostest/setenv.sh create mode 100755 nuttx/configs/olimex-lpc2378/src/Makefile create mode 100755 nuttx/configs/olimex-lpc2378/src/up_leds.c create mode 100755 nuttx/configs/olimex-lpc2378/src/up_nsh.c create mode 100644 nuttx/configs/olimex-strp711/README.txt create mode 100644 nuttx/configs/olimex-strp711/include/README.txt create mode 100644 nuttx/configs/olimex-strp711/include/board.h create mode 100755 nuttx/configs/olimex-strp711/nettest/Make.defs create mode 100644 nuttx/configs/olimex-strp711/nettest/appconfig create mode 100755 nuttx/configs/olimex-strp711/nettest/defconfig create mode 100755 nuttx/configs/olimex-strp711/nettest/ld.script create mode 100755 nuttx/configs/olimex-strp711/nettest/setenv.sh create mode 100644 nuttx/configs/olimex-strp711/nsh/Make.defs create mode 100644 nuttx/configs/olimex-strp711/nsh/appconfig create mode 100644 nuttx/configs/olimex-strp711/nsh/defconfig create mode 100644 nuttx/configs/olimex-strp711/nsh/ld.script create mode 100755 nuttx/configs/olimex-strp711/nsh/setenv.sh create mode 100644 nuttx/configs/olimex-strp711/ostest/Make.defs create mode 100644 nuttx/configs/olimex-strp711/ostest/appconfig create mode 100644 nuttx/configs/olimex-strp711/ostest/defconfig create mode 100644 nuttx/configs/olimex-strp711/ostest/ld.script create mode 100755 nuttx/configs/olimex-strp711/ostest/setenv.sh create mode 100644 nuttx/configs/olimex-strp711/ostest/test-results.txt create mode 100644 nuttx/configs/olimex-strp711/scripts/oocd-reset create mode 100755 nuttx/configs/olimex-strp711/scripts/oocd.sh create mode 100644 nuttx/configs/olimex-strp711/scripts/oocd_flash.script create mode 100755 nuttx/configs/olimex-strp711/scripts/oocd_ft2xx.cfg create mode 100644 nuttx/configs/olimex-strp711/scripts/oocd_wiggler.cfg create mode 100644 nuttx/configs/olimex-strp711/src/Makefile create mode 100644 nuttx/configs/olimex-strp711/src/README.txt create mode 100644 nuttx/configs/olimex-strp711/src/up_buttons.c create mode 100755 nuttx/configs/olimex-strp711/src/up_enc28j60.c create mode 100644 nuttx/configs/olimex-strp711/src/up_leds.c create mode 100644 nuttx/configs/olimex-strp711/src/up_nsh.c create mode 100644 nuttx/configs/olimex-strp711/src/up_spi.c create mode 100644 nuttx/configs/pcblogic-pic32mx/README.txt create mode 100644 nuttx/configs/pcblogic-pic32mx/include/board.h create mode 100644 nuttx/configs/pcblogic-pic32mx/ostest/Make.defs create mode 100644 nuttx/configs/pcblogic-pic32mx/ostest/appconfig create mode 100644 nuttx/configs/pcblogic-pic32mx/ostest/defconfig create mode 100644 nuttx/configs/pcblogic-pic32mx/ostest/ld.script create mode 100755 nuttx/configs/pcblogic-pic32mx/ostest/setenv.sh create mode 100644 nuttx/configs/pcblogic-pic32mx/src/Makefile create mode 100644 nuttx/configs/pcblogic-pic32mx/src/pcblogic-internal.h create mode 100644 nuttx/configs/pcblogic-pic32mx/src/up_boot.c create mode 100644 nuttx/configs/pcblogic-pic32mx/tools/Makefile create mode 100644 nuttx/configs/pcblogic-pic32mx/tools/mkpichex.c create mode 100644 nuttx/configs/pic32-starterkit/README.txt create mode 100644 nuttx/configs/pic32-starterkit/include/board.h create mode 100644 nuttx/configs/pic32-starterkit/ostest/Make.defs create mode 100644 nuttx/configs/pic32-starterkit/ostest/appconfig create mode 100644 nuttx/configs/pic32-starterkit/ostest/defconfig create mode 100644 nuttx/configs/pic32-starterkit/ostest/ld.script create mode 100755 nuttx/configs/pic32-starterkit/ostest/setenv.sh create mode 100644 nuttx/configs/pic32-starterkit/src/Makefile create mode 100644 nuttx/configs/pic32-starterkit/src/starterkit_internal.h create mode 100644 nuttx/configs/pic32-starterkit/src/up_boot.c create mode 100644 nuttx/configs/pic32-starterkit/src/up_leds.c create mode 100644 nuttx/configs/pic32-starterkit/src/up_nsh.c create mode 100644 nuttx/configs/pic32-starterkit/src/up_spi.c create mode 100644 nuttx/configs/pic32-starterkit/tools/Makefile create mode 100644 nuttx/configs/pic32-starterkit/tools/mkpichex.c create mode 100644 nuttx/configs/pjrc-8051/Make.defs create mode 100644 nuttx/configs/pjrc-8051/README.txt create mode 100644 nuttx/configs/pjrc-8051/appconfig create mode 100644 nuttx/configs/pjrc-8051/defconfig create mode 100644 nuttx/configs/pjrc-8051/include/README.txt create mode 100644 nuttx/configs/pjrc-8051/include/board.h create mode 100644 nuttx/configs/pjrc-8051/include/pjrc.h create mode 100644 nuttx/configs/pjrc-8051/sdcc-2.6.0.patch create mode 100755 nuttx/configs/pjrc-8051/setenv.sh create mode 100644 nuttx/configs/pjrc-8051/src/Makefile create mode 100644 nuttx/configs/pjrc-8051/src/README.txt create mode 100644 nuttx/configs/pjrc-8051/src/up_leds.c create mode 100644 nuttx/configs/qemu-i486/README.txt create mode 100644 nuttx/configs/qemu-i486/include/README.txt create mode 100755 nuttx/configs/qemu-i486/include/board.h create mode 100644 nuttx/configs/qemu-i486/nsh/Make.defs create mode 100644 nuttx/configs/qemu-i486/nsh/appconfig create mode 100644 nuttx/configs/qemu-i486/nsh/defconfig create mode 100755 nuttx/configs/qemu-i486/nsh/ld.script create mode 100755 nuttx/configs/qemu-i486/nsh/setenv.sh create mode 100644 nuttx/configs/qemu-i486/ostest/Make.defs create mode 100644 nuttx/configs/qemu-i486/ostest/appconfig create mode 100644 nuttx/configs/qemu-i486/ostest/defconfig create mode 100755 nuttx/configs/qemu-i486/ostest/ld.script create mode 100755 nuttx/configs/qemu-i486/ostest/setenv.sh create mode 100644 nuttx/configs/qemu-i486/src/Makefile create mode 100644 nuttx/configs/qemu-i486/src/README.txt create mode 100755 nuttx/configs/qemu-i486/src/qemui486_internal.h create mode 100755 nuttx/configs/qemu-i486/src/up_boot.c create mode 100755 nuttx/configs/rgmp/README.txt create mode 100644 nuttx/configs/rgmp/arm/default/Make.defs create mode 100644 nuttx/configs/rgmp/arm/default/appconfig create mode 100644 nuttx/configs/rgmp/arm/default/defconfig create mode 100644 nuttx/configs/rgmp/arm/default/setenv.sh create mode 100644 nuttx/configs/rgmp/arm/nsh/Make.defs create mode 100644 nuttx/configs/rgmp/arm/nsh/appconfig create mode 100644 nuttx/configs/rgmp/arm/nsh/defconfig create mode 100644 nuttx/configs/rgmp/arm/nsh/setenv.sh create mode 100755 nuttx/configs/rgmp/include/README.txt create mode 100755 nuttx/configs/rgmp/include/stdarg.h create mode 100755 nuttx/configs/rgmp/src/README.txt create mode 100644 nuttx/configs/rgmp/x86/default/Make.defs create mode 100644 nuttx/configs/rgmp/x86/default/appconfig create mode 100644 nuttx/configs/rgmp/x86/default/defconfig create mode 100644 nuttx/configs/rgmp/x86/default/setenv.sh create mode 100644 nuttx/configs/rgmp/x86/nsh/Make.defs create mode 100644 nuttx/configs/rgmp/x86/nsh/appconfig create mode 100644 nuttx/configs/rgmp/x86/nsh/defconfig create mode 100644 nuttx/configs/rgmp/x86/nsh/setenv.sh create mode 100755 nuttx/configs/sam3u-ek/README.txt create mode 100755 nuttx/configs/sam3u-ek/include/board.h create mode 100755 nuttx/configs/sam3u-ek/kernel/Makefile create mode 100644 nuttx/configs/sam3u-ek/kernel/kernel.ld create mode 100755 nuttx/configs/sam3u-ek/knsh/Make.defs create mode 100644 nuttx/configs/sam3u-ek/knsh/appconfig create mode 100755 nuttx/configs/sam3u-ek/knsh/defconfig create mode 100755 nuttx/configs/sam3u-ek/knsh/ld.script create mode 100755 nuttx/configs/sam3u-ek/knsh/setenv.sh create mode 100755 nuttx/configs/sam3u-ek/nsh/Make.defs create mode 100644 nuttx/configs/sam3u-ek/nsh/appconfig create mode 100755 nuttx/configs/sam3u-ek/nsh/defconfig create mode 100755 nuttx/configs/sam3u-ek/nsh/ld.script create mode 100755 nuttx/configs/sam3u-ek/nsh/setenv.sh create mode 100755 nuttx/configs/sam3u-ek/nx/Make.defs create mode 100644 nuttx/configs/sam3u-ek/nx/appconfig create mode 100755 nuttx/configs/sam3u-ek/nx/defconfig create mode 100755 nuttx/configs/sam3u-ek/nx/ld.script create mode 100755 nuttx/configs/sam3u-ek/nx/setenv.sh create mode 100755 nuttx/configs/sam3u-ek/ostest/Make.defs create mode 100644 nuttx/configs/sam3u-ek/ostest/appconfig create mode 100755 nuttx/configs/sam3u-ek/ostest/defconfig create mode 100755 nuttx/configs/sam3u-ek/ostest/ld.script create mode 100755 nuttx/configs/sam3u-ek/ostest/setenv.sh create mode 100644 nuttx/configs/sam3u-ek/src/Makefile create mode 100644 nuttx/configs/sam3u-ek/src/sam3uek_internal.h create mode 100644 nuttx/configs/sam3u-ek/src/up_boot.c create mode 100644 nuttx/configs/sam3u-ek/src/up_buttons.c create mode 100644 nuttx/configs/sam3u-ek/src/up_lcd.c create mode 100644 nuttx/configs/sam3u-ek/src/up_leds.c create mode 100644 nuttx/configs/sam3u-ek/src/up_mmcsd.c create mode 100644 nuttx/configs/sam3u-ek/src/up_nsh.c create mode 100644 nuttx/configs/sam3u-ek/src/up_spi.c create mode 100755 nuttx/configs/sam3u-ek/src/up_touchscreen.c create mode 100644 nuttx/configs/sam3u-ek/src/up_usbdev.c create mode 100644 nuttx/configs/sam3u-ek/src/up_usbstrg.c create mode 100755 nuttx/configs/sam3u-ek/touchscreen/Make.defs create mode 100644 nuttx/configs/sam3u-ek/touchscreen/appconfig create mode 100755 nuttx/configs/sam3u-ek/touchscreen/defconfig create mode 100755 nuttx/configs/sam3u-ek/touchscreen/ld.script create mode 100755 nuttx/configs/sam3u-ek/touchscreen/setenv.sh create mode 100644 nuttx/configs/sim/README.txt create mode 100644 nuttx/configs/sim/doc/test-results.txt create mode 100644 nuttx/configs/sim/include/README.txt create mode 100644 nuttx/configs/sim/mount/Make.defs create mode 100644 nuttx/configs/sim/mount/appconfig create mode 100644 nuttx/configs/sim/mount/defconfig create mode 100755 nuttx/configs/sim/mount/setenv.sh create mode 100644 nuttx/configs/sim/nettest/Make.defs create mode 100644 nuttx/configs/sim/nettest/appconfig create mode 100644 nuttx/configs/sim/nettest/defconfig create mode 100755 nuttx/configs/sim/nettest/setenv.sh create mode 100644 nuttx/configs/sim/nsh/Make.defs create mode 100644 nuttx/configs/sim/nsh/appconfig create mode 100644 nuttx/configs/sim/nsh/defconfig create mode 100755 nuttx/configs/sim/nsh/setenv.sh create mode 100644 nuttx/configs/sim/nsh2/Make.defs create mode 100644 nuttx/configs/sim/nsh2/appconfig create mode 100644 nuttx/configs/sim/nsh2/defconfig create mode 100755 nuttx/configs/sim/nsh2/setenv.sh create mode 100644 nuttx/configs/sim/nx/Make.defs create mode 100644 nuttx/configs/sim/nx/appconfig create mode 100644 nuttx/configs/sim/nx/defconfig create mode 100755 nuttx/configs/sim/nx/setenv.sh create mode 100644 nuttx/configs/sim/nx11/Make.defs create mode 100644 nuttx/configs/sim/nx11/appconfig create mode 100644 nuttx/configs/sim/nx11/defconfig create mode 100755 nuttx/configs/sim/nx11/setenv.sh create mode 100644 nuttx/configs/sim/nxffs/Make.defs create mode 100644 nuttx/configs/sim/nxffs/appconfig create mode 100644 nuttx/configs/sim/nxffs/defconfig create mode 100755 nuttx/configs/sim/nxffs/setenv.sh create mode 100644 nuttx/configs/sim/ostest/Make.defs create mode 100644 nuttx/configs/sim/ostest/appconfig create mode 100644 nuttx/configs/sim/ostest/defconfig create mode 100755 nuttx/configs/sim/ostest/setenv.sh create mode 100644 nuttx/configs/sim/pashello/Make.defs create mode 100644 nuttx/configs/sim/pashello/appconfig create mode 100644 nuttx/configs/sim/pashello/defconfig create mode 100755 nuttx/configs/sim/pashello/setenv.sh create mode 100644 nuttx/configs/sim/src/Makefile create mode 100644 nuttx/configs/sim/src/README.txt create mode 100644 nuttx/configs/sim/src/up_touchscreen.c create mode 100644 nuttx/configs/sim/touchscreen/Make.defs create mode 100644 nuttx/configs/sim/touchscreen/appconfig create mode 100644 nuttx/configs/sim/touchscreen/defconfig create mode 100755 nuttx/configs/sim/touchscreen/setenv.sh create mode 100755 nuttx/configs/skp16c26/README.txt create mode 100644 nuttx/configs/skp16c26/include/README.txt create mode 100644 nuttx/configs/skp16c26/include/board.h create mode 100644 nuttx/configs/skp16c26/ostest/Make.defs create mode 100644 nuttx/configs/skp16c26/ostest/appconfig create mode 100644 nuttx/configs/skp16c26/ostest/defconfig create mode 100644 nuttx/configs/skp16c26/ostest/ld.script create mode 100755 nuttx/configs/skp16c26/ostest/setenv.sh create mode 100644 nuttx/configs/skp16c26/src/Makefile create mode 100644 nuttx/configs/skp16c26/src/README.txt create mode 100644 nuttx/configs/skp16c26/src/skp16c26_internal.h create mode 100644 nuttx/configs/skp16c26/src/up_buttons.c create mode 100644 nuttx/configs/skp16c26/src/up_lcd.c create mode 100644 nuttx/configs/skp16c26/src/up_lcdconsole.c create mode 100644 nuttx/configs/skp16c26/src/up_leds.c create mode 100755 nuttx/configs/stm3210e-eval/README.txt create mode 100644 nuttx/configs/stm3210e-eval/RIDE/Make.defs create mode 100755 nuttx/configs/stm3210e-eval/RIDE/README.txt create mode 100644 nuttx/configs/stm3210e-eval/RIDE/appconfig create mode 100755 nuttx/configs/stm3210e-eval/RIDE/bigfatstub.c create mode 100755 nuttx/configs/stm3210e-eval/RIDE/defconfig create mode 100755 nuttx/configs/stm3210e-eval/RIDE/nuttx.ctx create mode 100755 nuttx/configs/stm3210e-eval/RIDE/nuttx.dbi create mode 100755 nuttx/configs/stm3210e-eval/RIDE/nuttx.elf.ld create mode 100755 nuttx/configs/stm3210e-eval/RIDE/nuttx.rapp create mode 100755 nuttx/configs/stm3210e-eval/RIDE/nuttx.rdb create mode 100755 nuttx/configs/stm3210e-eval/RIDE/nuttx.rprj create mode 100755 nuttx/configs/stm3210e-eval/RIDE/setenv.sh create mode 100755 nuttx/configs/stm3210e-eval/RIDE/stm32-ld.sh create mode 100755 nuttx/configs/stm3210e-eval/RIDE/stm32-nuttx.ld create mode 100644 nuttx/configs/stm3210e-eval/buttons/Make.defs create mode 100644 nuttx/configs/stm3210e-eval/buttons/appconfig create mode 100644 nuttx/configs/stm3210e-eval/buttons/defconfig create mode 100644 nuttx/configs/stm3210e-eval/buttons/ld.script create mode 100644 nuttx/configs/stm3210e-eval/buttons/ld.script.dfu create mode 100755 nuttx/configs/stm3210e-eval/buttons/setenv.sh create mode 100755 nuttx/configs/stm3210e-eval/include/README.txt create mode 100755 nuttx/configs/stm3210e-eval/include/board.h create mode 100644 nuttx/configs/stm3210e-eval/nsh/Make.defs create mode 100644 nuttx/configs/stm3210e-eval/nsh/appconfig create mode 100755 nuttx/configs/stm3210e-eval/nsh/defconfig create mode 100755 nuttx/configs/stm3210e-eval/nsh/ld.script create mode 100755 nuttx/configs/stm3210e-eval/nsh/ld.script.dfu create mode 100755 nuttx/configs/stm3210e-eval/nsh/setenv.sh create mode 100644 nuttx/configs/stm3210e-eval/nsh2/Make.defs create mode 100644 nuttx/configs/stm3210e-eval/nsh2/appconfig create mode 100644 nuttx/configs/stm3210e-eval/nsh2/defconfig create mode 100644 nuttx/configs/stm3210e-eval/nsh2/ld.script create mode 100644 nuttx/configs/stm3210e-eval/nsh2/ld.script.dfu create mode 100755 nuttx/configs/stm3210e-eval/nsh2/setenv.sh create mode 100644 nuttx/configs/stm3210e-eval/nx/Make.defs create mode 100644 nuttx/configs/stm3210e-eval/nx/appconfig create mode 100644 nuttx/configs/stm3210e-eval/nx/defconfig create mode 100644 nuttx/configs/stm3210e-eval/nx/ld.script create mode 100644 nuttx/configs/stm3210e-eval/nx/ld.script.dfu create mode 100755 nuttx/configs/stm3210e-eval/nx/setenv.sh create mode 100644 nuttx/configs/stm3210e-eval/nxlines/Make.defs create mode 100644 nuttx/configs/stm3210e-eval/nxlines/appconfig create mode 100644 nuttx/configs/stm3210e-eval/nxlines/defconfig create mode 100644 nuttx/configs/stm3210e-eval/nxlines/ld.script create mode 100644 nuttx/configs/stm3210e-eval/nxlines/ld.script.dfu create mode 100755 nuttx/configs/stm3210e-eval/nxlines/setenv.sh create mode 100644 nuttx/configs/stm3210e-eval/nxtext/Make.defs create mode 100644 nuttx/configs/stm3210e-eval/nxtext/appconfig create mode 100644 nuttx/configs/stm3210e-eval/nxtext/defconfig create mode 100644 nuttx/configs/stm3210e-eval/nxtext/ld.script create mode 100644 nuttx/configs/stm3210e-eval/nxtext/ld.script.dfu create mode 100755 nuttx/configs/stm3210e-eval/nxtext/setenv.sh create mode 100644 nuttx/configs/stm3210e-eval/ostest/Make.defs create mode 100644 nuttx/configs/stm3210e-eval/ostest/appconfig create mode 100755 nuttx/configs/stm3210e-eval/ostest/defconfig create mode 100755 nuttx/configs/stm3210e-eval/ostest/ld.script create mode 100755 nuttx/configs/stm3210e-eval/ostest/ld.script.dfu create mode 100755 nuttx/configs/stm3210e-eval/ostest/setenv.sh create mode 100644 nuttx/configs/stm3210e-eval/src/Makefile create mode 100644 nuttx/configs/stm3210e-eval/src/README.txt create mode 100644 nuttx/configs/stm3210e-eval/src/stm3210e-internal.h create mode 100644 nuttx/configs/stm3210e-eval/src/up_adc.c create mode 100644 nuttx/configs/stm3210e-eval/src/up_boot.c create mode 100644 nuttx/configs/stm3210e-eval/src/up_buttons.c create mode 100644 nuttx/configs/stm3210e-eval/src/up_deselectlcd.c create mode 100644 nuttx/configs/stm3210e-eval/src/up_deselectnor.c create mode 100644 nuttx/configs/stm3210e-eval/src/up_deselectsram.c create mode 100644 nuttx/configs/stm3210e-eval/src/up_extcontext.c create mode 100644 nuttx/configs/stm3210e-eval/src/up_extmem.c create mode 100644 nuttx/configs/stm3210e-eval/src/up_lcd.c create mode 100644 nuttx/configs/stm3210e-eval/src/up_leds.c create mode 100644 nuttx/configs/stm3210e-eval/src/up_lm75.c create mode 100644 nuttx/configs/stm3210e-eval/src/up_nsh.c create mode 100644 nuttx/configs/stm3210e-eval/src/up_selectlcd.c create mode 100644 nuttx/configs/stm3210e-eval/src/up_selectnor.c create mode 100644 nuttx/configs/stm3210e-eval/src/up_selectsram.c create mode 100644 nuttx/configs/stm3210e-eval/src/up_spi.c create mode 100644 nuttx/configs/stm3210e-eval/src/up_usbdev.c create mode 100644 nuttx/configs/stm3210e-eval/src/up_usbstrg.c create mode 100644 nuttx/configs/stm3210e-eval/tools/olimex-arm-usb-ocd.cfg create mode 100755 nuttx/configs/stm3210e-eval/tools/oocd.sh create mode 100644 nuttx/configs/stm3210e-eval/tools/stm32.cfg create mode 100644 nuttx/configs/stm3210e-eval/usbserial/Make.defs create mode 100644 nuttx/configs/stm3210e-eval/usbserial/appconfig create mode 100755 nuttx/configs/stm3210e-eval/usbserial/defconfig create mode 100755 nuttx/configs/stm3210e-eval/usbserial/ld.script create mode 100755 nuttx/configs/stm3210e-eval/usbserial/ld.script.dfu create mode 100755 nuttx/configs/stm3210e-eval/usbserial/setenv.sh create mode 100755 nuttx/configs/stm3210e-eval/usbstorage/Make.defs create mode 100644 nuttx/configs/stm3210e-eval/usbstorage/appconfig create mode 100755 nuttx/configs/stm3210e-eval/usbstorage/defconfig create mode 100755 nuttx/configs/stm3210e-eval/usbstorage/ld.script create mode 100755 nuttx/configs/stm3210e-eval/usbstorage/ld.script.dfu create mode 100755 nuttx/configs/stm3210e-eval/usbstorage/setenv.sh create mode 100755 nuttx/configs/stm3240g-eval/README.txt create mode 100644 nuttx/configs/stm3240g-eval/dhcpd/Make.defs create mode 100644 nuttx/configs/stm3240g-eval/dhcpd/appconfig create mode 100755 nuttx/configs/stm3240g-eval/dhcpd/defconfig create mode 100755 nuttx/configs/stm3240g-eval/dhcpd/ld.script create mode 100755 nuttx/configs/stm3240g-eval/dhcpd/setenv.sh create mode 100755 nuttx/configs/stm3240g-eval/include/board.h create mode 100644 nuttx/configs/stm3240g-eval/nettest/Make.defs create mode 100644 nuttx/configs/stm3240g-eval/nettest/appconfig create mode 100755 nuttx/configs/stm3240g-eval/nettest/defconfig create mode 100755 nuttx/configs/stm3240g-eval/nettest/ld.script create mode 100755 nuttx/configs/stm3240g-eval/nettest/setenv.sh create mode 100644 nuttx/configs/stm3240g-eval/nsh/Make.defs create mode 100644 nuttx/configs/stm3240g-eval/nsh/appconfig create mode 100755 nuttx/configs/stm3240g-eval/nsh/defconfig create mode 100755 nuttx/configs/stm3240g-eval/nsh/ld.script create mode 100755 nuttx/configs/stm3240g-eval/nsh/setenv.sh create mode 100644 nuttx/configs/stm3240g-eval/ostest/Make.defs create mode 100644 nuttx/configs/stm3240g-eval/ostest/appconfig create mode 100755 nuttx/configs/stm3240g-eval/ostest/defconfig create mode 100755 nuttx/configs/stm3240g-eval/ostest/ld.script create mode 100755 nuttx/configs/stm3240g-eval/ostest/setenv.sh create mode 100644 nuttx/configs/stm3240g-eval/src/Makefile create mode 100644 nuttx/configs/stm3240g-eval/src/stm3240g-internal.h create mode 100644 nuttx/configs/stm3240g-eval/src/up_adc.c create mode 100644 nuttx/configs/stm3240g-eval/src/up_boot.c create mode 100644 nuttx/configs/stm3240g-eval/src/up_buttons.c create mode 100644 nuttx/configs/stm3240g-eval/src/up_leds.c create mode 100644 nuttx/configs/stm3240g-eval/src/up_spi.c create mode 100644 nuttx/configs/sure-pic32mx/README.txt create mode 100644 nuttx/configs/sure-pic32mx/include/board.h create mode 100644 nuttx/configs/sure-pic32mx/ostest/Make.defs create mode 100644 nuttx/configs/sure-pic32mx/ostest/appconfig create mode 100644 nuttx/configs/sure-pic32mx/ostest/defconfig create mode 100644 nuttx/configs/sure-pic32mx/ostest/ld.script create mode 100755 nuttx/configs/sure-pic32mx/ostest/setenv.sh create mode 100644 nuttx/configs/sure-pic32mx/src/Makefile create mode 100644 nuttx/configs/sure-pic32mx/src/sure-internal.h create mode 100644 nuttx/configs/sure-pic32mx/src/up_boot.c create mode 100644 nuttx/configs/sure-pic32mx/src/up_buttons.c create mode 100644 nuttx/configs/sure-pic32mx/src/up_leds.c create mode 100644 nuttx/configs/sure-pic32mx/src/up_nsh.c create mode 100644 nuttx/configs/sure-pic32mx/src/up_spi.c create mode 100644 nuttx/configs/sure-pic32mx/tools/Makefile create mode 100644 nuttx/configs/sure-pic32mx/tools/mkpichex.c create mode 100644 nuttx/configs/teensy/README.txt create mode 100644 nuttx/configs/teensy/hello/Make.defs create mode 100644 nuttx/configs/teensy/hello/appconfig create mode 100644 nuttx/configs/teensy/hello/defconfig create mode 100644 nuttx/configs/teensy/hello/ld.script create mode 100755 nuttx/configs/teensy/hello/setenv.sh create mode 100755 nuttx/configs/teensy/include/board.h create mode 100755 nuttx/configs/teensy/nsh/Make.defs create mode 100644 nuttx/configs/teensy/nsh/appconfig create mode 100755 nuttx/configs/teensy/nsh/defconfig create mode 100755 nuttx/configs/teensy/nsh/ld.script create mode 100755 nuttx/configs/teensy/nsh/setenv.sh create mode 100755 nuttx/configs/teensy/src/Makefile create mode 100755 nuttx/configs/teensy/src/teensy_internal.h create mode 100755 nuttx/configs/teensy/src/up_boot.c create mode 100755 nuttx/configs/teensy/src/up_leds.c create mode 100755 nuttx/configs/teensy/src/up_spi.c create mode 100755 nuttx/configs/teensy/src/up_usbstrg.c create mode 100755 nuttx/configs/teensy/usbstorage/Make.defs create mode 100644 nuttx/configs/teensy/usbstorage/appconfig create mode 100755 nuttx/configs/teensy/usbstorage/defconfig create mode 100755 nuttx/configs/teensy/usbstorage/ld.script create mode 100755 nuttx/configs/teensy/usbstorage/setenv.sh create mode 100644 nuttx/configs/twr-k60n512/README.txt create mode 100755 nuttx/configs/twr-k60n512/include/board.h create mode 100644 nuttx/configs/twr-k60n512/nsh/Make.defs create mode 100644 nuttx/configs/twr-k60n512/nsh/appconfig create mode 100644 nuttx/configs/twr-k60n512/nsh/defconfig create mode 100644 nuttx/configs/twr-k60n512/nsh/ld.script create mode 100644 nuttx/configs/twr-k60n512/nsh/setenv.sh create mode 100644 nuttx/configs/twr-k60n512/ostest/Make.defs create mode 100644 nuttx/configs/twr-k60n512/ostest/appconfig create mode 100644 nuttx/configs/twr-k60n512/ostest/defconfig create mode 100644 nuttx/configs/twr-k60n512/ostest/ld.script create mode 100644 nuttx/configs/twr-k60n512/ostest/setenv.sh create mode 100644 nuttx/configs/twr-k60n512/src/Makefile create mode 100644 nuttx/configs/twr-k60n512/src/twrk60-internal.h create mode 100644 nuttx/configs/twr-k60n512/src/up_boot.c create mode 100644 nuttx/configs/twr-k60n512/src/up_buttons.c create mode 100644 nuttx/configs/twr-k60n512/src/up_leds.c create mode 100644 nuttx/configs/twr-k60n512/src/up_nsh.c create mode 100644 nuttx/configs/twr-k60n512/src/up_spi.c create mode 100644 nuttx/configs/twr-k60n512/src/up_usbdev.c create mode 100644 nuttx/configs/twr-k60n512/src/up_usbstrg.c create mode 100644 nuttx/configs/us7032evb1/README.txt create mode 100644 nuttx/configs/us7032evb1/bin/README.txt create mode 100644 nuttx/configs/us7032evb1/include/README.txt create mode 100644 nuttx/configs/us7032evb1/include/board.h create mode 100644 nuttx/configs/us7032evb1/nsh/Make.defs create mode 100644 nuttx/configs/us7032evb1/nsh/appconfig create mode 100644 nuttx/configs/us7032evb1/nsh/defconfig create mode 100644 nuttx/configs/us7032evb1/nsh/ld.script create mode 100755 nuttx/configs/us7032evb1/nsh/setenv.sh create mode 100644 nuttx/configs/us7032evb1/ostest/Make.defs create mode 100644 nuttx/configs/us7032evb1/ostest/appconfig create mode 100644 nuttx/configs/us7032evb1/ostest/defconfig create mode 100644 nuttx/configs/us7032evb1/ostest/ld.script create mode 100755 nuttx/configs/us7032evb1/ostest/setenv.sh create mode 100644 nuttx/configs/us7032evb1/shterm/Makefile create mode 100644 nuttx/configs/us7032evb1/shterm/shterm.c create mode 100644 nuttx/configs/us7032evb1/src/Makefile create mode 100644 nuttx/configs/us7032evb1/src/README.txt create mode 100644 nuttx/configs/us7032evb1/src/up_leds.c create mode 100644 nuttx/configs/vsn/README.txt create mode 100644 nuttx/configs/vsn/include/board.h create mode 100644 nuttx/configs/vsn/include/muxbus.h create mode 100755 nuttx/configs/vsn/include/nsh_romfsimg.h create mode 100644 nuttx/configs/vsn/include/power.h create mode 100755 nuttx/configs/vsn/include/rcS.template create mode 100644 nuttx/configs/vsn/nsh/Make.defs create mode 100755 nuttx/configs/vsn/nsh/appconfig create mode 100755 nuttx/configs/vsn/nsh/defconfig create mode 100755 nuttx/configs/vsn/nsh/ld.script create mode 100755 nuttx/configs/vsn/nsh/ld.script.dfu create mode 100755 nuttx/configs/vsn/nsh/setenv.sh create mode 100644 nuttx/configs/vsn/src/Makefile create mode 100644 nuttx/configs/vsn/src/README.txt create mode 100644 nuttx/configs/vsn/src/boot.c create mode 100644 nuttx/configs/vsn/src/buttons.c create mode 100644 nuttx/configs/vsn/src/chipcon.c create mode 100644 nuttx/configs/vsn/src/leds.c create mode 100644 nuttx/configs/vsn/src/muxbus.c create mode 100644 nuttx/configs/vsn/src/power.c create mode 100644 nuttx/configs/vsn/src/rtac.c create mode 100644 nuttx/configs/vsn/src/sif.c create mode 100644 nuttx/configs/vsn/src/spi.c create mode 100644 nuttx/configs/vsn/src/sysclock.c create mode 100644 nuttx/configs/vsn/src/usbdev.c create mode 100644 nuttx/configs/vsn/src/usbstrg.c create mode 100644 nuttx/configs/vsn/src/vsn.h create mode 100644 nuttx/configs/xtrs/README.txt create mode 100644 nuttx/configs/xtrs/include/README.txt create mode 100644 nuttx/configs/xtrs/include/board.h create mode 100644 nuttx/configs/xtrs/include/trs80-m3.h create mode 100644 nuttx/configs/xtrs/nsh/Make.defs create mode 100644 nuttx/configs/xtrs/nsh/appconfig create mode 100644 nuttx/configs/xtrs/nsh/defconfig create mode 100755 nuttx/configs/xtrs/nsh/setenv.sh create mode 100644 nuttx/configs/xtrs/ostest/Make.defs create mode 100644 nuttx/configs/xtrs/ostest/appconfig create mode 100644 nuttx/configs/xtrs/ostest/defconfig create mode 100755 nuttx/configs/xtrs/ostest/setenv.sh create mode 100644 nuttx/configs/xtrs/pashello/Make.defs create mode 100644 nuttx/configs/xtrs/pashello/appconfig create mode 100644 nuttx/configs/xtrs/pashello/defconfig create mode 100755 nuttx/configs/xtrs/pashello/setenv.sh create mode 100644 nuttx/configs/xtrs/sdcc-2.6.0-asz80-symlen.patch create mode 100644 nuttx/configs/xtrs/src/Make.defs create mode 100644 nuttx/configs/xtrs/src/Makefile create mode 100644 nuttx/configs/xtrs/src/README.txt create mode 100644 nuttx/configs/xtrs/src/xtr_irq.c create mode 100644 nuttx/configs/xtrs/src/xtr_lowputc.c create mode 100644 nuttx/configs/xtrs/src/xtr_serial.c create mode 100644 nuttx/configs/xtrs/src/xtr_timerisr.c create mode 100644 nuttx/configs/xtrs/src/xtrs_head.asm create mode 100644 nuttx/configs/z16f2800100zcog/README.txt create mode 100644 nuttx/configs/z16f2800100zcog/include/board.h create mode 100644 nuttx/configs/z16f2800100zcog/ostest/Make.defs create mode 100644 nuttx/configs/z16f2800100zcog/ostest/README.txt create mode 100644 nuttx/configs/z16f2800100zcog/ostest/appconfig create mode 100644 nuttx/configs/z16f2800100zcog/ostest/defconfig create mode 100755 nuttx/configs/z16f2800100zcog/ostest/ostest.linkcmd create mode 100644 nuttx/configs/z16f2800100zcog/ostest/ostest.zfpproj create mode 100755 nuttx/configs/z16f2800100zcog/ostest/setenv.sh create mode 100644 nuttx/configs/z16f2800100zcog/ostest/test-result.txt create mode 100755 nuttx/configs/z16f2800100zcog/pashello/Make.defs create mode 100755 nuttx/configs/z16f2800100zcog/pashello/README.txt create mode 100644 nuttx/configs/z16f2800100zcog/pashello/appconfig create mode 100644 nuttx/configs/z16f2800100zcog/pashello/defconfig create mode 100755 nuttx/configs/z16f2800100zcog/pashello/pashello.linkcmd create mode 100755 nuttx/configs/z16f2800100zcog/pashello/pashello.zfpproj create mode 100755 nuttx/configs/z16f2800100zcog/pashello/setenv.sh create mode 100644 nuttx/configs/z16f2800100zcog/src/Makefile create mode 100644 nuttx/configs/z16f2800100zcog/src/z16f_leds.c create mode 100644 nuttx/configs/z16f2800100zcog/src/z16f_lowinit.c create mode 100644 nuttx/configs/z80sim/README.txt create mode 100644 nuttx/configs/z80sim/include/README.txt create mode 100644 nuttx/configs/z80sim/include/board.h create mode 100644 nuttx/configs/z80sim/nsh/Make.defs create mode 100644 nuttx/configs/z80sim/nsh/appconfig create mode 100644 nuttx/configs/z80sim/nsh/defconfig create mode 100755 nuttx/configs/z80sim/nsh/setenv.sh create mode 100644 nuttx/configs/z80sim/ostest/Make.defs create mode 100644 nuttx/configs/z80sim/ostest/appconfig create mode 100644 nuttx/configs/z80sim/ostest/defconfig create mode 100755 nuttx/configs/z80sim/ostest/setenv.sh create mode 100644 nuttx/configs/z80sim/pashello/Make.defs create mode 100644 nuttx/configs/z80sim/pashello/appconfig create mode 100644 nuttx/configs/z80sim/pashello/defconfig create mode 100755 nuttx/configs/z80sim/pashello/setenv.sh create mode 100644 nuttx/configs/z80sim/sdcc-2.6.0-asz80-symlen.patch create mode 100644 nuttx/configs/z80sim/src/Makefile create mode 100644 nuttx/configs/z80sim/src/README.txt create mode 100644 nuttx/configs/z80sim/src/z80_irq.c create mode 100644 nuttx/configs/z80sim/src/z80_lowputc.c create mode 100644 nuttx/configs/z80sim/src/z80_serial.c create mode 100644 nuttx/configs/z80sim/src/z80_timerisr.c create mode 100644 nuttx/configs/z8encore000zco/README.txt create mode 100644 nuttx/configs/z8encore000zco/include/board.h create mode 100644 nuttx/configs/z8encore000zco/ostest/Make.defs create mode 100644 nuttx/configs/z8encore000zco/ostest/README.txt create mode 100644 nuttx/configs/z8encore000zco/ostest/appconfig create mode 100644 nuttx/configs/z8encore000zco/ostest/defconfig create mode 100755 nuttx/configs/z8encore000zco/ostest/ostest.linkcmd create mode 100644 nuttx/configs/z8encore000zco/ostest/ostest.zdsproj create mode 100755 nuttx/configs/z8encore000zco/ostest/setenv.sh create mode 100644 nuttx/configs/z8encore000zco/ostest/test-result.txt create mode 100644 nuttx/configs/z8encore000zco/src/Makefile create mode 100644 nuttx/configs/z8encore000zco/src/z8_leds.c create mode 100644 nuttx/configs/z8encore000zco/src/z8_lowinit.c create mode 100644 nuttx/configs/z8f64200100kit/README.txt create mode 100644 nuttx/configs/z8f64200100kit/include/board.h create mode 100644 nuttx/configs/z8f64200100kit/ostest/Make.defs create mode 100644 nuttx/configs/z8f64200100kit/ostest/README.txt create mode 100644 nuttx/configs/z8f64200100kit/ostest/appconfig create mode 100644 nuttx/configs/z8f64200100kit/ostest/defconfig create mode 100755 nuttx/configs/z8f64200100kit/ostest/ostest.linkcmd create mode 100644 nuttx/configs/z8f64200100kit/ostest/ostest.zdsproj create mode 100755 nuttx/configs/z8f64200100kit/ostest/setenv.sh create mode 100644 nuttx/configs/z8f64200100kit/ostest/test-result.txt create mode 100644 nuttx/configs/z8f64200100kit/src/Makefile create mode 100644 nuttx/configs/z8f64200100kit/src/z8_leds.c create mode 100644 nuttx/configs/z8f64200100kit/src/z8_lowinit.c create mode 100644 nuttx/drivers/Makefile create mode 100644 nuttx/drivers/README.txt create mode 100644 nuttx/drivers/analog/Make.defs create mode 100644 nuttx/drivers/analog/ad5410.c create mode 100644 nuttx/drivers/analog/adc.c create mode 100644 nuttx/drivers/analog/ads1255.c create mode 100644 nuttx/drivers/analog/dac.c create mode 100644 nuttx/drivers/bch/Make.defs create mode 100644 nuttx/drivers/bch/bch_internal.h create mode 100644 nuttx/drivers/bch/bchdev_driver.c create mode 100644 nuttx/drivers/bch/bchdev_register.c create mode 100644 nuttx/drivers/bch/bchdev_unregister.c create mode 100644 nuttx/drivers/bch/bchlib_cache.c create mode 100644 nuttx/drivers/bch/bchlib_read.c create mode 100644 nuttx/drivers/bch/bchlib_sem.c create mode 100644 nuttx/drivers/bch/bchlib_setup.c create mode 100644 nuttx/drivers/bch/bchlib_teardown.c create mode 100644 nuttx/drivers/bch/bchlib_write.c create mode 100644 nuttx/drivers/can.c create mode 100644 nuttx/drivers/dev_null.c create mode 100644 nuttx/drivers/dev_zero.c create mode 100644 nuttx/drivers/input/Make.defs create mode 100644 nuttx/drivers/input/ads7843e.c create mode 100644 nuttx/drivers/input/ads7843e.h create mode 100644 nuttx/drivers/input/tsc2007.c create mode 100644 nuttx/drivers/input/tsc2007.h create mode 100644 nuttx/drivers/lcd/Make.defs create mode 100644 nuttx/drivers/lcd/nokia6100.c create mode 100644 nuttx/drivers/lcd/p14201.c create mode 100644 nuttx/drivers/lcd/pcf8833.h create mode 100644 nuttx/drivers/lcd/s1d15g10.h create mode 100644 nuttx/drivers/lcd/sd1329.h create mode 100644 nuttx/drivers/lcd/skeleton.c create mode 100644 nuttx/drivers/lcd/ssd1305.h create mode 100644 nuttx/drivers/lcd/ug-9664hswag01.c create mode 100644 nuttx/drivers/loop.c create mode 100644 nuttx/drivers/mmcsd/Make.defs create mode 100644 nuttx/drivers/mmcsd/mmcsd_csd.h create mode 100644 nuttx/drivers/mmcsd/mmcsd_debug.c create mode 100644 nuttx/drivers/mmcsd/mmcsd_internal.h create mode 100644 nuttx/drivers/mmcsd/mmcsd_sdio.c create mode 100644 nuttx/drivers/mmcsd/mmcsd_sdio.h create mode 100644 nuttx/drivers/mmcsd/mmcsd_spi.c create mode 100644 nuttx/drivers/mmcsd/mmcsd_spi.h create mode 100644 nuttx/drivers/mtd/Make.defs create mode 100644 nuttx/drivers/mtd/at24xx.c create mode 100644 nuttx/drivers/mtd/at45db.c create mode 100644 nuttx/drivers/mtd/flash_eraseall.c create mode 100644 nuttx/drivers/mtd/ftl.c create mode 100644 nuttx/drivers/mtd/m25px.c create mode 100644 nuttx/drivers/mtd/rammtd.c create mode 100644 nuttx/drivers/mtd/ramtron.c create mode 100644 nuttx/drivers/mtd/skeleton.c create mode 100644 nuttx/drivers/net/Make.defs create mode 100644 nuttx/drivers/net/cs89x0.c create mode 100644 nuttx/drivers/net/cs89x0.h create mode 100644 nuttx/drivers/net/dm90x0.c create mode 100644 nuttx/drivers/net/e1000.c create mode 100644 nuttx/drivers/net/e1000.h create mode 100644 nuttx/drivers/net/enc28j60.c create mode 100644 nuttx/drivers/net/enc28j60.h create mode 100644 nuttx/drivers/net/skeleton.c create mode 100644 nuttx/drivers/net/slip.c create mode 100644 nuttx/drivers/net/vnet.c create mode 100644 nuttx/drivers/pipes/Make.defs create mode 100644 nuttx/drivers/pipes/fifo.c create mode 100644 nuttx/drivers/pipes/pipe.c create mode 100644 nuttx/drivers/pipes/pipe_common.c create mode 100644 nuttx/drivers/pipes/pipe_common.h create mode 100644 nuttx/drivers/pm/Make.defs create mode 100644 nuttx/drivers/pm/pm_activity.c create mode 100644 nuttx/drivers/pm/pm_changestate.c create mode 100644 nuttx/drivers/pm/pm_checkstate.c create mode 100644 nuttx/drivers/pm/pm_initialize.c create mode 100644 nuttx/drivers/pm/pm_internal.h create mode 100644 nuttx/drivers/pm/pm_register.c create mode 100644 nuttx/drivers/pm/pm_update.c create mode 100644 nuttx/drivers/pwm.c create mode 100644 nuttx/drivers/ramdisk.c create mode 100644 nuttx/drivers/rwbuffer.c create mode 100644 nuttx/drivers/sensors/Make.defs create mode 100644 nuttx/drivers/sensors/lis331dl.c create mode 100644 nuttx/drivers/sensors/lm75.c create mode 100644 nuttx/drivers/serial/Make.defs create mode 100644 nuttx/drivers/serial/lowconsole.c create mode 100644 nuttx/drivers/serial/serial.c create mode 100644 nuttx/drivers/serial/serialirq.c create mode 100644 nuttx/drivers/serial/uart_16550.c create mode 100644 nuttx/drivers/usbdev/Make.defs create mode 100644 nuttx/drivers/usbdev/cdc_serdesc.c create mode 100644 nuttx/drivers/usbdev/cdc_serial.c create mode 100644 nuttx/drivers/usbdev/cdc_serial.h create mode 100644 nuttx/drivers/usbdev/usbdev_composite.c create mode 100644 nuttx/drivers/usbdev/usbdev_composite.h create mode 100644 nuttx/drivers/usbdev/usbdev_scsi.c create mode 100644 nuttx/drivers/usbdev/usbdev_serial.c create mode 100644 nuttx/drivers/usbdev/usbdev_storage.c create mode 100644 nuttx/drivers/usbdev/usbdev_storage.h create mode 100644 nuttx/drivers/usbdev/usbdev_stordesc.c create mode 100644 nuttx/drivers/usbdev/usbdev_trace.c create mode 100644 nuttx/drivers/usbdev/usbdev_trprintf.c create mode 100644 nuttx/drivers/usbhost/Make.defs create mode 100644 nuttx/drivers/usbhost/hid_parser.c create mode 100644 nuttx/drivers/usbhost/usbhost_enumerate.c create mode 100644 nuttx/drivers/usbhost/usbhost_findclass.c create mode 100644 nuttx/drivers/usbhost/usbhost_hidkbd.c create mode 100644 nuttx/drivers/usbhost/usbhost_registerclass.c create mode 100644 nuttx/drivers/usbhost/usbhost_registry.c create mode 100644 nuttx/drivers/usbhost/usbhost_registry.h create mode 100644 nuttx/drivers/usbhost/usbhost_skeleton.c create mode 100644 nuttx/drivers/usbhost/usbhost_storage.c create mode 100644 nuttx/drivers/wireless/Make.defs create mode 100644 nuttx/drivers/wireless/cc1101/ISM1_868MHzGFSK100kbps.c create mode 100644 nuttx/drivers/wireless/cc1101/ISM2_905MHzGFSK250kbps.c create mode 100755 nuttx/drivers/wireless/cc1101/cc1101.c create mode 100644 nuttx/fs/Makefile create mode 100644 nuttx/fs/fat/Make.defs create mode 100644 nuttx/fs/fat/fs_configfat.c create mode 100644 nuttx/fs/fat/fs_fat32.c create mode 100644 nuttx/fs/fat/fs_fat32.h create mode 100644 nuttx/fs/fat/fs_fat32attrib.c create mode 100644 nuttx/fs/fat/fs_fat32dirent.c create mode 100644 nuttx/fs/fat/fs_fat32util.c create mode 100644 nuttx/fs/fat/fs_mkfatfs.c create mode 100644 nuttx/fs/fat/fs_mkfatfs.h create mode 100644 nuttx/fs/fat/fs_writefat.c create mode 100644 nuttx/fs/fs_close.c create mode 100644 nuttx/fs/fs_closeblockdriver.c create mode 100644 nuttx/fs/fs_closedir.c create mode 100644 nuttx/fs/fs_dup.c create mode 100644 nuttx/fs/fs_dup2.c create mode 100644 nuttx/fs/fs_fcntl.c create mode 100644 nuttx/fs/fs_fdopen.c create mode 100644 nuttx/fs/fs_filedup.c create mode 100644 nuttx/fs/fs_filedup2.c create mode 100644 nuttx/fs/fs_files.c create mode 100644 nuttx/fs/fs_findblockdriver.c create mode 100644 nuttx/fs/fs_fsync.c create mode 100644 nuttx/fs/fs_inode.c create mode 100644 nuttx/fs/fs_inodeaddref.c create mode 100644 nuttx/fs/fs_inodefind.c create mode 100644 nuttx/fs/fs_inoderelease.c create mode 100644 nuttx/fs/fs_inoderemove.c create mode 100644 nuttx/fs/fs_inodereserve.c create mode 100644 nuttx/fs/fs_internal.h create mode 100644 nuttx/fs/fs_ioctl.c create mode 100644 nuttx/fs/fs_lseek.c create mode 100644 nuttx/fs/fs_mkdir.c create mode 100644 nuttx/fs/fs_mount.c create mode 100644 nuttx/fs/fs_open.c create mode 100644 nuttx/fs/fs_openblockdriver.c create mode 100644 nuttx/fs/fs_opendir.c create mode 100644 nuttx/fs/fs_poll.c create mode 100644 nuttx/fs/fs_read.c create mode 100644 nuttx/fs/fs_readdir.c create mode 100644 nuttx/fs/fs_registerblockdriver.c create mode 100644 nuttx/fs/fs_registerdriver.c create mode 100644 nuttx/fs/fs_rename.c create mode 100644 nuttx/fs/fs_rewinddir.c create mode 100644 nuttx/fs/fs_rmdir.c create mode 100644 nuttx/fs/fs_seekdir.c create mode 100644 nuttx/fs/fs_select.c create mode 100644 nuttx/fs/fs_stat.c create mode 100644 nuttx/fs/fs_statfs.c create mode 100644 nuttx/fs/fs_umount.c create mode 100644 nuttx/fs/fs_unlink.c create mode 100644 nuttx/fs/fs_unregisterblockdriver.c create mode 100644 nuttx/fs/fs_unregisterdriver.c create mode 100644 nuttx/fs/fs_write.c create mode 100644 nuttx/fs/mmap/Make.defs create mode 100755 nuttx/fs/mmap/README.txt create mode 100644 nuttx/fs/mmap/fs_mmap.c create mode 100644 nuttx/fs/mmap/fs_munmap.c create mode 100644 nuttx/fs/mmap/fs_rammap.c create mode 100644 nuttx/fs/mmap/fs_rammap.h create mode 100644 nuttx/fs/nxffs/Make.defs create mode 100755 nuttx/fs/nxffs/README.txt create mode 100644 nuttx/fs/nxffs/nxffs.h create mode 100644 nuttx/fs/nxffs/nxffs_block.c create mode 100644 nuttx/fs/nxffs/nxffs_blockstats.c create mode 100644 nuttx/fs/nxffs/nxffs_cache.c create mode 100644 nuttx/fs/nxffs/nxffs_dirent.c create mode 100644 nuttx/fs/nxffs/nxffs_dump.c create mode 100644 nuttx/fs/nxffs/nxffs_initialize.c create mode 100644 nuttx/fs/nxffs/nxffs_inode.c create mode 100644 nuttx/fs/nxffs/nxffs_ioctl.c create mode 100644 nuttx/fs/nxffs/nxffs_open.c create mode 100644 nuttx/fs/nxffs/nxffs_pack.c create mode 100644 nuttx/fs/nxffs/nxffs_read.c create mode 100644 nuttx/fs/nxffs/nxffs_reformat.c create mode 100644 nuttx/fs/nxffs/nxffs_stat.c create mode 100644 nuttx/fs/nxffs/nxffs_unlink.c create mode 100644 nuttx/fs/nxffs/nxffs_util.c create mode 100644 nuttx/fs/nxffs/nxffs_write.c create mode 100644 nuttx/fs/romfs/Make.defs create mode 100644 nuttx/fs/romfs/fs_romfs.c create mode 100644 nuttx/fs/romfs/fs_romfs.h create mode 100644 nuttx/fs/romfs/fs_romfsutil.c create mode 100644 nuttx/graphics/Makefile create mode 100644 nuttx/graphics/README.txt create mode 100644 nuttx/graphics/nxbe/Make.defs create mode 100644 nuttx/graphics/nxbe/nxbe.h create mode 100644 nuttx/graphics/nxbe/nxbe_bitmap.c create mode 100644 nuttx/graphics/nxbe/nxbe_clipper.c create mode 100644 nuttx/graphics/nxbe/nxbe_closewindow.c create mode 100644 nuttx/graphics/nxbe/nxbe_colormap.c create mode 100644 nuttx/graphics/nxbe/nxbe_configure.c create mode 100644 nuttx/graphics/nxbe/nxbe_fill.c create mode 100644 nuttx/graphics/nxbe/nxbe_filltrapezoid.c create mode 100644 nuttx/graphics/nxbe/nxbe_getrectangle.c create mode 100644 nuttx/graphics/nxbe/nxbe_lower.c create mode 100644 nuttx/graphics/nxbe/nxbe_move.c create mode 100644 nuttx/graphics/nxbe/nxbe_raise.c create mode 100644 nuttx/graphics/nxbe/nxbe_redraw.c create mode 100644 nuttx/graphics/nxbe/nxbe_redrawbelow.c create mode 100644 nuttx/graphics/nxbe/nxbe_setpixel.c create mode 100644 nuttx/graphics/nxbe/nxbe_setposition.c create mode 100644 nuttx/graphics/nxbe/nxbe_setsize.c create mode 100644 nuttx/graphics/nxbe/nxbe_visible.c create mode 100644 nuttx/graphics/nxfonts/Make.defs create mode 100644 nuttx/graphics/nxfonts/Makefile.sources create mode 100644 nuttx/graphics/nxfonts/nxfonts_bitmaps.c create mode 100644 nuttx/graphics/nxfonts/nxfonts_convert.c create mode 100644 nuttx/graphics/nxfonts/nxfonts_getfont.c create mode 100644 nuttx/graphics/nxfonts/nxfonts_internal.h create mode 100644 nuttx/graphics/nxfonts/nxfonts_sans17x22.h create mode 100644 nuttx/graphics/nxfonts/nxfonts_sans17x23b.h create mode 100644 nuttx/graphics/nxfonts/nxfonts_sans20x26.h create mode 100644 nuttx/graphics/nxfonts/nxfonts_sans20x27b.h create mode 100644 nuttx/graphics/nxfonts/nxfonts_sans22x29.h create mode 100644 nuttx/graphics/nxfonts/nxfonts_sans22x29b.h create mode 100644 nuttx/graphics/nxfonts/nxfonts_sans23x27.h create mode 100644 nuttx/graphics/nxfonts/nxfonts_sans28x37.h create mode 100755 nuttx/graphics/nxfonts/nxfonts_sans28x37b.h create mode 100644 nuttx/graphics/nxfonts/nxfonts_sans39x48.h create mode 100755 nuttx/graphics/nxfonts/nxfonts_sans40x49b.h create mode 100644 nuttx/graphics/nxfonts/nxfonts_serif22x28b.h create mode 100644 nuttx/graphics/nxfonts/nxfonts_serif22x29.h create mode 100755 nuttx/graphics/nxfonts/nxfonts_serif27x38b.h create mode 100755 nuttx/graphics/nxfonts/nxfonts_serif29x37.h create mode 100644 nuttx/graphics/nxfonts/nxfonts_serif38x48.h create mode 100644 nuttx/graphics/nxfonts/nxfonts_serif38x49b.h create mode 100644 nuttx/graphics/nxglib/Make.defs create mode 100644 nuttx/graphics/nxglib/Makefile.sources create mode 100644 nuttx/graphics/nxglib/fb/nxglib_copyrectangle.c create mode 100644 nuttx/graphics/nxglib/fb/nxglib_fillrectangle.c create mode 100644 nuttx/graphics/nxglib/fb/nxglib_filltrapezoid.c create mode 100644 nuttx/graphics/nxglib/fb/nxglib_getrectangle.c create mode 100644 nuttx/graphics/nxglib/fb/nxglib_moverectangle.c create mode 100644 nuttx/graphics/nxglib/fb/nxglib_setpixel.c create mode 100644 nuttx/graphics/nxglib/lcd/nxglib_copyrectangle.c create mode 100644 nuttx/graphics/nxglib/lcd/nxglib_fillrectangle.c create mode 100644 nuttx/graphics/nxglib/lcd/nxglib_filltrapezoid.c create mode 100644 nuttx/graphics/nxglib/lcd/nxglib_getrectangle.c create mode 100644 nuttx/graphics/nxglib/lcd/nxglib_moverectangle.c create mode 100644 nuttx/graphics/nxglib/lcd/nxglib_setpixel.c create mode 100644 nuttx/graphics/nxglib/nxglib_bitblit.h create mode 100644 nuttx/graphics/nxglib/nxglib_circlepts.c create mode 100644 nuttx/graphics/nxglib/nxglib_circletraps.c create mode 100644 nuttx/graphics/nxglib/nxglib_colorcopy.c create mode 100644 nuttx/graphics/nxglib/nxglib_copyrun.h create mode 100644 nuttx/graphics/nxglib/nxglib_fillrun.h create mode 100644 nuttx/graphics/nxglib/nxglib_intersecting.c create mode 100644 nuttx/graphics/nxglib/nxglib_nonintersecting.c create mode 100644 nuttx/graphics/nxglib/nxglib_nullrect.c create mode 100644 nuttx/graphics/nxglib/nxglib_rectadd.c create mode 100644 nuttx/graphics/nxglib/nxglib_rectcopy.c create mode 100644 nuttx/graphics/nxglib/nxglib_rectinside.c create mode 100644 nuttx/graphics/nxglib/nxglib_rectintersect.c create mode 100644 nuttx/graphics/nxglib/nxglib_rectoffset.c create mode 100644 nuttx/graphics/nxglib/nxglib_rectoverlap.c create mode 100644 nuttx/graphics/nxglib/nxglib_rectsize.c create mode 100644 nuttx/graphics/nxglib/nxglib_rectunion.c create mode 100644 nuttx/graphics/nxglib/nxglib_rgb2yuv.c create mode 100644 nuttx/graphics/nxglib/nxglib_runcopy.c create mode 100644 nuttx/graphics/nxglib/nxglib_runoffset.c create mode 100644 nuttx/graphics/nxglib/nxglib_splitline.c create mode 100644 nuttx/graphics/nxglib/nxglib_trapcopy.c create mode 100644 nuttx/graphics/nxglib/nxglib_trapoffset.c create mode 100644 nuttx/graphics/nxglib/nxglib_vectoradd.c create mode 100644 nuttx/graphics/nxglib/nxglib_vectsubtract.c create mode 100644 nuttx/graphics/nxglib/nxglib_yuv2rgb.c create mode 100644 nuttx/graphics/nxmu/Make.defs create mode 100644 nuttx/graphics/nxmu/nx_bitmap.c create mode 100644 nuttx/graphics/nxmu/nx_closewindow.c create mode 100644 nuttx/graphics/nxmu/nx_connect.c create mode 100644 nuttx/graphics/nxmu/nx_disconnect.c create mode 100644 nuttx/graphics/nxmu/nx_drawcircle.c create mode 100644 nuttx/graphics/nxmu/nx_drawline.c create mode 100644 nuttx/graphics/nxmu/nx_eventhandler.c create mode 100644 nuttx/graphics/nxmu/nx_eventnotify.c create mode 100644 nuttx/graphics/nxmu/nx_fill.c create mode 100644 nuttx/graphics/nxmu/nx_fillcircle.c create mode 100644 nuttx/graphics/nxmu/nx_filltrapezoid.c create mode 100644 nuttx/graphics/nxmu/nx_getposition.c create mode 100644 nuttx/graphics/nxmu/nx_getrectangle.c create mode 100644 nuttx/graphics/nxmu/nx_kbdchin.c create mode 100644 nuttx/graphics/nxmu/nx_kbdin.c create mode 100644 nuttx/graphics/nxmu/nx_lower.c create mode 100644 nuttx/graphics/nxmu/nx_mousein.c create mode 100644 nuttx/graphics/nxmu/nx_move.c create mode 100644 nuttx/graphics/nxmu/nx_openwindow.c create mode 100644 nuttx/graphics/nxmu/nx_raise.c create mode 100644 nuttx/graphics/nxmu/nx_releasebkgd.c create mode 100644 nuttx/graphics/nxmu/nx_requestbkgd.c create mode 100644 nuttx/graphics/nxmu/nx_setbgcolor.c create mode 100644 nuttx/graphics/nxmu/nx_setpixel.c create mode 100644 nuttx/graphics/nxmu/nx_setposition.c create mode 100644 nuttx/graphics/nxmu/nx_setsize.c create mode 100644 nuttx/graphics/nxmu/nxfe.h create mode 100644 nuttx/graphics/nxmu/nxmu_constructwindow.c create mode 100644 nuttx/graphics/nxmu/nxmu_kbdin.c create mode 100644 nuttx/graphics/nxmu/nxmu_mouse.c create mode 100644 nuttx/graphics/nxmu/nxmu_openwindow.c create mode 100644 nuttx/graphics/nxmu/nxmu_redrawreq.c create mode 100644 nuttx/graphics/nxmu/nxmu_releasebkgd.c create mode 100644 nuttx/graphics/nxmu/nxmu_reportposition.c create mode 100644 nuttx/graphics/nxmu/nxmu_requestbkgd.c create mode 100644 nuttx/graphics/nxmu/nxmu_semtake.c create mode 100644 nuttx/graphics/nxmu/nxmu_server.c create mode 100644 nuttx/graphics/nxsu/Make.defs create mode 100644 nuttx/graphics/nxsu/nx_bitmap.c create mode 100644 nuttx/graphics/nxsu/nx_close.c create mode 100644 nuttx/graphics/nxsu/nx_closewindow.c create mode 100644 nuttx/graphics/nxsu/nx_drawcircle.c create mode 100644 nuttx/graphics/nxsu/nx_drawline.c create mode 100644 nuttx/graphics/nxsu/nx_fill.c create mode 100644 nuttx/graphics/nxsu/nx_fillcircle.c create mode 100644 nuttx/graphics/nxsu/nx_filltrapezoid.c create mode 100644 nuttx/graphics/nxsu/nx_getposition.c create mode 100644 nuttx/graphics/nxsu/nx_getrectangle.c create mode 100644 nuttx/graphics/nxsu/nx_kbdchin.c create mode 100644 nuttx/graphics/nxsu/nx_kbdin.c create mode 100644 nuttx/graphics/nxsu/nx_lower.c create mode 100644 nuttx/graphics/nxsu/nx_mousein.c create mode 100644 nuttx/graphics/nxsu/nx_move.c create mode 100644 nuttx/graphics/nxsu/nx_open.c create mode 100644 nuttx/graphics/nxsu/nx_openwindow.c create mode 100644 nuttx/graphics/nxsu/nx_raise.c create mode 100644 nuttx/graphics/nxsu/nx_releasebkgd.c create mode 100644 nuttx/graphics/nxsu/nx_requestbkgd.c create mode 100644 nuttx/graphics/nxsu/nx_setbgcolor.c create mode 100644 nuttx/graphics/nxsu/nx_setpixel.c create mode 100644 nuttx/graphics/nxsu/nx_setposition.c create mode 100644 nuttx/graphics/nxsu/nx_setsize.c create mode 100644 nuttx/graphics/nxsu/nxfe.h create mode 100644 nuttx/graphics/nxsu/nxsu_constructwindow.c create mode 100644 nuttx/graphics/nxsu/nxsu_redrawreq.c create mode 100644 nuttx/graphics/nxsu/nxsu_reportposition.c create mode 100644 nuttx/graphics/nxtk/Make.defs create mode 100644 nuttx/graphics/nxtk/nxtk_bitmaptoolbar.c create mode 100644 nuttx/graphics/nxtk/nxtk_bitmapwindow.c create mode 100644 nuttx/graphics/nxtk/nxtk_closetoolbar.c create mode 100644 nuttx/graphics/nxtk/nxtk_closewindow.c create mode 100644 nuttx/graphics/nxtk/nxtk_containerclip.c create mode 100644 nuttx/graphics/nxtk/nxtk_drawcircletoolbar.c create mode 100644 nuttx/graphics/nxtk/nxtk_drawcirclewindow.c create mode 100644 nuttx/graphics/nxtk/nxtk_drawframe.c create mode 100644 nuttx/graphics/nxtk/nxtk_drawlinetoolbar.c create mode 100644 nuttx/graphics/nxtk/nxtk_drawlinewindow.c create mode 100644 nuttx/graphics/nxtk/nxtk_events.c create mode 100644 nuttx/graphics/nxtk/nxtk_fillcircletoolbar.c create mode 100644 nuttx/graphics/nxtk/nxtk_fillcirclewindow.c create mode 100644 nuttx/graphics/nxtk/nxtk_filltoolbar.c create mode 100644 nuttx/graphics/nxtk/nxtk_filltraptoolbar.c create mode 100644 nuttx/graphics/nxtk/nxtk_filltrapwindow.c create mode 100644 nuttx/graphics/nxtk/nxtk_fillwindow.c create mode 100644 nuttx/graphics/nxtk/nxtk_getposition.c create mode 100644 nuttx/graphics/nxtk/nxtk_gettoolbar.c create mode 100644 nuttx/graphics/nxtk/nxtk_getwindow.c create mode 100644 nuttx/graphics/nxtk/nxtk_internal.h create mode 100644 nuttx/graphics/nxtk/nxtk_lower.c create mode 100644 nuttx/graphics/nxtk/nxtk_movetoolbar.c create mode 100644 nuttx/graphics/nxtk/nxtk_movewindow.c create mode 100644 nuttx/graphics/nxtk/nxtk_opentoolbar.c create mode 100644 nuttx/graphics/nxtk/nxtk_openwindow.c create mode 100644 nuttx/graphics/nxtk/nxtk_raise.c create mode 100644 nuttx/graphics/nxtk/nxtk_setposition.c create mode 100644 nuttx/graphics/nxtk/nxtk_setsize.c create mode 100644 nuttx/graphics/nxtk/nxtk_setsubwindows.c create mode 100644 nuttx/graphics/nxtk/nxtk_subwindowclip.c create mode 100644 nuttx/graphics/nxtk/nxtk_subwindowmove.c create mode 100644 nuttx/include/arpa/inet.h create mode 100644 nuttx/include/assert.h create mode 100644 nuttx/include/crc32.h create mode 100644 nuttx/include/ctype.h create mode 100755 nuttx/include/cxx/cassert create mode 100755 nuttx/include/cxx/cctype create mode 100755 nuttx/include/cxx/cerrno create mode 100755 nuttx/include/cxx/climits create mode 100755 nuttx/include/cxx/cmath create mode 100755 nuttx/include/cxx/csignal create mode 100755 nuttx/include/cxx/cstdarg create mode 100755 nuttx/include/cxx/cstdbool create mode 100755 nuttx/include/cxx/cstddef create mode 100755 nuttx/include/cxx/cstdint create mode 100755 nuttx/include/cxx/cstdio create mode 100755 nuttx/include/cxx/cstdlib create mode 100755 nuttx/include/cxx/cstring create mode 100755 nuttx/include/cxx/ctime create mode 100644 nuttx/include/debug.h create mode 100644 nuttx/include/dirent.h create mode 100644 nuttx/include/errno.h create mode 100644 nuttx/include/fcntl.h create mode 100644 nuttx/include/fixedmath.h create mode 100644 nuttx/include/inttypes.h create mode 100644 nuttx/include/libgen.h create mode 100644 nuttx/include/limits.h create mode 100644 nuttx/include/math.h create mode 100644 nuttx/include/mqueue.h create mode 100644 nuttx/include/net/ethernet.h create mode 100644 nuttx/include/net/if.h create mode 100644 nuttx/include/net/ioctls.h create mode 100644 nuttx/include/net/uip/uip-arch.h create mode 100644 nuttx/include/net/uip/uip-arp.h create mode 100644 nuttx/include/net/uip/uip-icmp.h create mode 100755 nuttx/include/net/uip/uip-igmp.h create mode 100755 nuttx/include/net/uip/uip-ipopt.h create mode 100644 nuttx/include/net/uip/uip-tcp.h create mode 100644 nuttx/include/net/uip/uip-udp.h create mode 100644 nuttx/include/net/uip/uip.h create mode 100644 nuttx/include/net/uip/uipopt.h create mode 100644 nuttx/include/netinet/arp.h create mode 100644 nuttx/include/netinet/ether.h create mode 100644 nuttx/include/netinet/in.h create mode 100644 nuttx/include/netinet/ip.h create mode 100644 nuttx/include/netinet/ip6.h create mode 100644 nuttx/include/nuttx/analog/adc.h create mode 100644 nuttx/include/nuttx/analog/dac.h create mode 100644 nuttx/include/nuttx/arch.h create mode 100644 nuttx/include/nuttx/binfmt.h create mode 100644 nuttx/include/nuttx/can.h create mode 100644 nuttx/include/nuttx/clock.h create mode 100644 nuttx/include/nuttx/compiler.h create mode 100644 nuttx/include/nuttx/cs89x0.h create mode 100644 nuttx/include/nuttx/dirent.h create mode 100644 nuttx/include/nuttx/enc28j60.h create mode 100644 nuttx/include/nuttx/fat.h create mode 100644 nuttx/include/nuttx/fb.h create mode 100644 nuttx/include/nuttx/fs.h create mode 100644 nuttx/include/nuttx/i2c.h create mode 100644 nuttx/include/nuttx/init.h create mode 100644 nuttx/include/nuttx/input/ads7843e.h create mode 100644 nuttx/include/nuttx/input/touchscreen.h create mode 100644 nuttx/include/nuttx/input/tsc2007.h create mode 100644 nuttx/include/nuttx/ioctl.h create mode 100644 nuttx/include/nuttx/irq.h create mode 100644 nuttx/include/nuttx/kmalloc.h create mode 100644 nuttx/include/nuttx/lcd/lcd.h create mode 100644 nuttx/include/nuttx/lcd/nokia6100.h create mode 100644 nuttx/include/nuttx/lcd/p14201.h create mode 100644 nuttx/include/nuttx/lcd/ug-9664hswag01.h create mode 100644 nuttx/include/nuttx/lib.h create mode 100644 nuttx/include/nuttx/mii.h create mode 100644 nuttx/include/nuttx/mkfatfs.h create mode 100644 nuttx/include/nuttx/mm.h create mode 100644 nuttx/include/nuttx/mmcsd.h create mode 100644 nuttx/include/nuttx/mqueue.h create mode 100644 nuttx/include/nuttx/mtd.h create mode 100644 nuttx/include/nuttx/net.h create mode 100644 nuttx/include/nuttx/nx/nx.h create mode 100644 nuttx/include/nuttx/nx/nxfonts.h create mode 100644 nuttx/include/nuttx/nx/nxglib.h create mode 100644 nuttx/include/nuttx/nx/nxtk.h create mode 100644 nuttx/include/nuttx/nxffs.h create mode 100644 nuttx/include/nuttx/nxflat.h create mode 100644 nuttx/include/nuttx/page.h create mode 100644 nuttx/include/nuttx/pm.h create mode 100644 nuttx/include/nuttx/progmem.h create mode 100644 nuttx/include/nuttx/pthread.h create mode 100644 nuttx/include/nuttx/pwm.h create mode 100644 nuttx/include/nuttx/ramdisk.h create mode 100644 nuttx/include/nuttx/regex.h create mode 100644 nuttx/include/nuttx/rgbcolors.h create mode 100644 nuttx/include/nuttx/rtc.h create mode 100644 nuttx/include/nuttx/rwbuffer.h create mode 100644 nuttx/include/nuttx/sched.h create mode 100644 nuttx/include/nuttx/scsi.h create mode 100644 nuttx/include/nuttx/sdio.h create mode 100644 nuttx/include/nuttx/sensors/lis331dl.h create mode 100644 nuttx/include/nuttx/sensors/lm75.h create mode 100644 nuttx/include/nuttx/serial.h create mode 100644 nuttx/include/nuttx/spi.h create mode 100644 nuttx/include/nuttx/streams.h create mode 100644 nuttx/include/nuttx/symtab.h create mode 100644 nuttx/include/nuttx/time.h create mode 100644 nuttx/include/nuttx/tioctl.h create mode 100644 nuttx/include/nuttx/uart_16550.h create mode 100755 nuttx/include/nuttx/usb/cdc.h create mode 100644 nuttx/include/nuttx/usb/cdc_serial.h create mode 100644 nuttx/include/nuttx/usb/hid.h create mode 100644 nuttx/include/nuttx/usb/hid_parser.h create mode 100644 nuttx/include/nuttx/usb/ohci.h create mode 100644 nuttx/include/nuttx/usb/storage.h create mode 100644 nuttx/include/nuttx/usb/usb.h create mode 100644 nuttx/include/nuttx/usb/usbdev.h create mode 100644 nuttx/include/nuttx/usb/usbdev_trace.h create mode 100644 nuttx/include/nuttx/usb/usbhost.h create mode 100644 nuttx/include/nuttx/usb/usbhost_trace.h create mode 100644 nuttx/include/nuttx/wireless/cc1101.h create mode 100644 nuttx/include/nuttx/wqueue.h create mode 100644 nuttx/include/nxflat.h create mode 100644 nuttx/include/poll.h create mode 100644 nuttx/include/pthread.h create mode 100644 nuttx/include/queue.h create mode 100644 nuttx/include/sched.h create mode 100644 nuttx/include/semaphore.h create mode 100644 nuttx/include/signal.h create mode 100644 nuttx/include/stdbool.h create mode 100644 nuttx/include/stddef.h create mode 100644 nuttx/include/stdint.h create mode 100644 nuttx/include/stdio.h create mode 100644 nuttx/include/stdlib.h create mode 100644 nuttx/include/string.h create mode 100644 nuttx/include/sys/ioctl.h create mode 100644 nuttx/include/sys/mman.h create mode 100644 nuttx/include/sys/mount.h create mode 100644 nuttx/include/sys/select.h create mode 100644 nuttx/include/sys/socket.h create mode 100644 nuttx/include/sys/sockio.h create mode 100644 nuttx/include/sys/stat.h create mode 100644 nuttx/include/sys/statfs.h create mode 100644 nuttx/include/sys/syscall.h create mode 100644 nuttx/include/sys/time.h create mode 100644 nuttx/include/sys/types.h create mode 100644 nuttx/include/sys/vfs.h create mode 100644 nuttx/include/sys/wait.h create mode 100644 nuttx/include/syscall.h create mode 100644 nuttx/include/termios.h create mode 100644 nuttx/include/time.h create mode 100644 nuttx/include/unistd.h create mode 100644 nuttx/include/wdog.h create mode 100644 nuttx/lib/Makefile create mode 100644 nuttx/lib/README.txt create mode 100644 nuttx/lib/lib_internal.h create mode 100644 nuttx/lib/libgen/Make.defs create mode 100644 nuttx/lib/libgen/lib_basename.c create mode 100644 nuttx/lib/libgen/lib_dirname.c create mode 100644 nuttx/lib/math/Make.defs create mode 100644 nuttx/lib/math/lib_b16atan2.c create mode 100644 nuttx/lib/math/lib_b16cos.c create mode 100644 nuttx/lib/math/lib_b16sin.c create mode 100644 nuttx/lib/math/lib_fixedmath.c create mode 100644 nuttx/lib/math/lib_rint.c create mode 100644 nuttx/lib/misc/Make.defs create mode 100755 nuttx/lib/misc/lib_crc32.c create mode 100644 nuttx/lib/misc/lib_dbg.c create mode 100644 nuttx/lib/misc/lib_dumpbuffer.c create mode 100644 nuttx/lib/misc/lib_filesem.c create mode 100644 nuttx/lib/misc/lib_init.c create mode 100644 nuttx/lib/misc/lib_match.c create mode 100644 nuttx/lib/misc/lib_readdirr.c create mode 100644 nuttx/lib/misc/lib_streamsem.c create mode 100644 nuttx/lib/misc/lib_telldir.c create mode 100644 nuttx/lib/mqueue/Make.defs create mode 100644 nuttx/lib/mqueue/mq_getattr.c create mode 100644 nuttx/lib/mqueue/mq_setattr.c create mode 100644 nuttx/lib/net/Make.defs create mode 100644 nuttx/lib/net/lib_etherntoa.c create mode 100644 nuttx/lib/net/lib_htonl.c create mode 100644 nuttx/lib/net/lib_htons.c create mode 100644 nuttx/lib/net/lib_inetaddr.c create mode 100644 nuttx/lib/net/lib_inetntoa.c create mode 100644 nuttx/lib/pthread/Make.defs create mode 100644 nuttx/lib/pthread/pthread_attrdestroy.c create mode 100644 nuttx/lib/pthread/pthread_attrgetinheritsched.c create mode 100644 nuttx/lib/pthread/pthread_attrgetschedparam.c create mode 100644 nuttx/lib/pthread/pthread_attrgetschedpolicy.c create mode 100644 nuttx/lib/pthread/pthread_attrgetstacksize.c create mode 100644 nuttx/lib/pthread/pthread_attrinit.c create mode 100644 nuttx/lib/pthread/pthread_attrsetinheritsched.c create mode 100644 nuttx/lib/pthread/pthread_attrsetschedparam.c create mode 100644 nuttx/lib/pthread/pthread_attrsetschedpolicy.c create mode 100644 nuttx/lib/pthread/pthread_attrsetstacksize.c create mode 100644 nuttx/lib/pthread/pthread_barrierattrdestroy.c create mode 100644 nuttx/lib/pthread/pthread_barrierattrgetpshared.c create mode 100644 nuttx/lib/pthread/pthread_barrierattrinit.c create mode 100644 nuttx/lib/pthread/pthread_barrierattrsetpshared.c create mode 100644 nuttx/lib/pthread/pthread_condattrdestroy.c create mode 100644 nuttx/lib/pthread/pthread_condattrinit.c create mode 100644 nuttx/lib/pthread/pthread_mutexattrdestroy.c create mode 100644 nuttx/lib/pthread/pthread_mutexattrgetpshared.c create mode 100644 nuttx/lib/pthread/pthread_mutexattrgettype.c create mode 100644 nuttx/lib/pthread/pthread_mutexattrinit.c create mode 100644 nuttx/lib/pthread/pthread_mutexattrsetpshared.c create mode 100644 nuttx/lib/pthread/pthread_mutexattrsettype.c create mode 100644 nuttx/lib/queue/Make.defs create mode 100644 nuttx/lib/queue/dq_addafter.c create mode 100644 nuttx/lib/queue/dq_addbefore.c create mode 100644 nuttx/lib/queue/dq_addfirst.c create mode 100644 nuttx/lib/queue/dq_addlast.c create mode 100644 nuttx/lib/queue/dq_rem.c create mode 100644 nuttx/lib/queue/dq_remfirst.c create mode 100644 nuttx/lib/queue/dq_remlast.c create mode 100644 nuttx/lib/queue/sq_addafter.c create mode 100644 nuttx/lib/queue/sq_addfirst.c create mode 100644 nuttx/lib/queue/sq_addlast.c create mode 100644 nuttx/lib/queue/sq_rem.c create mode 100644 nuttx/lib/queue/sq_remafter.c create mode 100644 nuttx/lib/queue/sq_remfirst.c create mode 100644 nuttx/lib/queue/sq_remlast.c create mode 100644 nuttx/lib/sched/Make.defs create mode 100644 nuttx/lib/sched/sched_getprioritymax.c create mode 100644 nuttx/lib/sched/sched_getprioritymin.c create mode 100644 nuttx/lib/semaphore/Make.defs create mode 100644 nuttx/lib/semaphore/sem_getvalue.c create mode 100644 nuttx/lib/semaphore/sem_init.c create mode 100644 nuttx/lib/signal/Make.defs create mode 100644 nuttx/lib/signal/sig_addset.c create mode 100644 nuttx/lib/signal/sig_delset.c create mode 100644 nuttx/lib/signal/sig_emptyset.c create mode 100644 nuttx/lib/signal/sig_fillset.c create mode 100644 nuttx/lib/signal/sig_ismember.c create mode 100644 nuttx/lib/stdio/Make.defs create mode 100644 nuttx/lib/stdio/lib_asprintf.c create mode 100755 nuttx/lib/stdio/lib_dtoa.c create mode 100644 nuttx/lib/stdio/lib_fclose.c create mode 100644 nuttx/lib/stdio/lib_fflush.c create mode 100644 nuttx/lib/stdio/lib_fgetc.c create mode 100644 nuttx/lib/stdio/lib_fgetpos.c create mode 100644 nuttx/lib/stdio/lib_fgets.c create mode 100644 nuttx/lib/stdio/lib_fileno.c create mode 100644 nuttx/lib/stdio/lib_fopen.c create mode 100644 nuttx/lib/stdio/lib_fprintf.c create mode 100644 nuttx/lib/stdio/lib_fputc.c create mode 100644 nuttx/lib/stdio/lib_fputs.c create mode 100644 nuttx/lib/stdio/lib_fread.c create mode 100644 nuttx/lib/stdio/lib_fseek.c create mode 100644 nuttx/lib/stdio/lib_fsetpos.c create mode 100644 nuttx/lib/stdio/lib_ftell.c create mode 100644 nuttx/lib/stdio/lib_fwrite.c create mode 100644 nuttx/lib/stdio/lib_gets.c create mode 100755 nuttx/lib/stdio/lib_libdtoa.c create mode 100644 nuttx/lib/stdio/lib_libfflush.c create mode 100644 nuttx/lib/stdio/lib_libflushall.c create mode 100644 nuttx/lib/stdio/lib_libfread.c create mode 100644 nuttx/lib/stdio/lib_libfwrite.c create mode 100644 nuttx/lib/stdio/lib_libnoflush.c create mode 100644 nuttx/lib/stdio/lib_libsprintf.c create mode 100644 nuttx/lib/stdio/lib_libvsprintf.c create mode 100644 nuttx/lib/stdio/lib_lowinstream.c create mode 100644 nuttx/lib/stdio/lib_lowoutstream.c create mode 100644 nuttx/lib/stdio/lib_lowprintf.c create mode 100644 nuttx/lib/stdio/lib_meminstream.c create mode 100644 nuttx/lib/stdio/lib_memoutstream.c create mode 100644 nuttx/lib/stdio/lib_nullinstream.c create mode 100644 nuttx/lib/stdio/lib_nulloutstream.c create mode 100644 nuttx/lib/stdio/lib_printf.c create mode 100644 nuttx/lib/stdio/lib_puts.c create mode 100644 nuttx/lib/stdio/lib_rawinstream.c create mode 100644 nuttx/lib/stdio/lib_rawoutstream.c create mode 100644 nuttx/lib/stdio/lib_rawprintf.c create mode 100644 nuttx/lib/stdio/lib_rdflush.c create mode 100644 nuttx/lib/stdio/lib_snprintf.c create mode 100644 nuttx/lib/stdio/lib_sprintf.c create mode 100644 nuttx/lib/stdio/lib_sscanf.c create mode 100644 nuttx/lib/stdio/lib_stdinstream.c create mode 100644 nuttx/lib/stdio/lib_stdoutstream.c create mode 100644 nuttx/lib/stdio/lib_ungetc.c create mode 100644 nuttx/lib/stdio/lib_vfprintf.c create mode 100644 nuttx/lib/stdio/lib_vprintf.c create mode 100644 nuttx/lib/stdio/lib_vsnprintf.c create mode 100644 nuttx/lib/stdio/lib_vsprintf.c create mode 100644 nuttx/lib/stdio/lib_wrflush.c create mode 100644 nuttx/lib/stdio/lib_zeroinstream.c create mode 100644 nuttx/lib/stdlib/Make.defs create mode 100644 nuttx/lib/stdlib/lib_abort.c create mode 100644 nuttx/lib/stdlib/lib_abs.c create mode 100644 nuttx/lib/stdlib/lib_imaxabs.c create mode 100644 nuttx/lib/stdlib/lib_labs.c create mode 100644 nuttx/lib/stdlib/lib_llabs.c create mode 100644 nuttx/lib/stdlib/lib_qsort.c create mode 100644 nuttx/lib/stdlib/lib_rand.c create mode 100644 nuttx/lib/string/Make.defs create mode 100644 nuttx/lib/string/lib_checkbase.c create mode 100644 nuttx/lib/string/lib_isbasedigit.c create mode 100644 nuttx/lib/string/lib_memcmp.c create mode 100644 nuttx/lib/string/lib_memcpy.c create mode 100644 nuttx/lib/string/lib_memmove.c create mode 100644 nuttx/lib/string/lib_memset.c create mode 100644 nuttx/lib/string/lib_skipspace.c create mode 100644 nuttx/lib/string/lib_strcasecmp.c create mode 100644 nuttx/lib/string/lib_strcat.c create mode 100644 nuttx/lib/string/lib_strchr.c create mode 100644 nuttx/lib/string/lib_strcmp.c create mode 100644 nuttx/lib/string/lib_strcpy.c create mode 100644 nuttx/lib/string/lib_strcspn.c create mode 100644 nuttx/lib/string/lib_strdup.c create mode 100644 nuttx/lib/string/lib_strerror.c create mode 100644 nuttx/lib/string/lib_strlen.c create mode 100644 nuttx/lib/string/lib_strncasecmp.c create mode 100644 nuttx/lib/string/lib_strncat.c create mode 100644 nuttx/lib/string/lib_strncmp.c create mode 100644 nuttx/lib/string/lib_strncpy.c create mode 100644 nuttx/lib/string/lib_strndup.c create mode 100644 nuttx/lib/string/lib_strnlen.c create mode 100644 nuttx/lib/string/lib_strpbrk.c create mode 100644 nuttx/lib/string/lib_strrchr.c create mode 100644 nuttx/lib/string/lib_strspn.c create mode 100644 nuttx/lib/string/lib_strstr.c create mode 100755 nuttx/lib/string/lib_strtod.c create mode 100644 nuttx/lib/string/lib_strtok.c create mode 100644 nuttx/lib/string/lib_strtokr.c create mode 100644 nuttx/lib/string/lib_strtol.c create mode 100644 nuttx/lib/string/lib_strtoll.c create mode 100644 nuttx/lib/string/lib_strtoul.c create mode 100644 nuttx/lib/string/lib_strtoull.c create mode 100644 nuttx/lib/time/Make.defs create mode 100644 nuttx/lib/time/lib_calendar2utc.c create mode 100644 nuttx/lib/time/lib_daysbeforemonth.c create mode 100644 nuttx/lib/time/lib_gmtime.c create mode 100644 nuttx/lib/time/lib_gmtimer.c create mode 100644 nuttx/lib/time/lib_isleapyear.c create mode 100644 nuttx/lib/time/lib_mktime.c create mode 100644 nuttx/lib/time/lib_strftime.c create mode 100644 nuttx/lib/time/lib_time.c create mode 100644 nuttx/lib/unistd/Make.defs create mode 100644 nuttx/lib/unistd/lib_chdir.c create mode 100644 nuttx/lib/unistd/lib_getcwd.c create mode 100644 nuttx/lib/unistd/lib_getopt.c create mode 100644 nuttx/lib/unistd/lib_getoptargp.c create mode 100644 nuttx/lib/unistd/lib_getoptindp.c create mode 100644 nuttx/lib/unistd/lib_getoptoptp.c create mode 100755 nuttx/libxx/Makefile create mode 100755 nuttx/libxx/README.txt create mode 100755 nuttx/libxx/libxx_cxapurevirtual.cxx create mode 100755 nuttx/libxx/libxx_delete.cxx create mode 100755 nuttx/libxx/libxx_deletea.cxx create mode 100755 nuttx/libxx/libxx_new.cxx create mode 100755 nuttx/libxx/libxx_newa.cxx create mode 100644 nuttx/mm/Makefile create mode 100644 nuttx/mm/Makefile.test create mode 100644 nuttx/mm/mm_addfreechunk.c create mode 100644 nuttx/mm/mm_calloc.c create mode 100644 nuttx/mm/mm_environment.h create mode 100644 nuttx/mm/mm_free.c create mode 100644 nuttx/mm/mm_initialize.c create mode 100644 nuttx/mm/mm_internal.h create mode 100644 nuttx/mm/mm_mallinfo.c create mode 100644 nuttx/mm/mm_malloc.c create mode 100644 nuttx/mm/mm_memalign.c create mode 100644 nuttx/mm/mm_realloc.c create mode 100644 nuttx/mm/mm_sem.c create mode 100644 nuttx/mm/mm_shrinkchunk.c create mode 100644 nuttx/mm/mm_size2ndx.c create mode 100644 nuttx/mm/mm_test.c create mode 100644 nuttx/mm/mm_zalloc.c create mode 100644 nuttx/net/Makefile create mode 100644 nuttx/net/accept.c create mode 100644 nuttx/net/bind.c create mode 100644 nuttx/net/connect.c create mode 100644 nuttx/net/getsockname.c create mode 100644 nuttx/net/getsockopt.c create mode 100644 nuttx/net/listen.c create mode 100644 nuttx/net/net_arptimer.c create mode 100644 nuttx/net/net_checksd.c create mode 100644 nuttx/net/net_clone.c create mode 100644 nuttx/net/net_close.c create mode 100644 nuttx/net/net_dsec2timeval.c create mode 100644 nuttx/net/net_dup.c create mode 100644 nuttx/net/net_dup2.c create mode 100644 nuttx/net/net_internal.h create mode 100644 nuttx/net/net_poll.c create mode 100644 nuttx/net/net_sockets.c create mode 100644 nuttx/net/net_timeo.c create mode 100644 nuttx/net/net_timeval2dsec.c create mode 100644 nuttx/net/net_vfcntl.c create mode 100644 nuttx/net/netdev_count.c create mode 100644 nuttx/net/netdev_findbyaddr.c create mode 100644 nuttx/net/netdev_findbyname.c create mode 100644 nuttx/net/netdev_foreach.c create mode 100644 nuttx/net/netdev_ioctl.c create mode 100644 nuttx/net/netdev_register.c create mode 100644 nuttx/net/netdev_txnotify.c create mode 100644 nuttx/net/netdev_unregister.c create mode 100644 nuttx/net/recv.c create mode 100644 nuttx/net/recvfrom.c create mode 100644 nuttx/net/send.c create mode 100644 nuttx/net/sendto.c create mode 100644 nuttx/net/setsockopt.c create mode 100644 nuttx/net/socket.c create mode 100644 nuttx/net/uip/Make.defs create mode 100644 nuttx/net/uip/uip_arp.c create mode 100644 nuttx/net/uip/uip_arptab.c create mode 100644 nuttx/net/uip/uip_callback.c create mode 100644 nuttx/net/uip/uip_chksum.c create mode 100644 nuttx/net/uip/uip_icmpinput.c create mode 100644 nuttx/net/uip/uip_icmpping.c create mode 100644 nuttx/net/uip/uip_icmppoll.c create mode 100644 nuttx/net/uip/uip_icmpsend.c create mode 100755 nuttx/net/uip/uip_igmpgroup.c create mode 100755 nuttx/net/uip/uip_igmpinit.c create mode 100755 nuttx/net/uip/uip_igmpinput.c create mode 100755 nuttx/net/uip/uip_igmpjoin.c create mode 100755 nuttx/net/uip/uip_igmpleave.c create mode 100755 nuttx/net/uip/uip_igmpmsg.c create mode 100755 nuttx/net/uip/uip_igmppoll.c create mode 100755 nuttx/net/uip/uip_igmpsend.c create mode 100755 nuttx/net/uip/uip_igmptimer.c create mode 100644 nuttx/net/uip/uip_initialize.c create mode 100644 nuttx/net/uip/uip_input.c create mode 100644 nuttx/net/uip/uip_internal.h create mode 100644 nuttx/net/uip/uip_listen.c create mode 100644 nuttx/net/uip/uip_lock.c create mode 100755 nuttx/net/uip/uip_mcastmac.c create mode 100644 nuttx/net/uip/uip_neighbor.c create mode 100644 nuttx/net/uip/uip_neighbor.h create mode 100644 nuttx/net/uip/uip_poll.c create mode 100644 nuttx/net/uip/uip_send.c create mode 100644 nuttx/net/uip/uip_setipid.c create mode 100644 nuttx/net/uip/uip_tcpappsend.c create mode 100644 nuttx/net/uip/uip_tcpbacklog.c create mode 100644 nuttx/net/uip/uip_tcpcallback.c create mode 100644 nuttx/net/uip/uip_tcpconn.c create mode 100644 nuttx/net/uip/uip_tcpinput.c create mode 100644 nuttx/net/uip/uip_tcppoll.c create mode 100644 nuttx/net/uip/uip_tcpreadahead.c create mode 100644 nuttx/net/uip/uip_tcpsend.c create mode 100755 nuttx/net/uip/uip_tcpseqno.c create mode 100644 nuttx/net/uip/uip_tcptimer.c create mode 100644 nuttx/net/uip/uip_udpcallback.c create mode 100644 nuttx/net/uip/uip_udpconn.c create mode 100644 nuttx/net/uip/uip_udpinput.c create mode 100644 nuttx/net/uip/uip_udppoll.c create mode 100644 nuttx/net/uip/uip_udpsend.c create mode 100644 nuttx/sched/Makefile create mode 100644 nuttx/sched/atexit.c create mode 100644 nuttx/sched/clock_abstime2ticks.c create mode 100644 nuttx/sched/clock_getres.c create mode 100644 nuttx/sched/clock_gettime.c create mode 100644 nuttx/sched/clock_gettimeofday.c create mode 100644 nuttx/sched/clock_initialize.c create mode 100644 nuttx/sched/clock_internal.h create mode 100644 nuttx/sched/clock_settime.c create mode 100644 nuttx/sched/clock_systimer.c create mode 100644 nuttx/sched/clock_ticks2time.c create mode 100644 nuttx/sched/clock_time2ticks.c create mode 100644 nuttx/sched/env_clearenv.c create mode 100644 nuttx/sched/env_dup.c create mode 100644 nuttx/sched/env_dupenv.c create mode 100644 nuttx/sched/env_findvar.c create mode 100644 nuttx/sched/env_getenv.c create mode 100644 nuttx/sched/env_getenvironptr.c create mode 100644 nuttx/sched/env_internal.h create mode 100644 nuttx/sched/env_putenv.c create mode 100644 nuttx/sched/env_release.c create mode 100644 nuttx/sched/env_removevar.c create mode 100644 nuttx/sched/env_setenv.c create mode 100644 nuttx/sched/env_share.c create mode 100644 nuttx/sched/env_unsetenv.c create mode 100644 nuttx/sched/errno_get.c create mode 100644 nuttx/sched/errno_getptr.c create mode 100644 nuttx/sched/errno_set.c create mode 100644 nuttx/sched/exit.c create mode 100644 nuttx/sched/getpid.c create mode 100644 nuttx/sched/irq_attach.c create mode 100644 nuttx/sched/irq_dispatch.c create mode 100644 nuttx/sched/irq_initialize.c create mode 100644 nuttx/sched/irq_internal.h create mode 100644 nuttx/sched/irq_unexpectedisr.c create mode 100644 nuttx/sched/kmm_addregion.c create mode 100644 nuttx/sched/kmm_initialize.c create mode 100644 nuttx/sched/kmm_kfree.c create mode 100644 nuttx/sched/kmm_kmalloc.c create mode 100644 nuttx/sched/kmm_krealloc.c create mode 100644 nuttx/sched/kmm_kzalloc.c create mode 100644 nuttx/sched/kmm_semaphore.c create mode 100644 nuttx/sched/mq_close.c create mode 100644 nuttx/sched/mq_descreate.c create mode 100644 nuttx/sched/mq_findnamed.c create mode 100644 nuttx/sched/mq_initialize.c create mode 100644 nuttx/sched/mq_internal.h create mode 100644 nuttx/sched/mq_msgfree.c create mode 100644 nuttx/sched/mq_msgqfree.c create mode 100644 nuttx/sched/mq_notify.c create mode 100644 nuttx/sched/mq_open.c create mode 100644 nuttx/sched/mq_rcvinternal.c create mode 100644 nuttx/sched/mq_receive.c create mode 100644 nuttx/sched/mq_send.c create mode 100644 nuttx/sched/mq_sndinternal.c create mode 100644 nuttx/sched/mq_timedreceive.c create mode 100644 nuttx/sched/mq_timedsend.c create mode 100644 nuttx/sched/mq_unlink.c create mode 100644 nuttx/sched/mq_waitirq.c create mode 100644 nuttx/sched/os_bringup.c create mode 100644 nuttx/sched/os_internal.h create mode 100644 nuttx/sched/os_start.c create mode 100644 nuttx/sched/pg_internal.h create mode 100644 nuttx/sched/pg_miss.c create mode 100644 nuttx/sched/pg_worker.c create mode 100644 nuttx/sched/pthread_barrierdestroy.c create mode 100644 nuttx/sched/pthread_barrierinit.c create mode 100644 nuttx/sched/pthread_barrierwait.c create mode 100644 nuttx/sched/pthread_cancel.c create mode 100644 nuttx/sched/pthread_completejoin.c create mode 100644 nuttx/sched/pthread_condbroadcast.c create mode 100644 nuttx/sched/pthread_conddestroy.c create mode 100644 nuttx/sched/pthread_condinit.c create mode 100644 nuttx/sched/pthread_condsignal.c create mode 100644 nuttx/sched/pthread_condtimedwait.c create mode 100644 nuttx/sched/pthread_condwait.c create mode 100644 nuttx/sched/pthread_create.c create mode 100644 nuttx/sched/pthread_detach.c create mode 100644 nuttx/sched/pthread_exit.c create mode 100644 nuttx/sched/pthread_findjoininfo.c create mode 100644 nuttx/sched/pthread_getschedparam.c create mode 100644 nuttx/sched/pthread_getspecific.c create mode 100644 nuttx/sched/pthread_initialize.c create mode 100644 nuttx/sched/pthread_internal.h create mode 100644 nuttx/sched/pthread_join.c create mode 100644 nuttx/sched/pthread_keycreate.c create mode 100644 nuttx/sched/pthread_keydelete.c create mode 100644 nuttx/sched/pthread_kill.c create mode 100644 nuttx/sched/pthread_mutexdestroy.c create mode 100644 nuttx/sched/pthread_mutexinit.c create mode 100644 nuttx/sched/pthread_mutexlock.c create mode 100644 nuttx/sched/pthread_mutextrylock.c create mode 100644 nuttx/sched/pthread_mutexunlock.c create mode 100644 nuttx/sched/pthread_once.c create mode 100644 nuttx/sched/pthread_removejoininfo.c create mode 100644 nuttx/sched/pthread_setcancelstate.c create mode 100644 nuttx/sched/pthread_setschedparam.c create mode 100644 nuttx/sched/pthread_setschedprio.c create mode 100644 nuttx/sched/pthread_setspecific.c create mode 100644 nuttx/sched/pthread_sigmask.c create mode 100644 nuttx/sched/pthread_yield.c create mode 100644 nuttx/sched/sched_addblocked.c create mode 100644 nuttx/sched/sched_addprioritized.c create mode 100644 nuttx/sched/sched_addreadytorun.c create mode 100644 nuttx/sched/sched_foreach.c create mode 100644 nuttx/sched/sched_free.c create mode 100644 nuttx/sched/sched_garbage.c create mode 100644 nuttx/sched/sched_getfiles.c create mode 100644 nuttx/sched/sched_getparam.c create mode 100644 nuttx/sched/sched_getscheduler.c create mode 100644 nuttx/sched/sched_getsockets.c create mode 100644 nuttx/sched/sched_getstreams.c create mode 100644 nuttx/sched/sched_gettcb.c create mode 100644 nuttx/sched/sched_lock.c create mode 100644 nuttx/sched/sched_lockcount.c create mode 100644 nuttx/sched/sched_mergepending.c create mode 100644 nuttx/sched/sched_processtimer.c create mode 100644 nuttx/sched/sched_releasefiles.c create mode 100644 nuttx/sched/sched_releasetcb.c create mode 100644 nuttx/sched/sched_removeblocked.c create mode 100644 nuttx/sched/sched_removereadytorun.c create mode 100644 nuttx/sched/sched_reprioritize.c create mode 100644 nuttx/sched/sched_rrgetinterval.c create mode 100644 nuttx/sched/sched_self.c create mode 100644 nuttx/sched/sched_setparam.c create mode 100644 nuttx/sched/sched_setpriority.c create mode 100644 nuttx/sched/sched_setscheduler.c create mode 100644 nuttx/sched/sched_setupidlefiles.c create mode 100644 nuttx/sched/sched_setuppthreadfiles.c create mode 100644 nuttx/sched/sched_setupstreams.c create mode 100644 nuttx/sched/sched_setuptaskfiles.c create mode 100644 nuttx/sched/sched_unlock.c create mode 100644 nuttx/sched/sched_verifytcb.c create mode 100644 nuttx/sched/sched_waitpid.c create mode 100644 nuttx/sched/sched_yield.c create mode 100644 nuttx/sched/sem_close.c create mode 100644 nuttx/sched/sem_destroy.c create mode 100644 nuttx/sched/sem_findnamed.c create mode 100644 nuttx/sched/sem_holder.c create mode 100644 nuttx/sched/sem_initialize.c create mode 100644 nuttx/sched/sem_internal.h create mode 100644 nuttx/sched/sem_open.c create mode 100644 nuttx/sched/sem_post.c create mode 100644 nuttx/sched/sem_timedwait.c create mode 100644 nuttx/sched/sem_trywait.c create mode 100644 nuttx/sched/sem_unlink.c create mode 100644 nuttx/sched/sem_wait.c create mode 100644 nuttx/sched/sem_waitirq.c create mode 100644 nuttx/sched/sig_action.c create mode 100644 nuttx/sched/sig_allocatependingsigaction.c create mode 100644 nuttx/sched/sig_cleanup.c create mode 100644 nuttx/sched/sig_deliver.c create mode 100644 nuttx/sched/sig_findaction.c create mode 100644 nuttx/sched/sig_initialize.c create mode 100644 nuttx/sched/sig_internal.h create mode 100644 nuttx/sched/sig_kill.c create mode 100644 nuttx/sched/sig_lowest.c create mode 100644 nuttx/sched/sig_mqnotempty.c create mode 100644 nuttx/sched/sig_pending.c create mode 100644 nuttx/sched/sig_procmask.c create mode 100644 nuttx/sched/sig_queue.c create mode 100644 nuttx/sched/sig_received.c create mode 100644 nuttx/sched/sig_releasependingsigaction.c create mode 100644 nuttx/sched/sig_releasependingsignal.c create mode 100644 nuttx/sched/sig_removependingsignal.c create mode 100644 nuttx/sched/sig_suspend.c create mode 100644 nuttx/sched/sig_timedwait.c create mode 100644 nuttx/sched/sig_unmaskpendingsignal.c create mode 100644 nuttx/sched/sig_waitinfo.c create mode 100644 nuttx/sched/sleep.c create mode 100644 nuttx/sched/task_activate.c create mode 100644 nuttx/sched/task_create.c create mode 100644 nuttx/sched/task_delete.c create mode 100644 nuttx/sched/task_deletecurrent.c create mode 100644 nuttx/sched/task_exithook.c create mode 100644 nuttx/sched/task_init.c create mode 100644 nuttx/sched/task_restart.c create mode 100644 nuttx/sched/task_setup.c create mode 100644 nuttx/sched/task_start.c create mode 100644 nuttx/sched/timer_create.c create mode 100644 nuttx/sched/timer_delete.c create mode 100644 nuttx/sched/timer_getoverrun.c create mode 100644 nuttx/sched/timer_gettime.c create mode 100644 nuttx/sched/timer_initialize.c create mode 100644 nuttx/sched/timer_internal.h create mode 100644 nuttx/sched/timer_release.c create mode 100644 nuttx/sched/timer_settime.c create mode 100644 nuttx/sched/usleep.c create mode 100644 nuttx/sched/wd_cancel.c create mode 100644 nuttx/sched/wd_create.c create mode 100644 nuttx/sched/wd_delete.c create mode 100644 nuttx/sched/wd_gettime.c create mode 100644 nuttx/sched/wd_initialize.c create mode 100644 nuttx/sched/wd_internal.h create mode 100644 nuttx/sched/wd_start.c create mode 100644 nuttx/sched/work_cancel.c create mode 100644 nuttx/sched/work_internal.h create mode 100644 nuttx/sched/work_queue.c create mode 100644 nuttx/sched/work_thread.c create mode 100644 nuttx/syscall/Makefile create mode 100644 nuttx/syscall/README.txt create mode 100644 nuttx/syscall/proxies/Make.defs create mode 100644 nuttx/syscall/stub_lookup.c create mode 100644 nuttx/syscall/stub_lookup.h create mode 100644 nuttx/syscall/stubs/Make.defs create mode 100644 nuttx/syscall/syscall.csv create mode 100644 nuttx/tools/Makefile.export create mode 100644 nuttx/tools/Makefile.host create mode 100755 nuttx/tools/README.txt create mode 100644 nuttx/tools/bdf-converter.c create mode 100644 nuttx/tools/cfgparser.c create mode 100644 nuttx/tools/cfgparser.h create mode 100755 nuttx/tools/configure.sh create mode 100755 nuttx/tools/define.sh create mode 100755 nuttx/tools/incdir.sh create mode 100755 nuttx/tools/indent.sh create mode 100755 nuttx/tools/link.sh create mode 100644 nuttx/tools/mkconfig.c create mode 100755 nuttx/tools/mkdeps.sh create mode 100755 nuttx/tools/mkexport.sh create mode 100755 nuttx/tools/mkimage.sh create mode 100755 nuttx/tools/mknulldeps.sh create mode 100755 nuttx/tools/mkromfsimg.sh create mode 100644 nuttx/tools/mksyscall.c create mode 100644 nuttx/tools/mkversion.c create mode 100755 nuttx/tools/unlink.sh create mode 100755 nuttx/tools/version.sh create mode 100755 nuttx/tools/winlink.sh create mode 100755 nuttx/tools/zipme.sh diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt new file mode 100755 index 0000000000..fe8c057fe5 --- /dev/null +++ b/apps/ChangeLog.txt @@ -0,0 +1,148 @@ +5.19 2011-03-12 Gregory Nutt + + * Initial version of the apps/ directory was released as contributed by + Uros Platise. + +6.0 2011-03-21 Gregory Nutt + + * README.txt -- README cosmetics + * hello/ -- hello world minor changes + * Makefile -- Makefile cosmetics (I am slowly adding the Darjeeling JVM) + * Make.defs -- New file adds common make definitions for applications. + * hello/Makefile -- Now uses new Make.defs definitions. Added README.txt. + * apps/poweroff -- New application to turn off board power. + * Moved NSH library, netutils, and examples from the nuttx/ directory to + the apps/ directory + * Moved exec_nuttapp machinery into the nuttapp/ directory. + +6.1 2011-04-10 Gregory Nutt + + * Creation of auto-generated header files now occurs during the context + build phase. + * Added sdcard insert and eject, nsh command '?' and some code remarks + * Renamed nuttapp to namedapp + * namedapp/binfs.c -- Create a tiny filesystem that can be used + to show the internal named apps under /bin. + * Numerous fixes to build system required to support building with native + Windows toolchain. + +6.2 2011-05-06 Gregory Nutt + + * apps/examples/nxffs: Add a test a a configuration that will be used to + verify NXFFS. + +6.3 2011-05-15 Gregory Nutt + + * apps/interpreter: Add a directory to hold interpreters. The Pascal add- + on module now installs and builds under this directory. + * apps/interpreter/ficl: Added logic to build Ficl (the "Forth Inspired + Command Language"). See http://ficl.sourceforge.net/. + * apps/netutils/dhcpc, dhcpcd, and tftp. If these directories are included + in the configuration but CONFIG_NET_UDP is disable (which is not very wise), + then a make error occurs because tools/mkdep.sh is called with no files. + * system/free: Move Uros' custom free command from vsn/free + * system/install: Add a new install command submitted by Uros Platise. + * examples/rgmp. Add a placeholder for an RGMP build example. + RGMP is a project for running GPOS and RTOS simultaneously on + multi-processor platforms. See http://rgmp.sourceforge.net/wiki/index.php/Main_Page + for further information about RGMP. NOTE: This is an empty example + on initial check-in. + +6.4 2011-06-06 Gregory Nutt + + * nshlib/nsh_netcmds.c: If a network device name and IP address are provided + with the ifconfig command, then this command will now set the network address. + (Contributed by Yu Qiang). + * netutils/ftpc: A library to support client-side FTP. + * examples/ftpc: A simple add-on to the NSH. From NSH, you can start + this simple FTP shell to transfer files to/from a remote FTP server. + +6.5 2011-06-21 Gregory Nutt + + * netutils/ftpc: Simpflication and size reduction. + +6.6 2011-07-11 Gregory Nutt + + * Make.defs, namedapp/namedapp.c: Several structural changes made to get a + clean compile under the ez80 ZDS-II toolchain (no design changes). + * apps/examples/buttons: Add a test for the new standardized button interfaces + * apps/examples/nxtext: Add another NX graphics test. This one focus on + placing text on the background while pop-up windows occur. Text should + continue to update normally with or without the popup windows present. + +6.7 2011-08-02 Gregory Nutt + + * apps/examples/nx and nxtext: These examples can now be built as NSH + "built-in" commands. + * apps/examples/nxhello: The simplest graphics example: It just says + "Hello, World!" in the center of the display. This example can also be + built as an NSH "built-in" command. + * apps/examples/nx, ntext, and nxhello: All updated to use the new + NuttX font interfaces. + * apps/examples/nximage: Another super simple graphics example: It just puts + the NuttX logo in the center of the display. This example can also be + built as an NSH "built-in" command. + * apps/examples/usbstorage: Can now be built as two NSH "built-in" commands: + 'msconn' will connect the USB mass storage device; 'msdis' will disconnect + the USB storage device. + * apps/examples/nx*: All NX header files moved from nuttx/include/nuttx to + nuttx/include/nuttx/nx. + * apps/examples/usbstorage: Added instrumentation to monitor memory usage + to check for memory leaks in the USB storage driver. + * apps/examples/nxhello/nxhello_bkgd.c: Fix handling of allocated glyph + memory. + +6.8 2011-08-11 Gregory Nutt + + * apps/examples/nxlines: Added a test for NX line drawing capabilities. + +6.9 2011-09-11 Gregory Nutt + + * apps/examples/nxlines: Extend the line drawing text to include drawing + of circles. + * apps/system/i2c: Add an I2C test tool that should help to bring up I2C + devices (when it is fully functional). + * apps/nshlib/nsh_timcmds.c: Add the date command that can be used to + show or set the time (only if CONFIG_RTC is set). + +6.10 2011-10-06 Gregory Nutt + + * apps/system/i2c: Add repitition and address auto-incrementing so that + and command can be executed numerous times. Add a new verify command + that will write to a register, read from register, and verify that + returned value. + * apps/graphics/tiff: Add a library that can be used to create TIFF files. + * apps/examples/tiff: Add a unit test for the TIFF file creation logic + * apps/examples/lcdrw: Add a test to verify if you can or can or read + data from an LCD correctly. + * apps/examples/usbterm: A USB terminal example.. more of a USB chat or + serial bridge: Data received on local console echoed via USB serial; + data received on USB serial is echoed on the local console. + * apps/examples/touchscreen: Add a simple, generic test for any + touschscreen driver. + * Makefile: The apps/ Makefile now checks for an apps/external directory + or symbolic link. If such a directory/link exists (and has a Makefile), + it will be added to the apps/ build. This allows external directories + to be included into the apps/ build by simply creating a symbolic link. + +6.11 2011-11-12 Gregory Nutt + + (No major changes from 6.10) + +6.12 2011-12-06 Gregory Nutt + + * apps/examples/buttons: The button test can now be executed as an NSH + built in command. + +6.13 2012-xx-xx Gregory Nutt + + * apps/examples/dhcpd: May now be built as an NSH built-in application + by setting CONFIG_NSH_BUILTIN_APPS. + * apps/netutils/dhcpd/dhcpd.c: Fix several problems using host order address + where network addresses expected (and vice versa). + * apps/examples/nettest: May now be built as an NSH built-in application + by setting CONFIG_NSH_BUILTIN_APPS. + * apps/examples/nettest: Correct some build issues with the nettest is + built for performance evaluation. + * apps/examples/adc: Add a very simple test to drive and test an ADC + driver. diff --git a/apps/Make.defs b/apps/Make.defs new file mode 100755 index 0000000000..f37a654c47 --- /dev/null +++ b/apps/Make.defs @@ -0,0 +1,41 @@ +############################################################################ +# apps/Make.defs +# Common make definitions provided to all applications +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +define REGISTER + @echo "Register: $1" + @echo "{ \"$1\", $2, $3, $4 }," >> "$(APPDIR)/namedapp/namedapp_list.h" + @echo "EXTERN int $4(int argc, char *argv[]);" >> "$(APPDIR)/namedapp/namedapp_proto.h" +endef diff --git a/apps/Makefile b/apps/Makefile new file mode 100644 index 0000000000..f73f0eaac2 --- /dev/null +++ b/apps/Makefile @@ -0,0 +1,132 @@ +############################################################################ +# apps/Makefile +# +# Copyright (C) 2011 Uros Platise. All rights reserved. +# Authors: Uros Platise +# Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/Make.defs + +APPDIR = ${shell pwd} + +# Application Directories + +# CONFIGURED_APPS is the list of all configured built-in directories/built +# action. It is created by the configured appconfig file (a copy of which +# appears in this directory as .config) +# SUBDIRS is the list of all directories containing Makefiles. It is used +# only for cleaning. namedapp must always be the first in the list. This +# list can be extended by the .config file as well + +CONFIGURED_APPS = +SUBDIRS = examples graphics interpreters namedapp nshlib netutils system vsn + +-include .config + +# INSTALLED_APPS is the list of currently available application directories. It +# is the same as CONFIGURED_APPS, but filtered to exclude any non-existent +# application directory. namedapp is always in the list of applications to be +# built. + +INSTALLED_APPS = namedapp + +# Create the list of available applications (INSTALLED_APPS) + +define ADD_BUILTIN +INSTALLED_APPS += ${shell if [ -r $1/Makefile ]; then echo "$1"; fi} +endef + +$(foreach BUILTIN, $(CONFIGURED_APPS), $(eval $(call ADD_BUILTIN,$(BUILTIN)))) + +# The external/ directory may also be added to the INSTALLED_APPS. But there +# is no external/ directory in the repository. Rather, this directory may be +# provided by the user (possibly as a symbolic link) to add libraries and +# applications to the standard build from the repository. + +INSTALLED_APPS += ${shell if [ -r external/Makefile ]; then echo "external"; fi} +SUBDIRS += ${shell if [ -r external/Makefile ]; then echo "external"; fi} + +# The final build target + +BIN = libapps$(LIBEXT) + +# Build targets + +all: $(BIN) +.PHONY: $(INSTALLED_APPS) context depend clean distclean + +$(INSTALLED_APPS): + @$(MAKE) -C $@ TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; + +$(BIN): $(INSTALLED_APPS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $@, $${obj}); \ + done ; ) + +.context: + @for dir in $(INSTALLED_APPS) ; do \ + rm -f $$dir/.context ; \ + $(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" context ; \ + done + @touch $@ + +context: .context + +.depend: context Makefile $(SRCS) + @for dir in $(INSTALLED_APPS) ; do \ + rm -f $$dir/.depend ; \ + $(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" depend ; \ + done + @touch $@ + +depend: .depend + +clean: + @for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done + @rm -f $(BIN) *~ .*.swp *.o + $(call CLEAN) + +distclean: clean + @for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done + @rm -f .config .context .depend + @( if [ -e external ]; then \ + echo "********************************************************"; \ + echo "* The external directory/link must be removed manually *"; \ + echo "********************************************************"; \ + fi; \ + ) + + diff --git a/apps/README.txt b/apps/README.txt new file mode 100644 index 0000000000..f1fb124c45 --- /dev/null +++ b/apps/README.txt @@ -0,0 +1,146 @@ +Application Folder +================== + +Contents +-------- + + General + Directory Location + Named Applications + Named Startup main() function + NuttShell (NSH) Built-In Commands + Synchronous Built-In Commands + Application Configuration File + Example Named Application + +General +------- +This folder provides various applications found in sub-directories. These +applications are not inherently a part of NuttX but are provided you help +you develop your own applications. The apps/ directory is a "break away" +part of the configuration that you may chose to use or not. + +Directory Location +------------------ +The default application directory used by the NuttX build should be named +apps/ (or apps-x.y/ where x.y is the NuttX version number). This apps/ +directoy should appear in the directory tree at the same level as the +NuttX directory. Like: + + . + |- nuttx + | + `- apps + +If all of the above conditions are TRUE, then NuttX will be able to +find the application directory. If your application directory has a +different name or is location at a different position, then you will +have to inform the NuttX build system of that location. There are several +ways to do that: + +1) You can define CONFIG_APPS_DIR to be the full path to your application + directory in the NuttX configuration file. +2) You can provide the path to the application directory on the command line + like: make APPDIR= or make CONFIG_APPS_DIR= +3) When you configure NuttX using tools/configure.sh, you can provide that + path to the application directory on the configuration command line + like: ./configure.sh -a / + +Named Applications +------------------ +NuttX also supports applications that can be started using a name string. +In this case, zpplication entry points with their requirements are gathered +together in two files: + + - namedapp/namedapp_proto.h Entry points, prototype function + - namedapp/namedapp_list.h Application specific information and requirements + +The build occurs in several phases as different build targets are executed: +(1) context, (2) depend, and (3) default (all). Application information is +collected during the make context build phase. + +To execute an application function: + + exec_namedapp() is defined in the nuttx/include/apps/apps.h + +NuttShell (NSH) Built-In Commands +--------------------------------- +One use of named applications is to provide a way of invoking your custom +application through the NuttShell (NSH) command line. NSH will support +a seamless method invoking the applications, when the following option is +enabled in the NuttX configuration file: + + CONFIG_NSH_BUILTIN_APPS=y + +Applications registered in the apps/namedapp/namedapp_list.h file will then +be accessible from the NSH command line. If you type 'help' at the NSH +prompt, you will see a list of the registered commands. + +Synchronous Built-In Commands +----------------------------- +By default, built-in commands started from the NSH command line will run +asynchronously with NSH. If you want to force NSH to execute commands +then wait for the command to execute, you can enable that feature by +adding the following to the NuttX configuration file: + +CONFIG_SCHED_WAITPID=y + +The configuration option enables support for the waitpid() RTOS interface. +When that interface is enabled, NSH will use it to wait, sleeping until +the built-in command executes to completion. + +Of course, even with CONFIG_SCHED_WAITPID=y defined, specific commands +can still be forced to run asynchronously by adding the ampersand (&) +after the NSH command. + +Application Configuration File +------------------------------ +A special configuration file is used to configure which applications +are to be included in the build. The source for this file is +configs///appconfig. The existence of the appconfig +file in the board configuration directory is sufficient to enable building +of applications. + +The appconfig file is copied into the apps/ directory as .config when +NuttX is configured. .config is included in the toplevel apps/Makefile. +As a minimum, this configuration file must define files to add to the +CONFIGURED_APPS list like: + + CONFIGURED_APPS += vsn/hello vsn/poweroff vsn/jvm + +Named Start-Up main() function +------------------------------ +A named application can even be used as the main, start-up entry point +into your embedded software. When the user defines this option in +the NuttX configuration file: + + CONFIG_BUILTIN_APP_START= + +that application shall be invoked immediately after system starts +*instead* of the normal, default "user_start" entry point. +Note that must be provided as: "hello", +will call: + + int hello_main(int argc, char *argv[]) + +Example Named Application +------------------------- +An example application skeleton can be found under the vsn/hello +sub-directory. This example shows how a named application can be added +to the project. One must define: + + 1. create sub-directory as: appname + 2. provide entry point: appname_main() + 3. set the requirements in the file: Makefile, specially the lines: + + APPNAME = appname + PRIORITY = SCHED_PRIORITY_DEFAULT + STACKSIZE = 768 + ASRCS = asm source file list as a.asm b.asm ... + CSRCS = C source file list as foo1.c foo2.c .. + + 4. add application in the apps/.config + + + + diff --git a/apps/examples/Makefile b/apps/examples/Makefile new file mode 100644 index 0000000000..d549fe28e5 --- /dev/null +++ b/apps/examples/Makefile @@ -0,0 +1,118 @@ +############################################################################ +# apps/examples/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config # Current configuration + +# Sub-directories + +SUBDIRS = adc buttons dhcpd ftpc hello helloxx hidkbd igmp lcdrw mm mount \ + nettest nsh null nx nxffs nxflat nxhello nximage nxlines \ + nxtext ostest pashello pipe poll rgmp romfs sendmail serloop \ + thttpd tiff touchscreen udp uip usbserial usbstorage usbterm wget wlan + +# Sub-directories that might need context setup + +CNTXTDIRS = + +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +CNTXTDIRS += adc +endif +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +CNTXTDIRS += dhcpd +endif +ifeq ($(CONFIG_EXAMPLES_HELLOXX_BUILTIN),y) +CNTXTDIRS += helloxx +endif +ifeq ($(CONFIG_EXAMPLES_LCDRW_BUILTIN),y) +CNTXTDIRS += lcdrw +endif +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +CNTXTDIRS += nettest +endif +ifeq ($(CONFIG_EXAMPLES_NX_BUILTIN),y) +CNTXTDIRS += nx +endif +ifeq ($(CONFIG_EXAMPLES_NXHELLO_BUILTIN),y) +CNTXTDIRS += nxhello +endif +ifeq ($(CONFIG_EXAMPLES_NXIMAGE_BUILTIN),y) +CNTXTDIRS += nximage +endif +ifeq ($(CONFIG_EXAMPLES_LINES_BUILTIN),y) +CNTXTDIRS += nxlines +endif +ifeq ($(CONFIG_EXAMPLES_NXTEXT_BUILTIN),y) +CNTXTDIRS += nxtext +endif +ifeq ($(CONFIG_EXAMPLES_TIFF_BUILTIN),y) +CNTXTDIRS += tiff +endif +ifeq ($(CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN),y) +CNTXTDIRS += touchscreen +endif +ifeq ($(CONFIG_EXAMPLES_USBSTRG_BUILTIN),y) +CNTXTDIRS += usbstorage +endif +ifeq ($(CONFIG_EXAMPLES_USBTERM_BUILTIN),y) +CNTXTDIRS += usbterm +endif + +all: nothing +.PHONY: nothing context depend clean distclean + +nothing: + +context: + @for dir in $(CNTXTDIRS) ; do \ + $(MAKE) -C $$dir context TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done + +depend: + @for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done + +clean: + @for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done + +distclean: clean + @for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done + +-include Make.dep + diff --git a/apps/examples/README.txt b/apps/examples/README.txt new file mode 100644 index 0000000000..4460e2c667 --- /dev/null +++ b/apps/examples/README.txt @@ -0,0 +1,1140 @@ +examples +^^^^^^^^ + + appconfig and CONFIG_APPS + + The examples directory contains several sample applications that + can be linked with NuttX. The specific example is selected in the + configs//appconfig file via the CONFIGURED_APPS setting. + This setting provides the path to the directory containing the + application Makefile (this path is a relative to the apps/ top- + level directory). For example, + + CONFIGURE_APPS += examples/ostest + + Selects the examples/ostest example. + + Built-In functions + + Some of the examples may be built as "built-in" functions that + can be executed at run time (rather than as NuttX "main" programs). + These "built-in" examples can be also be executed from the NuttShell + (NSH) command line. In order to configure these built-in NSH + functions, you have to set up the following: + + - CONFIG_NSH_BUILTIN_APPS - Enable support for external registered, + "named" applications that can be executed from the NSH + command line (see apps/README.txt for more information). + - CONFIG_EXAMPLES_XYZ_BUILTIN -- Build the XYZ example as a "built-in" + that can be executed from the NSH command line (where XYZ is + the specific example. See the following for examples that + support this option). + +examples/adc +^^^^^^^^^^^^ + + A mindlessly simple test of an ADC devices. It simply reads from the + ADC device and dumps the data to the console forever. + + - CONFIG_NSH_BUILTIN_APPS - Build the ADC test as an NSH built-in function. + Default: Built as a standalone problem + - CONFIG_EXAMPLES_ADC_DEVPATH - The path to the ADC device. Default: /dev/adc0 + - CONFIG_EXAMPLES_ADC_NSAMPLES - If CONFIG_NSH_BUILTIN_APPS + is defined, then the number of samples is provided on the command line + and this value is ignored. Otherwise, this number of samples is + collected and the program terminates. Default: Samples are collected + indefinitely. + - CONFIG_EXAMPLES_ADC_GROUPSIZE - The number of samples to read at once. + Default: 4 + +examples/buttons +^^^^^^^^^^^^^^^^ + + This is a simple configuration that may be used to test the board- + specific button interfaces. Configuration options: + + CONFIG_ARCH_BUTTONS - Must be defined for button support + CONFIG_EXAMPLE_BUTTONS_MIN - Lowest button number (MIN=0) + CONFIG_EXAMPLE_BUTTONS_MAX - Highest button number (MAX=7) + + CONFIG_ARCH_IRQBUTTONS - Must be defined for interrupting button support + CONFIG_EXAMPLE_IRQBUTTONS_MIN - Lowest interrupting button number (MIN=0) + CONFIG_EXAMPLE_IRQBUTTONS_MAX - Highest interrupting button number (MAX=7) + + Name strings for buttons: + + CONFIG_EXAMPLE_BUTTONS_NAME0, CONFIG_EXAMPLE_BUTTONS_NAME1, + CONFIG_EXAMPLE_BUTTONS_NAME2, CONFIG_EXAMPLE_BUTTONS_NAME3, + CONFIG_EXAMPLE_BUTTONS_NAME4, CONFIG_EXAMPLE_BUTTONS_NAME5, + CONFIG_EXAMPLE_BUTTONS_NAME6, CONFIG_EXAMPLE_BUTTONS_NAME7, + + Additional architecture-/board- specific configuration settings may also + be required. + + NOTE: This test exercises internal button driver interfaces. As such, it + relies on internal OS interfaces that are not normally available to a + user-space program. As a result, this example cannot be used if a + NuttX is built as a protected, supervisor kernel (CONFIG_NUTTX_KERNEL). + +examples/dhcpd +^^^^^^^^^^^^^^ + + This examples builds a tiny DCHP server for the target system. + + NOTE: For test purposes, this example can be built as a + host-based DHCPD server. This can be built as follows: + + cd examples/dhcpd + make -f Makefile.host TOPDIR= + + NuttX configuration settings: + + CONFIG_NET=y - Of course + CONFIG_NSOCKET_DESCRIPTORS - And, of course, you must allocate some + socket descriptors. + CONFIG_NET_UDP=y - UDP support is required for DHCP + (as well as various other UDP-related + configuration settings) + CONFIG_NET_BROADCAST=y - UDP broadcast support is needed. + + CONFIG_EXAMPLE_DHCPD_NOMAC - (May be defined to use software assigned MAC) + CONFIG_EXAMPLE_DHCPD_IPADDR - Target IP address + CONFIG_EXAMPLE_DHCPD_DRIPADDR - Default router IP addess + CONFIG_EXAMPLE_DHCPD_NETMASK - Network mask + + See also CONFIG_NETUTILS_DHCPD_* settings described elsewhere + and used in netutils/dhcpd/dhcpd.c. These settings are required + to described the behavior of the daemon. + + Applications using this example will need to provide an appconfig + file in the configuration driver with instruction to build applications + like: + + CONFIGURED_APPS += uiplib + +examples/ftpc +^^^^^^^^^^^^^ + + This is a simple FTP client shell used to exercise the capabilities + of the FTPC library (apps/netutils/ftpc). This example is configured + to that it will only work as a "built-in" program that can be run from + NSH when CONFIG_NSH_BUILTIN_APPS is defined. + + From NSH, the startup command sequence is as follows. This is only + an example, your configration could have different mass storage devices, + mount paths, and FTP directories: + + nsh> mount -t vfat /dev/mmcsd0 /tmp # Mount the SD card at /tmp + nsh> cd /tmp # cd into the /tmp directory + nsh> ftpc xx.xx.xx.xx[:pp] # Start the FTP client + nfc> login # Log into the FTP server + nfc> help # See a list of FTP commands + + where xx.xx.xx.xx is the IP address of the FTP server and pp is an + optional port number. + + NOTE: The ftpc task uses the system console for input/output. It will + not work from NSH over a telnet NSH connection (Well, it will work you + just won't be able to access the command line). + + You may also want to define the following in your configuration file. + Otherwise, you will have not feeback about what is going on: + + CONFIG_DEBUG=y + CONFIG_DEBUG_VERBOSE=y + CONFIG_DEBUG_FTPC=y + +examples/hello +^^^^^^^^^^^^^^ + + This is the mandatory, "Hello, World!!" example. It is little more + than examples/null with a single printf statement. Really useful only + for bringing up new NuttX architectures. + +examples/helloxx +^^^^^^^^^^^^^^^^ + + This is C++ version of the "Hello, World!!" example. It is intended + only to verify that the C++ compiler is functional, that basic C++ + library suupport is available, and that class are instantiated + correctly. + + NuttX configuration settings: + + CONFIG_EXAMPLES_HELLOXX_BUILTIN -- Build the helloxx example as a + "built-in" that can be executed from the NSH command line. + CONFIG_EXAMPLES_HELLOXX_NOSTATICCONST - Set if system does not support + static constructors. + CONFIG_EXAMPLES_HELLOXX_NOSTACKCONST - Set if the system does not + support construction of objects on the stack. + + Also needed: + + CONFIG_HAVE_CXX=y + + And you may have to tinker with the following to get libxx to compile + properly: + + CONFIG_CXX_NEWLONG=y or =n + + The argument of the 'new' operators should take a type of size_t. But size_t + has an unknown underlying. In the nuttx sys/types.h header file, size_t + is typed as uint32_t (which is determined by architecture-specific logic). + But the C++ compiler may believe that size_t is of a different type resulting + in compilation errors in the operator. Using the underlying integer type + Instead of size_t seems to resolve the compilation issues. + +examples/hidkbd +^^^^^^^^^^^^^^^^ + + This is a simple test to debug/verify the USB host HID keyboard class + driver. + + CONFIG_EXAMPLES_HIDKBD_DEFPRIO - Priority of "waiter" thread. + CONFIG_EXAMPLES_HIDKBD_STACKSIZE - Stacksize of "waiter" thread. + +examples/igmp +^^^^^^^^^^^^^ + + This is a trivial test of the NuttX IGMP capability. It present it + does not do much of value -- Much more is needed in order to verify + the IGMP features! + + * CONFIG_EXAMPLE_IGMP_NOMAC + Set if the hardware has no MAC address; one will be assigned + * CONFIG_EXAMPLE_IGMP_IPADDR + Target board IP address + * CONFIG_EXAMPLE_IGMP_DRIPADDR + Default router address + * CONFIG_EXAMPLE_IGMP_NETMASK + Network mask + * CONFIG_EXAMPLE_IGMP_GRPADDR + Multicast group address + + Applications using this example will need to provide an appconfig + file in the configuration driver with instruction to build applications + like: + + CONFIGURED_APPS += uiplib + +examples/lcdrw +^^^^^^^^^^^^^^ + + This example may be used to verify if you can or cannot read data + correct from an LCD interface. At present, this supports only LCDs + with RGB565 color format. + +examples/mm +^^^^^^^^^^^ + + This is a simplified version of the "built-in" memory manager test of + mm/mm_test.c. It is simplified because it does not have access to the + internals of the memory manager as does mm/mm_test.c, but it has the + advantage that it runs in the actual NuttX tasking environment (the + mm/mm_test.c only runs in a PC simulation environment). + +examples/mount +^^^^^^^^^^^^^^ + + This contains a simple test of filesystem mountpoints. + + * CONFIG_EXAMPLES_MOUNT_DEVNAME + The name of the user-provided block device to mount. + If CONFIG_EXAMPLES_MOUNT_DEVNAME is not provided, then + a RAM disk will be configured. + + * CONFIG_EXAMPLES_MOUNT_NSECTORS + The number of "sectors" in the RAM disk used when + CONFIG_EXAMPLES_MOUNT_DEVNAME is not defined. + + * CONFIG_EXAMPLES_MOUNT_SECTORSIZE + The size of each sectors in the RAM disk used when + CONFIG_EXAMPLES_MOUNT_DEVNAME is not defined. + + * CONFIG_EXAMPLES_MOUNT_RAMDEVNO + The RAM device minor number used to mount the RAM disk used + when CONFIG_EXAMPLES_MOUNT_DEVNAME is not defined. The + default is zero (meaning that "/dev/ram0" will be used). + +examples/netttest +^^^^^^^^^^^^^^^^^ + + This is a simple network test for verifying client- and server- + functionality in a TCP/IP connection. + + Applications using this example will need to provide an appconfig + file in the configuration driver with instruction to build applications + like: + + CONFIGURED_APPS += uiplib + +examples/nsh +^^^^^^^^^^^^ + + This directory provides an example of how to configure and use + the NuttShell (NSH) application. NSH is a simple shell + application. NSH is described in its own README located at + apps/nshlib/README.txt + + Applications using this example will need to provide an appconfig + file in the configuration driver with instruction to build applications + like: + + CONFIGURED_APPS += nshlib + + And if networking is included: + + CONFIGURED_APPS += uiplib + CONFIGURED_APPS += dhcpc + CONFIGURED_APPS += resolv + CONFIGURED_APPS += tftp + CONFIGURED_APPS += webclient + +examples/nx +^^^^^^^^^^^ + + This directory contains a simple test of a subset of the NX APIs + defined in include/nuttx/nx/nx.h. The following configuration options + can be selected: + + CONFIG_EXAMPLES_NX_BUILTIN -- Build the NX example as a "built-in" + that can be executed from the NSH command line + CONFIG_EXAMPLES_NX_VPLANE -- The plane to select from the frame- + buffer driver for use in the test. Default: 0 + CONFIG_EXAMPLES_NX_DEVNO - The LCD device to select from the LCD + driver for use in the test: Default: 0 + CONFIG_EXAMPLES_NX_BGCOLOR -- The color of the background. Default depends on + CONFIG_EXAMPLES_NX_BPP. + CONFIG_EXAMPLES_NX_COLOR1 -- The color of window 1. Default depends on + CONFIG_EXAMPLES_NX_BPP. + CONFIG_EXAMPLES_NX_COLOR2 -- The color of window 2. Default depends on + CONFIG_EXAMPLES_NX_BPP. + CONFIG_EXAMPLES_NX_TBCOLOR -- The color of the toolbar. Default depends on + CONFIG_EXAMPLES_NX_BPP. + CONFIG_EXAMPLES_NX_FONTID - Selects the font (see font ID numbers in + include/nuttx/nx/nxfonts.h) + CONFIG_EXAMPLES_NX_FONTCOLOR -- The color of the fonts. Default depends on + CONFIG_EXAMPLES_NX_BPP. + CONFIG_EXAMPLES_NX_BPP -- Pixels per pixel to use. Valid options + include 2, 4, 8, 16, 24, and 32. Default is 32. + CONFIG_EXAMPLES_NX_RAWWINDOWS -- Use raw windows; Default is to + use pretty, framed NXTK windows with toolbars. + CONFIG_EXAMPLES_NX_EXTERNINIT - The driver for the graphics device on + this platform requires some unusual initialization. This is the + for, for example, SPI LCD/OLED devices. If this configuration is + selected, then the platform code must provide an LCD initialization + function with a prototype like: + + #ifdef CONFIG_NX_LCDDRIVER + FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno); + #else + FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno); + #endif + + This test can be performed with either the single-user version of + NX or with the multiple user version of NX selected with CONFIG_NX_MULTIUSER. + If CONFIG_NX_MULTIUSER is defined, then the following configuration + options also apply: + + CONFIG_EXAMPLES_NX_STACKSIZE -- The stacksize to use when creating + the NX server. Default 2048 + CONFIG_EXAMPLES_NX_CLIENTPRIO -- The client priority. Default: 100 + CONFIG_EXAMPLES_NX_SERVERPRIO -- The server priority. Default: 120 + CONFIG_EXAMPLES_NX_LISTENERPRIO -- The priority of the event listener + thread. Default 80. + CONFIG_EXAMPLES_NX_NOTIFYSIGNO -- The signal number to use with + nx_eventnotify(). Default: 4 + + If CONFIG_NX_MULTIUSER is defined, then the example also expects the + following settings and will generate an error if they are not as expected: + + CONFIG_DISABLE_MQUEUE=n + CONFIG_DISABLE_SIGNALS=n + CONFIG_DISABLE_PTHREAD=n + CONFIG_NX_BLOCKING=y + +examples/nxffs +^^^^^^^^^^^^^^ + + This is a test of the NuttX NXFFS FLASH file system. This is an NXFFS + stress test and beats on the file system very hard. It should only + be used in a simulation environment! Putting this NXFFS test on real + hardware will most likely destroy your FLASH. You have been warned. + +examples/nxflat +^^^^^^^^^^^^^^^ + + This example builds a small NXFLAT test case. This includes several + test programs under examples/nxflat tests. These tests are build using + the NXFLAT format and installed in a ROMFS file system. At run time, + each program in the ROMFS file system is executed. Requires CONFIG_NXFLAT. + +examplex/nxhello +^^^^^^^^^^^^^^^^ + + A very simple graphics example that just says "Hello, World!" in the + center of the display. + + The following configuration options can be selected: + + CONFIG_EXAMPLES_NXHELLO_BUILTIN -- Build the NXHELLO example as a "built-in" + that can be executed from the NSH command line + CONFIG_EXAMPLES_NXHELLO_VPLANE -- The plane to select from the frame- + buffer driver for use in the test. Default: 0 + CONFIG_EXAMPLES_NXHELLO_DEVNO - The LCD device to select from the LCD + driver for use in the test: Default: 0 + CONFIG_EXAMPLES_NXHELLO_BGCOLOR -- The color of the background. Default + depends on CONFIG_EXAMPLES_NXHELLO_BPP. + CONFIG_EXAMPLES_NXHELLO_FONTID - Selects the font (see font ID numbers in + include/nuttx/nx/nxfonts.h) + CONFIG_EXAMPLES_NXHELLO_FONTCOLOR -- The color of the fonts used in the + background window. Default depends on CONFIG_EXAMPLES_NXHELLO_BPP. + CONFIG_EXAMPLES_NXHELLO_BPP -- Pixels per pixel to use. Valid options + include 2, 4, 8, 16, 24, and 32. Default is 32. + CONFIG_EXAMPLES_NXHELLO_EXTERNINIT - The driver for the graphics device on + this platform requires some unusual initialization. This is the + for, for example, SPI LCD/OLED devices. If this configuration is + selected, then the platform code must provide an LCD initialization + function with a prototype like: + + #ifdef CONFIG_NX_LCDDRIVER + FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno); + #else + FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno); + #endif + +examples/nximage +^^^^^^^^^^^^^^^^ + + This is a simple example that just puts the NuttX logo image in the center + of the display. This only works for RGB23 (888), RGB16 (656), RGB8 (332), + and 8-bit greyscale for now. + + CONFIG_EXAMPLES_NXIMAGE_BUILTIN -- Build the NXIMAGE example as a "built-in" + that can be executed from the NSH command line + CONFIG_EXAMPLES_NXIMAGE_VPLANE -- The plane to select from the frame- + buffer driver for use in the test. Default: 0 + CONFIG_EXAMPLES_NXIMAGE_DEVNO - The LCD device to select from the LCD + driver for use in the test: Default: 0 + CONFIG_EXAMPLES_NXIMAGE_BPP -- Pixels per pixel to use. Valid options + include 8, 16, and 24. Default is 16. + CONFIG_EXAMPLES_NXIMAGE_XSCALEp5, CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5, + CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0 -- The logo image width is 160 columns. + One of these may be defined to rescale the image horizontally by .5, 1.5, + or 2.0. + CONFIG_EXAMPLES_NXIMAGE_YSCALEp5, CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5, + CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0 -- The logo image height is 160 rows. + One of these may be defined to rescale the image vertically by .5, 1.5, + or 2.0. + CONFIG_EXAMPLES_NXIMAGE_GREYSCALE -- Grey scale image. Default: RGB. + CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT - The driver for the graphics device on + this platform requires some unusual initialization. This is the + for, for example, SPI LCD/OLED devices. If this configuration is + selected, then the platform code must provide an LCD initialization + function with a prototype like: + + #ifdef CONFIG_NX_LCDDRIVER + FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno); + #else + FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno); + #endif + + How was that run-length encoded image produced? + + a. I used GIMP output the image as a .c file. + b. I added som C logic to palette-ize the RGB image in the GIMP .c file + c. Then I add some simple run-length encoding to palette-ized image. + + NOTE: As of this writing, most of the pixel depth, scaling options, and + combinations thereof have not been tested. + +examplex/nxlines +^^^^^^^^^^^^^^^^ + + A very simple graphics example that just exercised the NX line drawing + logic. + + The following configuration options can be selected: + + CONFIG_EXAMPLES_NXLINES_BUILTIN -- Build the NXLINES example as a "built-in" + that can be executed from the NSH command line + CONFIG_EXAMPLES_NXLINES_VPLANE -- The plane to select from the frame- + buffer driver for use in the test. Default: 0 + CONFIG_EXAMPLES_NXLINES_DEVNO - The LCD device to select from the LCD + driver for use in the test: Default: 0 + CONFIG_EXAMPLES_NXLINES_BGCOLOR -- The color of the background. Default + depends on CONFIG_EXAMPLES_NXLINES_BPP. + CONFIG_EXAMPLES_NXLINES_LINEWIDTH - Selects the width of the lines in + pixels (default: 16) + CONFIG_EXAMPLES_NXLINES_LINECOLOR -- The color of the central lines drawn + in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP + (there really is no meaningful default). + CONFIG_EXAMPLES_NXLINES_BORDERWIDTH -- The width of the circular border + drawn in the background window. (default: 4). + CONFIG_EXAMPLES_NXLINES_BORDERCOLOR -- The color of the circular border + drawn in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP + (there really is no meaningful default). + CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR -- The color of the circular region + filled in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP + (there really is no meaningful default). + CONFIG_EXAMPLES_NXLINES_BORDERCOLOR -- The color of the lines drawn in the + background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP (there + really is no meaningful default). + + CONFIG_EXAMPLES_NXLINES_BPP -- Pixels per pixel to use. Valid options + include 2, 4, 8, 16, 24, and 32. Default is 16. + CONFIG_EXAMPLES_NXLINES_EXTERNINIT - The driver for the graphics device on + this platform requires some unusual initialization. This is the + for, for example, SPI LCD/OLED devices. If this configuration is + selected, then the platform code must provide an LCD initialization + function with a prototype like: + + #ifdef CONFIG_NX_LCDDRIVER + FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno); + #else + FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno); + #endif + +examples/nxtext +^^^^^^^^^^^^^^^ + + This directory contains another simple test of a subset of the NX APIs + defined in include/nuttx/nx/nx.h. This text focuses on text displays on + the dispaly background combined with pop-up displays over the text. + The text display will continue to update while the pop-up is visible. + + NOTE: This example will *only* work with FB drivers and with LCD + drivers that support reading the contents of the internal LCD memory + *unless* you define CONFIG_EXAMPLES_NXTEXT_NOGETRUN. If you notice + garbage on the display or a failure at the point where the display + should scroll, it is probably because you have an LCD driver that is + write-only. + + The following configuration options can be selected: + + CONFIG_EXAMPLES_NXTEXT_BUILTIN -- Build the NXTEXT example as a "built-in" + that can be executed from the NSH command line + CONFIG_EXAMPLES_NXTEXT_VPLANE -- The plane to select from the frame- + buffer driver for use in the test. Default: 0 + CONFIG_EXAMPLES_NXTEXT_DEVNO - The LCD device to select from the LCD + driver for use in the test: Default: 0 + CONFIG_EXAMPLES_NXTEXT_BGCOLOR -- The color of the background. Default + depends on CONFIG_EXAMPLES_NXTEXT_BPP. + CONFIG_EXAMPLES_NXTEXT_BGFONTID - Selects the font to use in the + background text (see font ID numbers in include/nuttx/nx/nxfonts.h) + CONFIG_EXAMPLES_NXTEXT_BGFONTCOLOR -- The color of the fonts used in the + background window. Default depends on CONFIG_EXAMPLES_NXTEXT_BPP. + CONFIG_EXAMPLES_NXTEXT_PUCOLOR -- The color of the pop-up window. Default + depends on CONFIG_EXAMPLES_NXTEXT_BPP. + CONFIG_EXAMPLES_NXTEXT_PUFONTID - Selects the font to use in the pop-up + windows (see font ID numbers in include/nuttx/nx/nxfonts.h) + CONFIG_EXAMPLES_NXTEXT_PUFONTCOLOR -- The color of the fonts used in the + background window. Default depends on CONFIG_EXAMPLES_NXTEXT_BPP. + CONFIG_EXAMPLES_NXTEXT_BPP -- Pixels per pixel to use. Valid options + include 2, 4, 8, 16, 24, and 32. Default is 32. + CONFIG_EXAMPLES_NXTEXT_NOGETRUN -- If your display is read-only OR if + reading is not reliable, then select this configuration to avoid + reading from the display. + CONFIG_EXAMPLES_NXTEXT_EXTERNINIT - The driver for the graphics device on + this platform requires some unusual initialization. This is the + for, for example, SPI LCD/OLED devices. If this configuration is + selected, then the platform code must provide an LCD initialization + function with a prototype like: + + #ifdef CONFIG_NX_LCDDRIVER + FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno); + #else + FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno); + #endif + + CONFIG_EXAMPLES_NXTEXT_BMCACHE - The maximum number of characters that + can be put in the background window. Default is 128. + CONFIG_EXAMPLES_NXTEXT_GLCACHE - The maximum nuber of pre-rendered + fonts that can be retained for the background window. + + This test can be performed with either the single-user version of + NX or with the multiple user version of NX selected with CONFIG_NX_MULTIUSER. + If CONFIG_NX_MULTIUSER is defined, then the following configuration + options also apply: + + CONFIG_EXAMPLES_NXTEXT_STACKSIZE -- The stacksize to use when creating + the NX server. Default 2048 + CONFIG_EXAMPLES_NXTEXT_CLIENTPRIO -- The client priority. Default: 100 + CONFIG_EXAMPLES_NXTEXT_SERVERPRIO -- The server priority. Default: 120 + CONFIG_EXAMPLES_NXTEXT_LISTENERPRIO -- The priority of the event listener + thread. Default 80. + CONFIG_EXAMPLES_NXTEXT_NOTIFYSIGNO -- The signal number to use with + nx_eventnotify(). Default: 4 + + If CONFIG_NX_MULTIUSER is defined, then the example also expects the + following settings and will generate an error if they are not as expected: + + CONFIG_DISABLE_MQUEUE=n + CONFIG_DISABLE_SIGNALS=n + CONFIG_DISABLE_PTHREAD=n + CONFIG_NX_BLOCKING=y + +examples/null +^^^^^^^^^^^^^ + + This is the do nothing application. It is only used for bringing + up new NuttX architectures in the most minimal of environments. + +examples/ostest +^^^^^^^^^^^^^^^ + + This is the NuttX 'qualification' suite. It attempts to exercise + a broad set of OS functionality. Its coverage is not very extensive + as of this writing, but it is used to qualify each NuttX release. + + The behavior of the ostest can be modified with the following + settings in the configs//defconfig file: + + * CONFIG_EXAMPLES_OSTEST_LOOPS + Used to control the number of executions of the test. If + undefined, the test executes one time. If defined to be + zero, the test runs forever. + * CONFIG_EXAMPLES_OSTEST_STACKSIZE + Used to create the ostest task. Default is 8192. + * CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS + Specifies the number of threads to create in the barrier + test. The default is 8 but a smaller number may be needed on + systems without sufficient memory to start so many threads. + +examples/pashello +^^^^^^^^^^^^^^^^^ + + This is "Hello, World" implemented via the Pascal P-Code interpreter. In + order to use this example, you must first download and install the + NuttX pascal module. After unpacking the pascal module, you can find + installation instructions in pascal/nuttx/README.txt. + + The correct install location for the NuttX examples and build files is + apps/interpreters. + +examples/pipe +^^^^^^^^^^^^^ + + A test of the mkfifo() and pipe() APIs. + + * CONFIG_EXAMPLES_PIPE_STACKSIZE + Sets the size of the stack to use when creating the child tasks. + The default size is 1024. + +examples/poll +^^^^^^^^^^^^^ + + A test of the poll() and select() APIs using FIFOs and, if available, + stdin, and a TCP/IP socket. In order to build this test, you must the + following selected in your NuttX configuration file: + + CONFIG_NFILE_DESCRIPTORS - Defined to be greater than 0 + CONFIG_DISABLE_POLL - NOT defined + + In order to use the TCP/IP select test, you have also the following + additional things selected in your NuttX configuration file: + + CONFIG_NET - Defined for general network support + CONFIG_NET_TCP - Defined for TCP/IP support + CONFIG_NSOCKET_DESCRIPTORS - Defined to be greater than 0 + CONFIG_NET_NTCP_READAHEAD_BUFFERS - Defined to be greater than zero + + CONFIG_EXAMPLE_POLL_NOMAC - (May be defined to use software assigned MAC) + CONFIG_EXAMPLE_POLL_IPADDR - Target IP address + CONFIG_EXAMPLE_POLL_DRIPADDR - Default router IP addess + CONFIG_EXAMPLE_POLL_NETMASK - Network mask + + In order to for select to work with incoming connections, you + must also select: + + CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until accept() is called. + + In additional to the target device-side example, there is also + a host-side application in this directory. It can be compiled under + Linux or Cygwin as follows: + + cd examples/usbserial + make -f Makefile.host TOPDIR= TARGETIP= + + Where is the IP address of your target board. + + This will generate a small program called 'host'. Usage: + + 1. Build the examples/poll target program with TCP/IP poll support + and start the target. + + 3. Then start the host application: + + ./host + + The host and target will exchange are variety of small messages. Each + message sent from the host should cause the select to return in target. + The target example should read the small message and send it back to + the host. The host should then receive the echo'ed message. + + If networking is enabled, applications using this example will need to + provide an appconfig file in the configuration driver with instruction + to build applications like: + + CONFIGURED_APPS += uiplib + +examples/rgmp +^^^^^^^^^^^^^ + + RGMP stands for RTOS and GPOS on Multi-Processor. RGMP is a project for + running GPOS and RTOS simultaneously on multi-processor platforms. You can + port your favorite RTOS to RGMP together with an unmodified Linux to form a + hybrid operating system. This makes your application able to use both RTOS + and GPOS features. + + See http://rgmp.sourceforge.net/wiki/index.php/Main_Page for further + + At present, the RGMP example folder contains only an empty main.c file. + +examples/romfs +^^^^^^^^^^^^^^ + + This example exercises the romfs filesystem. Configuration options + include: + + * CONFIG_EXAMPLES_ROMFS_RAMDEVNO + The minor device number to use for the ROM disk. The default is + 1 (meaning /dev/ram1) + + * CONFIG_EXAMPLES_ROMFS_SECTORSIZE + The ROM disk sector size to use. Default is 64. + + * CONFIG_EXAMPLES_ROMFS_MOUNTPOINT + The location to mount the ROM disk. Deafault: "/usr/local/share" + +examples/sendmail +^^^^^^^^^^^^^^^^^ + + This examples exercises the uIP SMTP logic by sending a test message + to a selected recipient. This test can also be built to execute on + the Cygwin/Linux host environment: + + cd examples/sendmail + make -f Makefile.host TOPDIR= + + Settings unique to this example include: + + CONFIG_EXAMPLE_SENDMAIL_NOMAC - May be defined to use software assigned MAC (optional) + CONFIG_EXAMPLE_SENDMAIL_IPADDR - Target IP address (required) + CONFIG_EXAMPLE_SENDMAIL_DRIPADDR - Default router IP addess (required) + CONFIG_EXAMPLE_SENDMAILT_NETMASK - Network mask (required) + CONFIG_EXAMPLE_SENDMAIL_RECIPIENT - The recipient of the email (required) + CONFIG_EXAMPLE_SENDMAIL_SENDER - Optional. Default: "nuttx-testing@example.com" + CONFIG_EXAMPLE_SENDMAIL_SUBJECT - Optional. Default: "Testing SMTP from NuttX" + CONFIG_EXAMPLE_SENDMAIL_BODY - Optional. Default: "Test message sent by NuttX" + + NOTE: This test has not been verified on the NuttX target environment. + As of this writing, unit-tested in the Cygwin/Linux host environment. + + NOTE 2: This sendmail example only works for the simplest of + environments. Virus protection software on your host may have + to be disabled to allow you to send messages. Only very open, + unprotected recipients can be used. Most will protect themselves + from this test email because it looks like SPAM. + + Applications using this example will need to provide an appconfig + file in the configuration driver with instruction to build applications + like: + + CONFIGURED_APPS += uiplib + CONFIGURED_APPS += smtp + +examples/serloop +^^^^^^^^^^^^^^^^ + + This is a mindlessly simple loopback test on the console. Useful + for testing new serial drivers. Configuration options include: + + * CONFIG_EXAMPLES_SERLOOP_BUFIO + Use C buffered I/O (getchar/putchar) vs. raw console I/O + (read/read). + +examples/thttpd +^^^^^^^^^^^^^^^ + + An example that builds netutils/thttpd with some simple NXFLAT + CGI programs. see configs/README.txt for most THTTPD settings. + In addition to those, this example accepts: + + CONFIG_EXAMPLE_THTTPD_NOMAC - (May be defined to use software assigned MAC) + CONFIG_EXAMPLE_THTTPD_DRIPADDR - Default router IP addess + CONFIG_EXAMPLE_THTTPD_NETMASK - Network mask + + Applications using this example will need to provide an appconfig + file in the configuration driver with instruction to build applications + like: + + CONFIGURED_APPS += uiplib + CONFIGURED_APPS += thttpd + +examples/tiff +^^^^^^^^^^^^^ + + This is a simple unit test for the TIFF creation library at apps/graphic/tiff. + It is configured to work in the Linux user-mode simulation and has not been + tested in any other environment. Since the example also depends on some + other logic to mount a file system, currently it will only work as an NSH + built-on, i.e., if the following is defined: + + CONFIG_NSH_BUILTIN_APPS=y + CONFIG_EXAMPLES_TIFF_BUILTIN=y + + At a miniumum, to run in an embedded environment, you will probably have to + change the configured paths to the TIFF files defined in the example. + + CONFIG_EXAMPLES_TIFF_OUTFILE - Name of the resulting TIFF file. Default is + "/tmp/result.tif" + CONFIG_EXAMPLES_TIFF_TMPFILE1/2 - Names of two temporaries files that + will be used in the file creation. Defaults are "/tmp/tmpfile1.dat" and + "/tmp/tmpfile2.dat" + + The following must also be defined in your apps/ configuration file: + + CONFIGURED_APPS += examples/tiff + CONFIGURED_APPS += graphics/tiff + +examples/touchscreen +^^^^^^^^^^^^^^^^^^^^ + + This configuration implements a simple touchscreen test at + apps/examples/touchscreen. This test will create an empty X11 window + and will print the touchscreen output as it is received from the + simulated touchscreen driver. + + CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN - Build the touchscreen test as + an NSH built-in function. Default: Built as a standalone problem + CONFIG_EXAMPLES_TOUCHSCREEN_MINOR - The minor device number. Minor=N + correspnds to touchscreen device /dev/input0. Note this value must + with CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH. Default 0. + CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH - The path to the touchscreen + device. This must be consistent with CONFIG_EXAMPLES_TOUCHSCREEN_MINOR. + Default: "/dev/input0" + CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES - If CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN + is defined, then the number of samples is provided on the command line + and this value is ignored. Otherwise, this number of samples is + collected and the program terminates. Default: Samples are collected + indefinitely. + + The following additional configurations must be set in the NuttX + configuration file: + + CONFIG_INPUTP=y + (Plus any touchscreen-specific settings). + + The following must also be defined in your apps configuration file: + + CONFIGURED_APPS += examples/tiff + CONFIGURED_APPS += graphics/tiff + + The board-specific logic must provide the following interfaces that will + be called by the example in order to initialize and uninitialize the + touchscreen hardware: + + int arch_tcinitialize(int minor); + int arch_tcuninitialize(void); + +examples/udp +^^^^^^^^^^^^ + + This is a simple network test for verifying client- and server- + functionality over UDP. + + Applications using this example will need to provide an appconfig + file in the configuration driver with instruction to build applications + like: + + CONFIGURED_APPS += uiplib + +examples/uip +^^^^^^^^^^^^ + + This is a port of uIP tiny webserver example application. Settings + specific to this example include: + + CONFIG_EXAMPLE_UIP_NOMAC - (May be defined to use software assigned MAC) + CONFIG_EXAMPLE_UIP_IPADDR - Target IP address + CONFIG_EXAMPLE_UIP_DRIPADDR - Default router IP addess + CONFIG_EXAMPLE_UIP_NETMASK - Network mask + CONFIG_EXAMPLE_UIP_DHCPC - Select to get IP address via DHCP + + If you use DHCPC, then some special configuration network options are + required. These include: + + CONFIG_NET=y - Of course + CONFIG_NSOCKET_DESCRIPTORS - And, of course, you must allocate some + socket descriptors. + CONFIG_NET_UDP=y - UDP support is required for DHCP + (as well as various other UDP-related + configuration settings). + CONFIG_NET_BROADCAST=y - UDP broadcast support is needed. + CONFIG_NET_BUFSIZE=650 - Per RFC2131 (p. 9), the DHCP client must be + (or larger) prepared to receive DHCP messages of up to + 576 bytes (excluding Ethernet, IP, or UDP + headers and FCS). + + Other configuration items apply also to the selected webserver net utility. + Additional relevant settings for the uIP webserver net utility are: + + CONFIG_NETUTILS_HTTPDSTACKSIZE + CONFIG_NETUTILS_HTTPDFILESTATS + CONFIG_NETUTILS_HTTPDNETSTATS + + Applications using this example will need to provide an appconfig + file in the configuration driver with instruction to build applications + like: + + CONFIGURED_APPS += uiplib + CONFIGURED_APPS += dhcpc + CONFIGURED_APPS += resolv + CONFIGURED_APPS += webserver + +examples/usbserial +^^^^^^^^^^^^^^^^^^ + + TARGET CONFIGURATION: + + This is another implementation of "Hello, World" but this one uses + a USB serial driver. Configuration options can be used to simply + the test. These options include: + + CONFIG_EXAMPLES_USBSERIAL_INONLY + Only verify IN (device-to-host) data transfers. Default: both + CONFIG_EXAMPLES_USBSERIAL_OUTONLY + Only verify OUT (host-to-device) data transfers. Default: both + CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL + Send only small, single packet messages. Default: Send large and small. + CONFIG_EXAMPLES_USBSERIAL_ONLYBIG + Send only large, multi-packet messages. Default: Send large and small. + + If CONFIG_USBDEV_TRACE is enabled (or CONFIG_DEBUG and CONFIG_DEBUG_USB), then + the example code will also manage the USB trace output. The amount of trace output + can be controlled using: + + CONFIG_EXAMPLES_USBSERIAL_TRACEINIT + Show initialization events + CONFIG_EXAMPLES_USBSERIAL_TRACECLASS + Show class driver events + CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS + Show data transfer events + CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER + Show controller events + CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS + Show interrupt-related events. + + Error results are always shown in the trace output + + HOST-SIDE TEST PROGRAM + + In additional to the target device-side example, there is also a + host-side application in this directory. This host side application + must be executed on a Linux host in order to perform the USBSERIAL + test. The host application can be compiled under Linux (or Cygwin?) + as follows: + + cd examples/usbserial + make -f Makefile.host TOPDIR= + + RUNNING THE TEST + + This will generate a small program called 'host'. Usage: + + 1. Build the examples/usbserial target program and start the target. + + 2. Wait a bit, then do enter: + + dmesg + + At the end of the dmesg output, you should see the serial + device was successfully idenfied and assigned to a tty device, + probably /dev/ttyUSB0. + + 3. Then start the host application: + + ./host [] + + Where: + + is the USB TTY device to use. The default is /dev/ttyUSB0. + + The host and target will exchange are variety of very small and very large + serial messages. + +examples/usbstorage +^^^^^^^^^^^^^^^^^^^ + + This example registers a block device driver, then exports the block + the device using the USB storage class driver. In order to use this + example, your board-specific logic must provide the function: + + void usbstrg_archinitialize(void); + + This function will be called by the example/usbstorage in order to + do the actual registration of the block device drivers. For examples + of the implementation of usbstrg_archinitialize() see + configs/mcu123-lpc124x/src/up_usbstrg.c or + configs/stm3210e-eval/src/usbstrg.c + + Configuration options: + + CONFIG_EXAMPLES_USBSTRG_BUILTIN + This example can be built as two NSH "built-in" commands if this option + is selection: 'msconn' will connect the USB mass storage device; 'msdis' + will disconnect the USB storage device. + CONFIG_EXAMPLES_USBSTRG_NLUNS + Defines the number of logical units (LUNs) exported by the USB storage + driver. Each LUN corresponds to one exported block driver (or partition + of a block driver). May be 1, 2, or 3. Default is 1. + CONFIG_EXAMPLES_USBSTRG_DEVMINOR1 + The minor device number of the block driver for the first LUN. For + example, N in /dev/mmcsdN. Used for registering the block driver. Default + is zero. + CONFIG_EXAMPLES_USBSTRG_DEVPATH1 + The full path to the registered block driver. Default is "/dev/mmcsd0" + CONFIG_EXAMPLES_USBSTRG_DEVMINOR2 and CONFIG_EXAMPLES_USBSTRG_DEVPATH2 + Similar parameters that would have to be provided if CONFIG_EXAMPLES_USBSTRG_NLUNS + is 2 or 3. No defaults. + CONFIG_EXAMPLES_USBSTRG_DEVMINOR3 and CONFIG_EXAMPLES_USBSTRG_DEVPATH3 + Similar parameters that would have to be provided if CONFIG_EXAMPLES_USBSTRG_NLUNS + is 3. No defaults. + CONFIG_EXAMPLES_USBSTRG_DEBUGMM + Enables some debug tests to check for memory usage and memory leaks. + + If CONFIG_USBDEV_TRACE is enabled (or CONFIG_DEBUG and CONFIG_DEBUG_USB), then + the example code will also manage the USB trace output. The amount of trace output + can be controlled using: + + CONFIG_EXAMPLES_USBSTRG_TRACEINIT + Show initialization events + CONFIG_EXAMPLES_USBSTRG_TRACECLASS + Show class driver events + CONFIG_EXAMPLES_USBSTRG_TRACETRANSFERS + Show data transfer events + CONFIG_EXAMPLES_USBSTRG_TRACECONTROLLER + Show controller events + CONFIG_EXAMPLES_USBSTRG_TRACEINTERRUPTS + Show interrupt-related events. + + Error results are always shown in the trace output + + NOTE 1: When built as an NSH add-on command (CONFIG_EXAMPLES_USBSTRG_BUILTIN=y), + Caution should be used to assure that the SD drive (or other storage device) is + not in use when the USB storage device is configured. Specifically, the SD + driver should be unmounted like: + + nsh> mount -t vfat /dev/mmcsd0 /mnt/sdcard # Card is mounted in NSH + ... + nsh> umount /mnd/sdcard # Unmount before connecting USB!!! + nsh> msconn # Connect the USB storage device + ... + nsh> msdis # Disconnect USB storate device + nsh> mount -t vfat /dev/mmcsd0 /mnt/sdcard # Restore the mount + + Failure to do this could result in corruption of the SD card format. + + NOTE 2: This test exercises internal USB device driver interfaces. As such, + it relies on internal OS interfaces that are not normally available to a + user-space program. As a result, this example cannot be used if a + NuttX is built as a protected, supervisor kernel (CONFIG_NUTTX_KERNEL). + +examples/usbterm +^^^^^^^^^^^^^^^^ + + This example implements a little USB terminal.. more of a USB "chat" + edited lines are received from the remote host connected via USB + serial and echoed out the target serial console. Edited lines from + the local target serial console are received and forwarded to the + remote host via USB serial. + + Usage: + - Build the example and load into the target FLASH + - Connect on terminal to the target RS-232 connect and configure + for 115200 8N1. For example, suppose this Tera Term on a Windows + box. + - Power up the target board + - Connect the USB to a Linux box. Use the Linux dmesg command to + assure that the connect was successful. The USB CDC ACM device + should appear as /dev/ttyACM0 + - On the Linux box, open minicom with tty=/dev/ttyACM0. + Configure minicom so that (1) local characters are echoed and (2) + so that no CR is required. + - Now what you type on the target Tera Term window should echo on + the Linux minicom window and, conversely, what you type on the + minicom winow should be echo in the target Tera Term window. + + Configuration options: + + CONFIG_EXAMPLES_UBSTERM_BUILTIN - Build the usbterm example as an NSH + built-in command. NOTE: This is not fully functional as of this + writing.. It should work, but there is no mechanism in place yet + to exit the USB terminal program and return to NSH. + CONFIG_EXAMPLES_USBTERM_BUFLEN - The size of the input and output + buffers used for receiving data. Default 256 bytes. + + If CONFIG_USBDEV_TRACE is enabled (or CONFIG_DEBUG and CONFIG_DEBUG_USB, or + CONFIG_USBDEV_TRACE), then the example code will also manage the USB trace + output. The amount of trace output can be controlled using: + + CONFIG_EXAMPLES_USBTERM_TRACEINIT + Show initialization events + CONFIG_EXAMPLES_USBTERM_TRACECLASS + Show class driver events + CONFIG_EXAMPLES_USBTERM_TRACETRANSFERS + Show data transfer events + CONFIG_EXAMPLES_USBTERM_TRACECONTROLLER + Show controller events + CONFIG_EXAMPLES_USBTERM_TRACEINTERRUPTS + Show interrupt-related events. + + Error results are always shown in the trace output + + Other relevant configuration options: CONFIG_CDCSER selected by the + Prolifics emulation (not defined) and the CDC serial implementation + (when defined). CONFIG_USBDEV_TRACE_INITIALIDSET. + +examples/wget +^^^^^^^^^^^^^ + + A simple web client example. It will obtain a file from a server using the HTTP + protocol. Settings unique to this example include: + + CONFIG_EXAMPLE_WGET_URL - The URL of the file to get + CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC) + CONFIG_EXAMPLE_WGET_IPADDR - Target IP address + CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess + CONFIG_EXAMPLE_WGET_NETMASK - Network mask + + This example uses netutils/webclient. Additional configuration settings apply + to that code as follows (but built-in defaults are probably OK): + + CONFIG_WEBCLIENT_GETMIMETYPE, CONFIG_WEBCLIENT_MAXHTTPLINE, + CONFIG_WEBCLIENT_MAXMIMESIZE, CONFIG_WEBCLIENT_MAXHOSTNAME, + CONFIG_WEBCLIENT_MAXFILENAME + + Of course, the example also requires other settings including CONFIG_NET and + CONFIG_NET_TCP. The example also uses the uIP resolver which requires CONFIG_UDP. + + WARNNG: As of this writing, wget is untested on the target platform. At present + it has been tested only in the host-based configuration described in the following + note. The primary difference is that the target version will rely on the also + untested uIP name resolver. + + NOTE: For test purposes, this example can be built as a host-based wget function. + This can be built as follows: + + cd examples/wget + make -f Makefile.host + + Applications using this example will need to provide an appconfig + file in the configuration driver with instruction to build applications + like: + + CONFIGURED_APPS += uiplib + CONFIGURED_APPS += resolv + CONFIGURED_APPS += webclient + + diff --git a/apps/examples/adc/Makefile b/apps/examples/adc/Makefile new file mode 100644 index 0000000000..d9b2162e93 --- /dev/null +++ b/apps/examples/adc/Makefile @@ -0,0 +1,105 @@ +############################################################################ +# apps/examples/touchscreen/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# NuttX NX Graphics Example. + +ASRCS = +CSRCS = adc_main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Touchscreen built-in application info + +APPNAME = adc +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +# Common build + +VPATH = + +all: .built +.PHONY: context clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +.context: +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + @touch $@ +endif + +context: .context + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/adc/adc.h b/apps/examples/adc/adc.h new file mode 100755 index 0000000000..901f84940a --- /dev/null +++ b/apps/examples/adc/adc.h @@ -0,0 +1,116 @@ +/**************************************************************************** + * examples/examples/adc.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_EXAMPLES_ADC_ADC_H +#define __APPS_EXAMPLES_ADC_ADC_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ +/* Configuration ************************************************************/ +/* CONFIG_NSH_BUILTIN_APPS - Build the ADC test as an NSH built-in function. + * Default: Built as a standalone problem + * CONFIG_EXAMPLES_ADC_DEVPATH - The path to the ADC device. Default: /dev/adc0 + * CONFIG_EXAMPLES_ADC_NSAMPLES - If CONFIG_NSH_BUILTIN_APPS + * is defined, then the number of samples is provided on the command line + * and this value is ignored. Otherwise, this number of samples is + * collected and the program terminates. Default: Samples are collected + * indefinitely. + * CONFIG_EXAMPLES_ADC_GROUPSIZE - The number of samples to read at once. + * Default: 4 + */ + +#ifndef CONFIG_ADC +# error "ADC device support is not enabled (CONFIG_ADC)" +#endif + +#ifndef CONFIG_EXAMPLES_ADC_DEVPATH +# define CONFIG_EXAMPLES_ADC_DEVPATH "/dev/adc0" +#endif + +#ifndef CONFIG_EXAMPLES_ADC_GROUPSIZE +# define CONFIG_EXAMPLES_ADC_GROUPSIZE 4 +#endif + +/* Debug ********************************************************************/ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_DEBUG +# define message(...) lib_rawprintf(__VA_ARGS__) +# define msgflush() +# else +# define message(...) printf(__VA_ARGS__) +# define msgflush() fflush(stdout) +# endif +#else +# ifdef CONFIG_DEBUG +# define message lib_rawprintf +# define msgflush() +# else +# define message printf +# define msgflush() fflush(stdout) +# endif +#endif + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: adc_devinit() + * + * Description: + * Perform architecuture-specific initialization of the ADC hardware. This + * interface must be provided by all configurations using apps/examples/adc + * + ****************************************************************************/ + +int adc_devinit(void); + +#endif /* __APPS_EXAMPLES_ADC_ADC_H */ diff --git a/apps/examples/adc/adc_main.c b/apps/examples/adc/adc_main.c new file mode 100644 index 0000000000..e685f862d4 --- /dev/null +++ b/apps/examples/adc/adc_main.c @@ -0,0 +1,215 @@ +/**************************************************************************** + * examples/adc/adc_main.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include "adc.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifdef CONFIG_NSH_BUILTIN_APPS +# define MAIN_NAME adc_main +# define MAIN_STRING "adc_main: " +#else +# define MAIN_NAME user_start +# define MAIN_STRING "user_start: " +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: user_start/adc_main + ****************************************************************************/ + +int MAIN_NAME(int argc, char *argv[]) +{ + struct adc_msg_s sample[CONFIG_EXAMPLES_ADC_GROUPSIZE]; + size_t readsize; + ssize_t nbytes; +#if defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_EXAMPLES_ADC_NSAMPLES) + long nsamples; +#endif + int fd; + int errval = 0; + int ret; + int i; + + /* If this example is configured as an NX add-on, then limit the number of + * samples that we collect before returning. Otherwise, we never return + */ + +#if defined(CONFIG_NSH_BUILTIN_APPS) + nsamples = 1; + if (argc > 1) + { + nsamples = strtol(argv[1], NULL, 10); + } + message(MAIN_STRING "nsamples: %d\n", nsamples); +#elif defined(CONFIG_EXAMPLES_ADC_NSAMPLES) + message(MAIN_STRING "nsamples: %d\n", CONFIG_EXAMPLES_ADC_NSAMPLES); +#endif + + /* Initialization of the ADC hardware is performed by logic external to + * this test. + */ + + message(MAIN_STRING "Initializing external ADC device\n"); + ret = adc_devinit(); + if (ret != OK) + { + message(MAIN_STRING "adc_devinit failed: %d\n", ret); + errval = 1; + goto errout; + } + message(MAIN_STRING "Hardware initialized. Opening the ADC device\n"); + + /* Open the ADC device for reading */ + + fd = open(CONFIG_EXAMPLES_ADC_DEVPATH, O_RDONLY); + if (fd < 0) + { + message(MAIN_STRING "open %s failed: %d\n", + CONFIG_EXAMPLES_ADC_DEVPATH, errno); + errval = 2; + goto errout_with_dev; + } + + /* Now loop the appropriate number of times, displaying the collected + * ADC samples. + */ + + message(MAIN_STRING "Entering the main loop\n"); + +#if defined(CONFIG_NSH_BUILTIN_APPS) + for (; nsamples > 0; nsamples--) +#elif defined(CONFIG_EXAMPLES_ADC_NSAMPLES) + for (nsamples = 0; nsamples < CONFIG_EXAMPLES_ADC_NSAMPLES; nsamples++) +#else + for (;;) +#endif + { + /* Flush any output before the loop entered or from the previous pass + * through the loop. + */ + + msgflush(); + + /* Read CONFIG_EXAMPLES_ADC_GROUPSIZE samples */ + + readsize = CONFIG_EXAMPLES_ADC_GROUPSIZE * sizeof(struct adc_msg_s); + nbytes = read(fd, sample, readsize); + message("Bytes read: %d\n", nbytes); + + /* Handle unexpected return values */ + + if (nbytes < 0) + { + errval = errno; + if (errval != EINTR) + { + message(MAIN_STRING "read %s failed: %d\n", + CONFIG_EXAMPLES_ADC_DEVPATH, errval); + errval = 3; + goto errout_with_dev; + } + + message(MAIN_STRING "Interrupted read...\n"); + } + else if (nbytes != readsize) + { + message(MAIN_STRING "Unexpected read size=%d, expected=%d, Ignoring\n", + nbytes, readsize); + } + + /* Print the sample data on successful return */ + + else + { + message("Sample :\n"); + for (i = 0; i < CONFIG_EXAMPLES_ADC_GROUPSIZE; i++) + { + message("%d: channel: %d value: %d\n", + i, sample[i].am_channel, sample[i].am_data); + } + } + } + +errout_with_dev: + close(fd); + +errout: + message("Terminating!\n"); + msgflush(); + return errval; +} diff --git a/apps/examples/buttons/Makefile b/apps/examples/buttons/Makefile new file mode 100644 index 0000000000..9c05871998 --- /dev/null +++ b/apps/examples/buttons/Makefile @@ -0,0 +1,105 @@ +############################################################################ +# apps/examples/buttons/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# Hello, World! Example + +ASRCS = +CSRCS = main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Buttons built-in application info + +APPNAME = buttons +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +# Common build + +VPATH = + +all: .built +.PHONY: context clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +.context: +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + @touch $@ +endif + +context: .context + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/buttons/main.c b/apps/examples/buttons/main.c new file mode 100644 index 0000000000..b0d06e48a2 --- /dev/null +++ b/apps/examples/buttons/main.c @@ -0,0 +1,505 @@ +/**************************************************************************** + * examples/buttons/main.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * NOTE: This test exercises internal button driver interfaces. As such, it + * it relies on internal OS interfaces that are not normally available to a + * user-space program. As a result, this example cannot be used if a + * NuttX is built as a protected, supervisor kernel (CONFIG_NUTTX_KERNEL). + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +#include +#include +#include +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ +/* Configuration ************************************************************/ + +#ifndef CONFIG_ARCH_BUTTONS +# error "CONFIG_ARCH_BUTTONS is not defined in the configuration" +#endif + +#ifndef CONFIG_EXAMPLE_BUTTONS_NAME0 +# define CONFIG_EXAMPLE_BUTTONS_NAME0 "BUTTON0" +#endif +#ifndef CONFIG_EXAMPLE_BUTTONS_NAME1 +# define CONFIG_EXAMPLE_BUTTONS_NAME1 "BUTTON1" +#endif +#ifndef CONFIG_EXAMPLE_BUTTONS_NAME2 +# define CONFIG_EXAMPLE_BUTTONS_NAME2 "BUTTON2" +#endif +#ifndef CONFIG_EXAMPLE_BUTTONS_NAME3 +# define CONFIG_EXAMPLE_BUTTONS_NAME3 "BUTTON3" +#endif +#ifndef CONFIG_EXAMPLE_BUTTONS_NAME4 +# define CONFIG_EXAMPLE_BUTTONS_NAME4 "BUTTON4" +#endif +#ifndef CONFIG_EXAMPLE_BUTTONS_NAME5 +# define CONFIG_EXAMPLE_BUTTONS_NAME5 "BUTTON5" +#endif +#ifndef CONFIG_EXAMPLE_BUTTONS_NAME6 +# define CONFIG_EXAMPLE_BUTTONS_NAME6 "BUTTON6" +#endif +#ifndef CONFIG_EXAMPLE_BUTTONS_NAME7 +# define CONFIG_EXAMPLE_BUTTONS_NAME7 "BUTTON7" +#endif + +#define BUTTON_MIN 0 +#define BUTTON_MAX 7 + +#ifndef CONFIG_EXAMPLE_BUTTONS_MIN +# define CONFIG_EXAMPLE_BUTTONS_MIN BUTTON_MIN +#endif +#ifndef CONFIG_EXAMPLE_BUTTONS_MAX +# define CONFIG_EXAMPLE_BUTTONS_MAX BUTTON_MAX +#endif + +#if CONFIG_EXAMPLE_BUTTONS_MIN > CONFIG_EXAMPLE_BUTTONS_MAX +# error "CONFIG_EXAMPLE_BUTTONS_MIN > CONFIG_EXAMPLE_BUTTONS_MAX" +#endif +#if CONFIG_EXAMPLE_BUTTONS_MAX > 7 +# error "CONFIG_EXAMPLE_BUTTONS_MAX > 7" +#endif + +#ifndef CONFIG_EXAMPLE_IRQBUTTONS_MIN +# define CONFIG_EXAMPLE_IRQBUTTONS_MIN CONFIG_EXAMPLE_BUTTONS_MIN +#endif +#ifndef CONFIG_EXAMPLE_IRQBUTTONS_MAX +# define CONFIG_EXAMPLE_IRQBUTTONS_MAX CONFIG_EXAMPLE_BUTTONS_MAX +#endif + +#if CONFIG_EXAMPLE_IRQBUTTONS_MIN > CONFIG_EXAMPLE_IRQBUTTONS_MAX +# error "CONFIG_EXAMPLE_IRQBUTTONS_MIN > CONFIG_EXAMPLE_IRQBUTTONS_MAX" +#endif +#if CONFIG_EXAMPLE_IRQBUTTONS_MAX > 7 +# error "CONFIG_EXAMPLE_IRQBUTTONS_MAX > 7" +#endif + +#ifndef MIN +# define MIN(a,b) (a < b ? a : b) +#endif +#ifndef MAX +# define MAX(a,b) (a > b ? a : b) +#endif + +#define MIN_BUTTON MIN(CONFIG_EXAMPLE_BUTTONS_MIN, CONFIG_EXAMPLE_IRQBUTTONS_MIN) +#define MAX_BUTTON MAX(CONFIG_EXAMPLE_BUTTONS_MAX, CONFIG_EXAMPLE_IRQBUTTONS_MAX) + +#define NUM_BUTTONS (MAX_BUTTON - MIN_BUTTON + 1) +#define BUTTON_INDEX(b) ((b)-MIN_BUTTON) + +/* Is this being built as an NSH built-in application? */ + +#ifdef CONFIG_NSH_BUILTIN_APPS +# define MAIN_NAME buttons_main +# define MAIN_STRING "buttons_main: " +#else +# define MAIN_NAME user_start +# define MAIN_STRING "user_start: " +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct button_info_s +{ + FAR const char *name; /* Name for the button */ +#ifdef CONFIG_ARCH_IRQBUTTONS + xcpt_t handler; /* Button interrupt handler */ +#endif +}; + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static void show_buttons(uint8_t oldset, uint8_t newset); + +#ifdef CONFIG_ARCH_IRQBUTTONS +static void button_handler(int id, int irq); + +#if MIN_BUTTON < 1 +static int button0_handler(int irq, FAR void *context); +#endif +#if MIN_BUTTON < 2 && MAX_BUTTON > 0 +static int button1_handler(int irq, FAR void *context); +#endif +#if MIN_BUTTON < 3 && MAX_BUTTON > 1 +static int button2_handler(int irq, FAR void *context); +#endif +#if MIN_BUTTON < 4 && MAX_BUTTON > 2 +static int button3_handler(int irq, FAR void *context); +#endif +#if MIN_BUTTON < 5 && MAX_BUTTON > 3 +static int button4_handler(int irq, FAR void *context); +#endif +#if MIN_BUTTON < 6 && MAX_BUTTON > 4 +static int button5_handler(int irq, FAR void *context); +#endif +#if MIN_BUTTON < 7 && MAX_BUTTON > 5 +static int button6_handler(int irq, FAR void *context); +#endif +#if MAX_BUTTON > 6 +static int button7_handler(int irq, FAR void *context); +#endif +#endif /* CONFIG_ARCH_IRQBUTTONS */ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + + /* Button Names */ + +static const struct button_info_s g_buttoninfo[NUM_BUTTONS] = +{ +#if MIN_BUTTON < 1 + { + CONFIG_EXAMPLE_BUTTONS_NAME0, +#ifdef CONFIG_ARCH_IRQBUTTONS + button0_handler +#endif + }, +#endif +#if MIN_BUTTON < 2 && MAX_BUTTON > 0 + { + CONFIG_EXAMPLE_BUTTONS_NAME1, +#ifdef CONFIG_ARCH_IRQBUTTONS + button1_handler +#endif + }, +#endif +#if MIN_BUTTON < 3 && MAX_BUTTON > 1 + { + CONFIG_EXAMPLE_BUTTONS_NAME2, +#ifdef CONFIG_ARCH_IRQBUTTONS + button2_handler +#endif + }, +#endif +#if MIN_BUTTON < 4 && MAX_BUTTON > 2 + { + CONFIG_EXAMPLE_BUTTONS_NAME3, +#ifdef CONFIG_ARCH_IRQBUTTONS + button3_handler +#endif + }, +#endif +#if MIN_BUTTON < 5 && MAX_BUTTON > 3 + { + CONFIG_EXAMPLE_BUTTONS_NAME4, +#ifdef CONFIG_ARCH_IRQBUTTONS + button4_handler +#endif + }, +#endif +#if MIN_BUTTON < 6 && MAX_BUTTON > 4 + { + CONFIG_EXAMPLE_BUTTONS_NAME5, +#ifdef CONFIG_ARCH_IRQBUTTONS + button5_handler +#endif + }, +#endif +#if MIN_BUTTON < 7 && MAX_BUTTON > 5 + { + CONFIG_EXAMPLE_BUTTONS_NAME6, +#ifdef CONFIG_ARCH_IRQBUTTONS + button6_handler +#endif + }, +#endif +#if MAX_BUTTON > 6 + { + CONFIG_EXAMPLE_BUTTONS_NAME7, +#ifdef CONFIG_ARCH_IRQBUTTONS + button7_handler +#endif + } +#endif +}; + +/* Last sampled button set */ + +static uint8_t g_oldset; + +/* Used to limit the number of button presses */ + +#ifdef CONFIG_NSH_BUILTIN_APPS +static volatile long g_nbuttons; +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static void show_buttons(uint8_t oldset, uint8_t newset) +{ + uint8_t chgset = oldset ^ newset; + int i; + + /* Update the count of button presses shown */ + +#ifdef CONFIG_NSH_BUILTIN_APPS + if ((chgset & newset) != 0) + { + g_nbuttons++; + } +#endif + + /* Show each button state change */ + + for (i = MIN_BUTTON; i <= MAX_BUTTON; i++) + { + uint8_t mask = (1 << i); + if ((chgset & mask) != 0) + { + FAR const char *state; + + /* Get the button state */ + + if ((newset & mask) != 0) + { + state = "depressed"; + } + else + { + state = "released"; + } + + /* Use lib_lowprintf() because we make be executing from an + * interrupt handler. + */ + + lib_lowprintf(" %s %s\n", g_buttoninfo[BUTTON_INDEX(i)].name, state); + } + } +} + +#ifdef CONFIG_ARCH_IRQBUTTONS +static void button_handler(int id, int irq) +{ + uint8_t newset = up_buttons(); + + lib_lowprintf("IRQ:%d Button %d:%s SET:%02x:\n", + irq, id, g_buttoninfo[BUTTON_INDEX(id)].name, newset); + show_buttons(g_oldset, newset); + g_oldset = newset; +} + +#if MIN_BUTTON < 1 +static int button0_handler(int irq, FAR void *context) +{ + button_handler(0, irq); + return OK; +} +#endif + +#if MIN_BUTTON < 2 && MAX_BUTTON > 0 +static int button1_handler(int irq, FAR void *context) +{ + button_handler(1, irq); + return OK; +} +#endif + +#if MIN_BUTTON < 3 && MAX_BUTTON > 1 +static int button2_handler(int irq, FAR void *context) +{ + button_handler(2, irq); + return OK; +} +#endif + +#if MIN_BUTTON < 4 && MAX_BUTTON > 2 +static int button3_handler(int irq, FAR void *context) +{ + button_handler(3, irq); + return OK; +} +#endif + +#if MIN_BUTTON < 5 && MAX_BUTTON > 3 +static int button4_handler(int irq, FAR void *context) +{ + button_handler(4, irq); + return OK; +} +#endif + +#if MIN_BUTTON < 6 && MAX_BUTTON > 4 +static int button5_handler(int irq, FAR void *context) +{ + button_handler(5, irq); + return OK; +} +#endif + +#if MIN_BUTTON < 7 && MAX_BUTTON > 5 +static int button6_handler(int irq, FAR void *context) +{ + button_handler(6, irq); + return OK; +} +#endif + +#if MAX_BUTTON > 6 +static int button7_handler(int irq, FAR void *context) +{ + button_handler(7, irq); + return OK; +} +#endif +#endif /* CONFIG_ARCH_IRQBUTTONS */ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * user_start/buttons_main + ****************************************************************************/ + +int MAIN_NAME(int argc, char *argv[]) +{ + uint8_t newset; + irqstate_t flags; + int i; + + /* If this example is configured as an NX add-on, then limit the number of + * samples that we collect before returning. Otherwise, we never return + */ + +#ifdef CONFIG_NSH_BUILTIN_APPS + long maxbuttons = 1; + g_nbuttons = 0; + if (argc > 1) + { + maxbuttons = strtol(argv[1], NULL, 10); + } + lib_lowprintf("maxbuttons: %d\n", maxbuttons); +#endif + + /* Register to recieve button interrupts */ + +#ifdef CONFIG_ARCH_IRQBUTTONS + for (i = CONFIG_EXAMPLE_IRQBUTTONS_MIN; i <= CONFIG_EXAMPLE_IRQBUTTONS_MAX; i++) + { + xcpt_t oldhandler = up_irqbutton(i, g_buttoninfo[BUTTON_INDEX(i)].handler); + + /* Use lib_lowprintf() for compatibility with interrrupt handler output. */ + + lib_lowprintf("Attached handler at %p to button %d [%s], oldhandler:%p\n", + g_buttoninfo[BUTTON_INDEX(i)].handler, i, + g_buttoninfo[BUTTON_INDEX(i)].name, oldhandler); + + /* Some hardware multiplexes different GPIO button sources to the same + * physical interrupt. If we register multiple such multiplexed button + * interrupts, then the second registration will overwrite the first. In + * this case, the first button interrupts may be aliased to the second + * interrupt handler (or worse, could be lost). + */ + + if (oldhandler != NULL) + { + lib_lowprintf("WARNING: oldhandler:%p is not NULL! " + "Button events may be lost or aliased!\n", + oldhandler); + } + } +#endif + + /* Poll button state */ + + g_oldset = up_buttons(); +#ifdef CONFIG_NSH_BUILTIN_APPS + while (g_nbuttons < maxbuttons) +#else + for (;;) +#endif + { + /* Get the set of pressed and release buttons. */ + + newset = up_buttons(); + + /* Any changes from the last sample? */ + + if (newset != g_oldset) + { + /* Disable interrupts so that output here will not collide with + * output from an interrupt handler. + */ + + flags = irqsave(); + + /* Use lib_lowprintf() for compatibility with interrrupt handler + * output. + */ + + lib_lowprintf("POLL SET:%02x:\n", newset); + show_buttons(g_oldset, newset); + g_oldset = newset; + irqrestore(flags); + } + + /* Sleep a little... but not long. This will determine how fast we + * poll for button changes. + */ + + usleep(150000); /* 150 Milliseconds */ + } + + /* Un-register button handlers */ + +#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_NSH_BUILTIN_APPS) + for (i = CONFIG_EXAMPLE_IRQBUTTONS_MIN; i <= CONFIG_EXAMPLE_IRQBUTTONS_MAX; i++) + { + (void)up_irqbutton(i, NULL); + } +#endif + + return 0; +} + diff --git a/apps/examples/dhcpd/Makefile b/apps/examples/dhcpd/Makefile new file mode 100644 index 0000000000..3254a98067 --- /dev/null +++ b/apps/examples/dhcpd/Makefile @@ -0,0 +1,106 @@ +############################################################################ +# apps/examples/dhcpd/Makefile +# +# Copyright (C) 2009-2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# DHCP Daemon Example + +ASRCS = +CSRCS = target.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# DHCPD built-in application info + +APPNAME = dhcpd +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +.context: +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + @touch $@ +endif + +context: .context + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep + diff --git a/apps/examples/dhcpd/Makefile.host b/apps/examples/dhcpd/Makefile.host new file mode 100644 index 0000000000..19af5f42fb --- /dev/null +++ b/apps/examples/dhcpd/Makefile.host @@ -0,0 +1,62 @@ +############################################################################ +# apps/examples/dhcpd/Makefile.host +# +# Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# TOPDIR must be defined on the make command line + +include $(TOPDIR)/Make.defs + +OBJS = host.o1 dhcpd.o1 +BIN = dhcpd + +HOSTCFLAGS += -DCONFIG_NETUTILS_DHCPD_HOST=1 +HOSTCFLAGS += -DCONFIG_NETUTILS_DHCPD_INTERFACE=\"eth1\" +HOSTCFLAGS += -DHAVE_SO_REUSEADDR=1 +HOSTCFLAGS += -DHAVE_SO_BROADCAST=1 + +VPATH = $(TOPDIR)/netutils/dhcpd:. + +all: $(BIN) +.PHONY: clean context clean_context distclean + +$(OBJS): %.o1: %.c + $(HOSTCC) -c $(HOSTCFLAGS) $< -o $@ + +$(BIN): $(OBJS) + $(HOSTCC) $(HOSTLDFLAGS) $^ -o $@ + +clean: + @rm -f $(BIN).* *.o1 *~ + + diff --git a/apps/examples/dhcpd/host.c b/apps/examples/dhcpd/host.c new file mode 100644 index 0000000000..479a845c10 --- /dev/null +++ b/apps/examples/dhcpd/host.c @@ -0,0 +1,58 @@ +/**************************************************************************** + * examples/dhcpd/host.c + * + * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +extern int dhcpd_run(void); + +/**************************************************************************** + * main + ****************************************************************************/ + +int main(int argc, char **argv, char **envp) +{ + dhcpd_run(); + return 0; +} diff --git a/apps/examples/dhcpd/target.c b/apps/examples/dhcpd/target.c new file mode 100644 index 0000000000..350bfe15ff --- /dev/null +++ b/apps/examples/dhcpd/target.c @@ -0,0 +1,142 @@ +/**************************************************************************** + * examples/dhcpd/target.c + * + * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include +#include + +/**************************************************************************** + * Preprocessor Definitions + ****************************************************************************/ + +/* Configuation Checkes *****************************************************/ +/* BEWARE: + * There are other configuration settings needed in netutils/dhcpd/dhcpdc.c, + * but there are default values for those so we cannot check them here. + */ + +#ifndef CONFIG_EXAMPLE_DHCPD_IPADDR +# error "You must define CONFIG_EXAMPLE_DHCPD_IPADDR" +#endif + +#ifndef CONFIG_EXAMPLE_DHCPD_DRIPADDR +# error "You must define CONFIG_EXAMPLE_DHCPD_DRIPADDR" +#endif + +#ifndef CONFIG_EXAMPLE_DHCPD_NETMASK +# error "You must define CONFIG_EXAMPLE_DHCPD_NETMASK" +#endif + +#ifndef CONFIG_NET +# error "You must define CONFIG_NET" +#endif + +#ifndef CONFIG_NET_UDP +# error "You must define CONFIG_NET_UDP" +#endif + +#ifndef CONFIG_NET_BROADCAST +# error "You must define CONFIG_NET_BROADCAST" +#endif + +/* If CONFIG_NSH_BUILTIN_APPS is defined, then it is assumed that you want + * to execute the DHCPD daemon as an NSH built-in task. + */ + +#ifdef CONFIG_NSH_BUILTIN_APPS +# define MAIN_NAME dhcpd_main +# define MAIN_NAME_STRING "dhcpd_main" +#else +# define MAIN_NAME user_start +# define MAIN_NAME_STRING "user_start" +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Name: user_start/dhcpd_main + ****************************************************************************/ + +int MAIN_NAME(int argc, char *argv[]) +{ + struct in_addr addr; +#if defined(CONFIG_EXAMPLE_DHCPD_NOMAC) + uint8_t mac[IFHWADDRLEN]; +#endif + +/* Many embedded network interfaces must have a software assigned MAC */ + +#ifdef CONFIG_EXAMPLE_DHCPD_NOMAC + mac[0] = 0x00; + mac[1] = 0xe0; + mac[2] = 0xb0; + mac[3] = 0x0b; + mac[4] = 0xba; + mac[5] = 0xbe; + uip_setmacaddr("eth0", mac); +#endif + + /* Set up our host address */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_DHCPD_IPADDR); + uip_sethostaddr("eth0", &addr); + + /* Set up the default router address */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_DHCPD_DRIPADDR); + uip_setdraddr("eth0", &addr); + + /* Setup the subnet mask */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_DHCPD_NETMASK); + uip_setnetmask("eth0", &addr); + + /* Then start the server */ + + dhcpd_run(); + return 0; +} diff --git a/apps/examples/ftpc/Makefile b/apps/examples/ftpc/Makefile new file mode 100644 index 0000000000..ff2ec543b9 --- /dev/null +++ b/apps/examples/ftpc/Makefile @@ -0,0 +1,105 @@ +############################################################################ +# apps/examples/ftpc/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# FTPC Client Application + +APPNAME = ftpc +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 4096 + +ASRCS = +CSRCS = ftpc_main.c ftpc_cmds.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: context depend clean distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +# Register application + +.context: + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + @touch $@ + +context: .context + +# Create dependencies + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f .context Make.dep .depend + +-include Make.dep diff --git a/apps/examples/ftpc/ftpc.h b/apps/examples/ftpc/ftpc.h new file mode 100644 index 0000000000..b6fe35aed1 --- /dev/null +++ b/apps/examples/ftpc/ftpc.h @@ -0,0 +1,112 @@ +/**************************************************************************** + * apps/examples/ftpc/ftpc.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_EXAMPLES_FTPC_FTPC_H +#define __APPS_EXAMPLES_FTPC_FTPC_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include +#include +#include + +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Maximum size of one command line */ + +#ifndef CONFIG_FTPC_LINELEN +# define CONFIG_FTPC_LINELEN 80 +#endif + +/* If CONFIG_STDIO_LINEBUFFER is defined, the STDIO buffer will be flushed + * on each new line. Otherwise, STDIO needs to be explicitly flushed to + * see the output in context. + */ + +#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && \ + CONFIG_STDIO_BUFFER_SIZE > 0 && !defined(CONFIG_STDIO_LINEBUFFER) +# define FFLUSH() fflush(stdout) +#else +# define FFLUSH() +#endif + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +typedef int (*cmd_t)(SESSION handle, int argc, char **argv); + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/* FTP command handlers */ + +extern int cmd_rlogin(SESSION handle, int argc, char **argv); +extern int cmd_rquit(SESSION handle, int argc, char **argv); +extern int cmd_rchdir(SESSION handle, int argc, char **argv); +extern int cmd_rpwd(SESSION handle, int argc, char **argv); +extern int cmd_rcdup(SESSION handle, int argc, char **argv); +extern int cmd_rmkdir(SESSION handle, int argc, char **argv); + +extern int cmd_rrmdir(SESSION handle, int argc, char **argv); +extern int cmd_runlink(SESSION handle, int argc, char **argv); +extern int cmd_rchmod(SESSION handle, int argc, char **argv); +extern int cmd_rrename(SESSION handle, int argc, char **argv); +extern int cmd_rsize(SESSION handle, int argc, char **argv); +extern int cmd_rtime(SESSION handle, int argc, char **argv); +extern int cmd_ridle(SESSION handle, int argc, char **argv); +extern int cmd_rnoop(SESSION handle, int argc, char **argv); +extern int cmd_rhelp(SESSION handle, int argc, char **argv); +extern int cmd_rls(SESSION handle, int argc, char **argv); +extern int cmd_rget(SESSION handle, int argc, char **argv); +extern int cmd_rput(SESSION handle, int argc, char **argv); + +#endif /* __APPS_EXAMPLES_FTPC_FTPC_H */ diff --git a/apps/examples/ftpc/ftpc_cmds.c b/apps/examples/ftpc/ftpc_cmds.c new file mode 100755 index 0000000000..f95f643cbd --- /dev/null +++ b/apps/examples/ftpc/ftpc_cmds.c @@ -0,0 +1,398 @@ +/**************************************************************************** + * examples/ftpc/ftpc_cmds.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include + +#include + +#include "ftpc.h" + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: cmd_rlogin + ****************************************************************************/ + +int cmd_rlogin(SESSION handle, int argc, char **argv) +{ + struct ftpc_login_s login = {NULL, NULL, NULL, true}; + + login.uname = argv[1]; + if (argc > 2) + { + login.pwd = argv[2]; + } + + return ftpc_login(handle, &login); +} + +/**************************************************************************** + * Name: cmd_rquit + ****************************************************************************/ + +int cmd_rquit(SESSION handle, int argc, char **argv) +{ + int ret = ftpc_quit(handle); + if (ret < 0) + { + printf("quit failed: %d\n", errno); + } + printf("Exitting...\n"); + exit(0); + return ERROR; +} + +/**************************************************************************** + * Name: cmd_rchdir + ****************************************************************************/ + +int cmd_rchdir(SESSION handle, int argc, char **argv) +{ + return ftpc_chdir(handle, argv[1]); +} + +/**************************************************************************** + * Name: cmd_rpwd + ****************************************************************************/ + +int cmd_rpwd(SESSION handle, int argc, char **argv) +{ + FAR char *pwd = ftpc_rpwd(handle); + if (pwd) + { + printf("PWD: %s\n", pwd); + free(pwd); + return OK; + } + return ERROR; +} + +/**************************************************************************** + * Name: cmd_rcdup + ****************************************************************************/ + +int cmd_rcdup(SESSION handle, int argc, char **argv) +{ + return ftpc_cdup(handle); +} + +/**************************************************************************** + * Name: cmd_rmkdir + ****************************************************************************/ + +int cmd_rmkdir(SESSION handle, int argc, char **argv) +{ + return ftpc_mkdir(handle, argv[1]); +} + +/**************************************************************************** + * Name: cmd_rrmdir + ****************************************************************************/ + +int cmd_rrmdir(SESSION handle, int argc, char **argv) +{ + return ftpc_rmdir(handle, argv[1]); +} + +/**************************************************************************** + * Name: cmd_runlink + ****************************************************************************/ + +int cmd_runlink(SESSION handle, int argc, char **argv) +{ + return ftpc_unlink(handle, argv[1]); +} + +/**************************************************************************** + * Name: cmd_rchmod + ****************************************************************************/ + +int cmd_rchmod(SESSION handle, int argc, char **argv) +{ + return ftpc_chmod(handle, argv[1], argv[2]); +} + +/**************************************************************************** + * Name: cmd_rrename + ****************************************************************************/ + +int cmd_rrename(SESSION handle, int argc, char **argv) +{ + return ftpc_rename(handle, argv[1], argv[2]); +} + +/**************************************************************************** + * Name: cmd_rsize + ****************************************************************************/ + +int cmd_rsize(SESSION handle, int argc, char **argv) +{ + off_t size = ftpc_filesize(handle, argv[1]); + printf("SIZE: %lu\n", size); + return OK; +} + +/**************************************************************************** + * Name: cmd_rtime + ****************************************************************************/ + +int cmd_rtime(SESSION handle, int argc, char **argv) +{ + time_t filetime = ftpc_filetime(handle, argv[1]); + printf("TIME: %lu\n", (long)filetime); + return OK; +} + +/**************************************************************************** + * Name: cmd_ridle + ****************************************************************************/ + +int cmd_ridle(SESSION handle, int argc, char **argv) +{ + unsigned int idletime = 0; + + if (argc > 1) + { + idletime = atoi(argv[1]); + } + + return ftpc_idle(handle, idletime); +} + +/**************************************************************************** + * Name: cmd_rnoop + ****************************************************************************/ + +int cmd_rnoop(SESSION handle, int argc, char **argv) +{ + return ftpc_noop(handle); +} + +/**************************************************************************** + * Name: cmd_rhelp + ****************************************************************************/ + +int cmd_rhelp(SESSION handle, int argc, char **argv) +{ + FAR const char *cmd = NULL; + int ret; + + if (argc > 1) + { + cmd = argv[1]; + } + + ret = ftpc_help(handle, cmd); + if (ret == OK) + { + FAR char *msg = ftpc_response(handle); + puts(msg); + free(msg); + } + + return ret; +} + +/**************************************************************************** + * Name: cmd_rls + ****************************************************************************/ + +int cmd_rls(SESSION handle, int argc, char **argv) +{ + FAR struct ftpc_dirlist_s *dirlist; + FAR char *dirname = NULL; + int i; + + /* Get the directory listing */ + + if (argc > 1) + { + dirname = argv[1]; + } + + dirlist = ftpc_listdir(handle, dirname); + if (!dirlist) + { + return ERROR; + } + + /* Print the directory listing */ + + printf("%s/\n", dirname ? dirname : "."); + for (i = 0; i < dirlist->nnames; i++) + { + printf(" %s\n", dirlist->name[i]); + } + FFLUSH(); + + /* We are responsible for freeing the directory structure allocated by + * ftpc_listdir(). + */ + + ftpc_dirfree(dirlist); + return OK; +} + +/**************************************************************************** + * Name: cmd_rget + ****************************************************************************/ + +int cmd_rget(SESSION handle, int argc, char **argv) +{ + FAR const char *rname; + FAR const char *lname = NULL; + int xfrmode = FTPC_XFRMODE_ASCII; + int option; + + while ((option = getopt(argc, argv, "ab")) != ERROR) + { + if (option == 'a') + { + xfrmode = FTPC_XFRMODE_ASCII; + } + else if (option == 'b') + { + xfrmode = FTPC_XFRMODE_BINARY; + } + else + { + printf("%s: Unrecognized option: '%c'\n", "put", option); + return ERROR; + } + } + + /* There should be one or two parameters remaining on the command line */ + + if (optind >= argc) + { + printf("%s: Missing required arguments\n", "get"); + return ERROR; + } + + rname = argv[optind]; + optind++; + + if (optind < argc) + { + lname = argv[optind]; + optind++; + } + + if (optind != argc) + { + printf("%s: Too many arguments\n", "get"); + return ERROR; + } + + /* Perform the transfer */ + + return ftpc_getfile(handle, rname, lname, FTPC_GET_NORMAL, xfrmode); +} + +/**************************************************************************** + * Name: cmd_rput + ****************************************************************************/ + +int cmd_rput(SESSION handle, int argc, char **argv) +{ + FAR const char *lname; + FAR const char *rname = NULL; + int xfrmode = FTPC_XFRMODE_ASCII; + int option; + + while ((option = getopt(argc, argv, "ab")) != ERROR) + { + if (option == 'a') + { + xfrmode = FTPC_XFRMODE_ASCII; + } + else if (option == 'b') + { + xfrmode = FTPC_XFRMODE_BINARY; + } + else + { + printf("%s: Unrecognized option: '%c'\n", "put", option); + return ERROR; + } + } + + /* There should be one or two parameters remaining on the command line */ + + if (optind >= argc) + { + printf("%s: Missing required arguments\n", "get"); + return ERROR; + } + + lname = argv[optind]; + optind++; + + if (optind < argc) + { + rname = argv[optind]; + optind++; + } + + if (optind != argc) + { + printf("%s: Too many arguments\n "); + return ERROR; + } + + /* Perform the transfer */ + + return ftp_putfile(handle, lname, rname, FTPC_PUT_NORMAL, xfrmode); +} diff --git a/apps/examples/ftpc/ftpc_main.c b/apps/examples/ftpc/ftpc_main.c new file mode 100755 index 0000000000..7a1cb50f7d --- /dev/null +++ b/apps/examples/ftpc/ftpc_main.c @@ -0,0 +1,426 @@ +/**************************************************************************** + * examples/ftpc/ftpc_main.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include + +#include +#include + +#include "ftpc.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define FTPC_MAX_ARGUMENTS 4 + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +struct cmdmap_s +{ + const char *cmd; /* Name of the command */ + cmd_t handler; /* Function that handles the command */ + uint8_t minargs; /* Minimum number of arguments (including command) */ + uint8_t maxargs; /* Maximum number of arguments (including command) */ + const char *usage; /* Usage instructions for 'help' command */ +}; + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const char g_delim[] = " \t\n"; + +static int cmd_lhelp(SESSION handle, int argc, char **argv); +static int cmd_lunrecognized(SESSION handle, int argc, char **argv); + +static const struct cmdmap_s g_cmdmap[] = +{ + { "cd", cmd_rchdir, 2, 2, "" }, + { "chmod", cmd_rchmod, 3, 3, " " }, + { "get", cmd_rget, 2, 4, "[-a|b] []" }, + { "help", cmd_lhelp, 1, 2, "" }, + { "idle", cmd_ridle, 1, 2, "[]" }, + { "login", cmd_rlogin, 2, 3, " []" }, + { "ls", cmd_rls, 1, 2, "[]" }, + { "quit", cmd_rquit, 1, 1, "" }, + { "mkdir", cmd_rmkdir, 2, 2, "" }, + { "noop", cmd_rnoop, 1, 1, "" }, + { "put", cmd_rput, 2, 4, "[-a|b] []" }, + { "pwd", cmd_rpwd, 1, 1, "" }, + { "rename", cmd_rrename, 3, 3, " " }, + { "rhelp", cmd_rhelp, 1, 2, "[]" }, + { "rm", cmd_runlink, 2, 2, "" }, + { "rmdir", cmd_rrmdir, 2, 2, "" }, + { "size", cmd_rsize, 2, 2, "" }, + { "time", cmd_rtime, 2, 2, "" }, + { "up", cmd_rcdup, 1, 1, "" }, + { NULL, NULL, 1, 1, NULL } +}; + +static char g_line[CONFIG_FTPC_LINELEN]; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: cmd_lhelp + ****************************************************************************/ + +static int cmd_lhelp(SESSION handle, int argc, char **argv) +{ + const struct cmdmap_s *ptr; + + printf("Local FTPC commands:\n"); + for (ptr = g_cmdmap; ptr->cmd; ptr++) + { + if (ptr->usage) + { + printf(" %s %s\n", ptr->cmd, ptr->usage); + } + else + { + printf(" %s\n", ptr->cmd); + } + } + return OK; +} + +/**************************************************************************** + * Name: cmd_lunrecognized + ****************************************************************************/ + +static int cmd_lunrecognized(SESSION handle, int argc, char **argv) +{ + printf("Command %s unrecognized\n", argv[0]); + return ERROR; +} + +/**************************************************************************** + * Name: ftpc_argument + ****************************************************************************/ + +char *ftpc_argument(char **saveptr) +{ + char *pbegin = *saveptr; + char *pend = NULL; + const char *term; + + /* Find the beginning of the next token */ + + for (; + *pbegin && strchr(g_delim, *pbegin) != NULL; + pbegin++); + + /* If we are at the end of the string with nothing + * but delimiters found, then return NULL. + */ + + if (!*pbegin) + { + return NULL; + } + + /* Does the token begin with '#' -- comment */ + + else if (*pbegin == '#') + { + /* Return NULL meaning that we are at the end of the line */ + + *saveptr = pbegin; + pbegin = NULL; + } + else + { + /* Otherwise, we are going to have to parse to find the end of + * the token. Does the token begin with '"'? + */ + + if (*pbegin == '"') + { + /* Yes.. then only another '"' can terminate the string */ + + pbegin++; + term = "\""; + } + else + { + /* No, then any of the usual terminators will terminate the argument */ + + term = g_delim; + } + + /* Find the end of the string */ + + for (pend = pbegin + 1; + *pend && strchr(term, *pend) == NULL; + pend++); + + /* pend either points to the end of the string or to + * the first delimiter after the string. + */ + + if (*pend) + { + /* Turn the delimiter into a null terminator */ + + *pend++ = '\0'; + } + + /* Save the pointer where we left off */ + + *saveptr = pend; + + } + + /* Return the beginning of the token. */ + + return pbegin; +} + +/**************************************************************************** + * Name: ftpc_execute + ****************************************************************************/ + +static int ftpc_execute(SESSION handle, int argc, char *argv[]) +{ + const struct cmdmap_s *cmdmap; + const char *cmd; + cmd_t handler = cmd_lunrecognized; + int ret; + + /* The form of argv is: + * + * argv[0]: The command name. This is argv[0] when the arguments + * are, finally, received by the command handler + * argv[1]: The beginning of argument (up to FTPC_MAX_ARGUMENTS) + * argv[argc]: NULL terminating pointer + */ + + cmd = argv[0]; + + /* See if the command is one that we understand */ + + for (cmdmap = g_cmdmap; cmdmap->cmd; cmdmap++) + { + if (strcmp(cmdmap->cmd, cmd) == 0) + { + /* Check if a valid number of arguments was provided. We + * do this simple, imperfect checking here so that it does + * not have to be performed in each command. + */ + + if (argc < cmdmap->minargs) + { + /* Fewer than the minimum number were provided */ + + printf("Too few arguments for '%s'\n", cmd); + return ERROR; + } + else if (argc > cmdmap->maxargs) + { + /* More than the maximum number were provided */ + + printf("Too many arguments for '%s'\n", cmd); + return ERROR; + } + else + { + /* A valid number of arguments were provided (this does + * not mean they are right). + */ + + handler = cmdmap->handler; + break; + } + } + } + + ret = handler(handle, argc, argv); + if (ret < 0) + { + printf("%s failed: %d\n", cmd, errno); + } + return ret; +} + +/**************************************************************************** + * Name: ftpc_parse + ****************************************************************************/ + +int ftpc_parse(SESSION handle, char *cmdline) +{ + FAR char *argv[FTPC_MAX_ARGUMENTS]; + FAR char *saveptr; + FAR char *cmd; + int argc; + int ret; + + /* Initialize parser state */ + + memset(argv, 0, FTPC_MAX_ARGUMENTS*sizeof(FAR char *)); + + /* Parse out the command at the beginning of the line */ + + saveptr = cmdline; + cmd = ftpc_argument(&saveptr); + + /* Check if any command was provided -OR- if command processing is + * currently disabled. + */ + + if (!cmd) + { + /* An empty line is not an error */ + + return OK; + } + + /* Parse all of the arguments following the command name. */ + + argv[0] = cmd; + for (argc = 1; argc < FTPC_MAX_ARGUMENTS; argc++) + { + argv[argc] = ftpc_argument(&saveptr); + if (!argv[argc]) + { + break; + } + } + argv[argc] = NULL; + + /* Check if the maximum number of arguments was exceeded */ + + if (argc > FTPC_MAX_ARGUMENTS) + { + printf("Too many arguments\n"); + ret = -EINVAL; + } + else + { + /* Then execute the command */ + + ret = ftpc_execute(handle, argc, argv); + } + + return ret; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int ftpc_main(int argc, char **argv, char **envp) +{ + struct ftpc_connect_s connect = {{0}, 0}; + SESSION handle; + FAR char *ptr; + + if (argc != 2) + { + printf("Usage:\n"); + printf(" %s xx.xx.xx.xx[:pp]\n", argv[0]); + printf("Where\n"); + printf(" xx.xx.xx.xx is the IP address of the FTP server\n"); + printf(" pp is option port to use with the FTP server\n"); + exit(1); + } + + /* Check if the argument includes a port number */ + + ptr = strchr(argv[1], ':'); + if (ptr) + { + *ptr = '\0'; + connect.port = atoi(ptr+1); + } + + /* In any event, we can now extract the IP address from the comman-line */ + + connect.addr.s_addr = inet_addr(argv[1]); + + /* Connect to the FTP server */ + + handle = ftpc_connect(&connect); + if (!handle) + { + printf("Failed to connect to the server: %d\n", errno); + exit(1); + } + + /* Present a greeting */ + + printf("NuttX FTP Client:\n"); + FFLUSH(); + + /* Setting optind to -1 is a non-standard, backdoor way to reinitialize + * getopt(). getopt() is not thread safe and we have no idea what state + * it is in now! + */ + + optind = -1; + + /* Then enter the command line parsing loop */ + + for (;;) + { + /* Display the prompt string */ + + fputs("nfc> ", stdout); + FFLUSH(); + + /* Get the next line of input */ + + if (fgets(g_line, CONFIG_FTPC_LINELEN, stdin)) + { + /* Parse process the command */ + + (void)ftpc_parse(handle, g_line); + FFLUSH(); + } + } + + return 0; +} diff --git a/apps/examples/hello/Makefile b/apps/examples/hello/Makefile new file mode 100644 index 0000000000..0798c5f903 --- /dev/null +++ b/apps/examples/hello/Makefile @@ -0,0 +1,93 @@ +############################################################################ +# apps/examples/hello/Makefile +# +# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# Hello, World! Example + +ASRCS = +CSRCS = main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/hello/main.c b/apps/examples/hello/main.c new file mode 100644 index 0000000000..308603f33d --- /dev/null +++ b/apps/examples/hello/main.c @@ -0,0 +1,64 @@ +/**************************************************************************** + * examples/hello/main.c + * + * Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + printf("Hello, World!!\n"); + return 0; +} + diff --git a/apps/examples/helloxx/Makefile b/apps/examples/helloxx/Makefile new file mode 100644 index 0000000000..c34378d249 --- /dev/null +++ b/apps/examples/helloxx/Makefile @@ -0,0 +1,122 @@ +############################################################################ +# apps/examples/helloxx/Makefile +# +# Copyright (C) 2009-2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# Hello, World! C++ Example + +ASRCS = +CSRCS = +CXXSRCS = main.cxx + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) +CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) +OBJS = $(AOBJS) $(COBJS) $(CXXOBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# helloxx built-in application info + +APPNAME = helloxx +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend disclean chkcxx + +chkcxx: +ifneq ($(CONFIG_HAVE_CXX),y) + @echo "" + @echo "In order to use this example, you toolchain must support must" + @echo "" + @echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support" + @echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file" + @echo " of the configuration that you are using." + @echo "" + @exit 1 +endif + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +$(CXXOBJS): %$(OBJEXT): %.cxx + $(call COMPILEXX, $<, $@) + +.built: chkcxx $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +.context: +ifeq ($(CONFIG_EXAMPLES_HELLOXX_BUILTIN),y) + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + @touch $@ +endif + +context: .context + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/helloxx/main.cxx b/apps/examples/helloxx/main.cxx new file mode 100644 index 0000000000..ed48f49616 --- /dev/null +++ b/apps/examples/helloxx/main.cxx @@ -0,0 +1,129 @@ +//*************************************************************************** +// examples/helloxx/main.c +// +// Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. +// Author: Gregory Nutt +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in +// the documentation and/or other materials provided with the +// distribution. +// 3. Neither the name NuttX nor the names of its contributors may be +// used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// +//*************************************************************************** + +//*************************************************************************** +// Included Files +//*************************************************************************** + +#include +#include +#include +#include + +//*************************************************************************** +// Definitions +//*************************************************************************** + +//*************************************************************************** +// Private Classes +//*************************************************************************** + +class CHelloWorld +{ + public: + CHelloWorld(void) : mSecret(42) { lldbg("Constructor\n"); }; + ~CHelloWorld(void) { lldbg("Destructor\n"); }; + + bool HelloWorld(void) + { + if (mSecret != 42) + { + printf("CHelloWorld::HelloWorld: CONSTRUCTION FAILED!\n"); + return false; + } + else + { + printf("CHelloWorld::HelloWorld: Hello, World!!\n"); + return true; + } + }; + + private: + int mSecret; +}; + +//*************************************************************************** +// Private Data +//*************************************************************************** + +#ifndef CONFIG_EXAMPLES_HELLOXX_NOSTATICCONST +static CHelloWorld g_HelloWorld; +#endif + +//*************************************************************************** +// Public Functions +//*************************************************************************** + +//*************************************************************************** +// user_start +//*************************************************************************** + +/**************************************************************************** + * Name: user_start/nxhello_main + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_HELLOXX_BUILTIN +extern "C" int helloxx_main(int argc, char *argv[]); +# define MAIN_NAME helloxx_main +# define MAIN_STRING "helloxx_main: " +#else +# define MAIN_NAME user_start +# define MAIN_STRING "user_start: " +#endif + +int MAIN_NAME(int argc, char *argv[]) +{ +#ifndef CONFIG_EXAMPLES_HELLOXX_NOSTACKCONST + CHelloWorld HelloWorld; +#endif + CHelloWorld *pHelloWorld = new CHelloWorld; + + printf(MAIN_STRING "Saying hello from the dynamically constructed instance\n"); + pHelloWorld->HelloWorld(); + +#ifndef CONFIG_EXAMPLES_HELLOXX_NOSTACKCONST + printf(MAIN_STRING "Saying hello from the instance constructed on the stack\n"); + HelloWorld.HelloWorld(); +#endif + +#ifndef CONFIG_EXAMPLES_HELLOXX_NOSTATICCONST + printf(MAIN_STRING "Saying hello from the statically constructed instance\n"); + g_HelloWorld.HelloWorld(); +#endif + + delete pHelloWorld; + return 0; +} + diff --git a/apps/examples/hidkbd/Makefile b/apps/examples/hidkbd/Makefile new file mode 100644 index 0000000000..e32e628c7d --- /dev/null +++ b/apps/examples/hidkbd/Makefile @@ -0,0 +1,93 @@ +############################################################################ +# apps/examples/hidkbd/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# USB Host HID keyboard Example + +ASRCS = +CSRCS = hidkbd_main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/hidkbd/hidkbd_main.c b/apps/examples/hidkbd/hidkbd_main.c new file mode 100644 index 0000000000..96864b9f9b --- /dev/null +++ b/apps/examples/hidkbd/hidkbd_main.c @@ -0,0 +1,231 @@ +/**************************************************************************** + * examples/hidkbd/null_main.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ +/* Configuration ************************************************************/ + +/* Sanity checking */ + +#ifndef CONFIG_USBHOST +# error "CONFIG_USBHOST is not defined" +#endif + +#ifdef CONFIG_USBHOST_INT_DISABLE +# error "Interrupt endpoints are disabled (CONFIG_USBHOST_INT_DISABLE)" +#endif + +#ifndef CONFIG_NFILE_DESCRIPTORS +# error "CONFIG_NFILE_DESCRIPTORS > 0 needed" +#endif + +/* Provide some default values for other configuration settings */ + +#ifndef CONFIG_EXAMPLES_HIDKBD_DEFPRIO +# define CONFIG_EXAMPLES_HIDKBD_DEFPRIO 50 +#endif + +#ifndef CONFIG_EXAMPLES_HIDKBD_STACKSIZE +# define CONFIG_EXAMPLES_HIDKBD_STACKSIZE 1024 +#endif + +#ifndef CONFIG_EXAMPLES_HIDKBD_DEVNAME +# define CONFIG_EXAMPLES_HIDKBD_DEVNAME "/dev/kbda" +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static struct usbhost_driver_s *g_drvr; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: hidkbd_waiter + * + * Description: + * Wait for USB devices to be connected. + * + ****************************************************************************/ + +static int hidkbd_waiter(int argc, char *argv[]) +{ + bool connected = false; + int ret; + + printf("hidkbd_waiter: Running\n"); + for (;;) + { + /* Wait for the device to change state */ + + ret = DRVR_WAIT(g_drvr, connected); + DEBUGASSERT(ret == OK); + + connected = !connected; + printf("hidkbd_waiter: %s\n", connected ? "connected" : "disconnected"); + + /* Did we just become connected? */ + + if (connected) + { + /* Yes.. enumerate the newly connected device */ + + (void)DRVR_ENUMERATE(g_drvr); + } + } + + /* Keep the compiler from complaining */ + + return 0; +} + +/**************************************************************************** + * Name: user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + char buffer[256]; + pid_t pid; + ssize_t nbytes; + int fd; + int ret; + + /* First, register all of the USB host HID keyboard class driver */ + + printf("user_start: Register class drivers\n"); + ret = usbhost_kbdinit(); + if (ret != OK) + { + printf("user_start: Failed to register the KBD class\n"); + } + + /* Then get an instance of the USB host interface */ + + printf("user_start: Initialize USB host keyboard driver\n"); + g_drvr = usbhost_initialize(0); + if (g_drvr) + { + /* Start a thread to handle device connection. */ + + printf("user_start: Start hidkbd_waiter\n"); + +#ifndef CONFIG_CUSTOM_STACK + pid = task_create("usbhost", CONFIG_EXAMPLES_HIDKBD_DEFPRIO, + CONFIG_EXAMPLES_HIDKBD_STACKSIZE, + (main_t)hidkbd_waiter, (const char **)NULL); +#else + pid = task_create("usbhost", CONFIG_EXAMPLES_HIDKBD_DEFPRIO, + (main_t)hidkbd_waiter, (const char **)NULL); +#endif + + /* Now just sleep. Eventually logic here will open the kbd device and + * perform the HID keyboard test. + */ + + for (;;) + { + /* Open the keyboard device. Loop until the device is successfully + * opened. + */ + + do + { + printf("Opening device %s\n", CONFIG_EXAMPLES_HIDKBD_DEVNAME); + fd = open(CONFIG_EXAMPLES_HIDKBD_DEVNAME, O_RDONLY); + if (fd < 0) + { + printf("Failed: %d\n", errno); + fflush(stdout); + sleep(3); + } + } + while (fd < 0); + + printf("Device %s opened\n", CONFIG_EXAMPLES_HIDKBD_DEVNAME); + fflush(stdout); + + /* Loop until there is a read failure */ + + do + { + /* Read a buffer of data */ + + nbytes = read(fd, buffer, 256); + if (nbytes > 0) + { + /* On success, echo the buffer to stdout */ + + (void)write(1, buffer, nbytes); + } + } + while (nbytes >= 0); + + printf("Closing device %s: %d\n", CONFIG_EXAMPLES_HIDKBD_DEVNAME, (int)nbytes); + fflush(stdout); + close(fd); + } + } + return 0; +} diff --git a/apps/examples/igmp/Makefile b/apps/examples/igmp/Makefile new file mode 100755 index 0000000000..1e8e962239 --- /dev/null +++ b/apps/examples/igmp/Makefile @@ -0,0 +1,93 @@ +############################################################################ +# apps/examples/igmp/Makefile +# +# Copyright (C) 2010 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# IGMP Networking Example + +ASRCS = +CSRCS = igmp.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/igmp/igmp.c b/apps/examples/igmp/igmp.c new file mode 100755 index 0000000000..7f2a8099c0 --- /dev/null +++ b/apps/examples/igmp/igmp.c @@ -0,0 +1,142 @@ +/**************************************************************************** + * examples/igmp/igmp.c + * + * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "igmp.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Check if the destination address is a multicast address + * + * - IPv4: multicast addresses lie in the class D group -- The address range + * 224.0.0.0 to 239.255.255.255 (224.0.0.0/4) + * + * - IPv6 multicast addresses are have the high-order octet of the + * addresses=0xff (ff00::/8.) + */ + +#if ((CONFIG_EXAMPLE_IGMP_GRPADDR & 0xffff0000) < 0xe0000000ul) || \ + ((CONFIG_EXAMPLE_IGMP_GRPADDR & 0xffff0000) > 0xeffffffful) +# error "Bad range for IGMP group address" +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + struct in_addr addr; +#if defined(CONFIG_EXAMPLE_IGMP_NOMAC) + uint8_t mac[IFHWADDRLEN]; +#endif + + message("Configuring Ethernet...\n"); + + /* Many embedded network interfaces must have a software assigned MAC */ + +#ifdef CONFIG_EXAMPLE_IGMP_NOMAC + mac[0] = 0x00; + mac[1] = 0xe0; + mac[2] = 0xb0; + mac[3] = 0x0b; + mac[4] = 0xba; + mac[5] = 0xbe; + uip_setmacaddr("eth0", mac); +#endif + + /* Set up our host address */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_IGMP_IPADDR); + uip_sethostaddr("eth0", &addr); + + /* Set up the default router address */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_IGMP_DRIPADDR); + uip_setdraddr("eth0", &addr); + + /* Setup the subnet mask */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_IGMP_NETMASK); + uip_setnetmask("eth0", &addr); + + /* Not much of a test for now */ + /* Join the group */ + + message("Join group...\n"); + addr.s_addr = HTONL(CONFIG_EXAMPLE_IGMP_GRPADDR); + ipmsfilter("eth0", &addr, MCAST_INCLUDE); + + /* Wait a while */ + + message("Wait for timeout...\n"); + sleep(5); + + /* Leave the group */ + + message("Leave group...\n"); + ipmsfilter("eth0", &addr, MCAST_EXCLUDE); + + /* Wait a while */ + + sleep(5); + message("Exiting...\n"); + return 0; +} diff --git a/apps/examples/igmp/igmp.h b/apps/examples/igmp/igmp.h new file mode 100755 index 0000000000..e241467c6f --- /dev/null +++ b/apps/examples/igmp/igmp.h @@ -0,0 +1,61 @@ +/**************************************************************************** + * examples/igmp/igmp.h + * + * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __EXAMPLES_IGMP_H +#define __EXAMPLES_IGMP_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Used lib_rawprintf() so that there is no confusion from buffered IO */ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# define message(...) lib_rawprintf(__VA_ARGS__) +#else +# define message lib_rawprintf +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#endif /* __EXAMPLES_IGMP_H */ diff --git a/apps/examples/lcdrw/Makefile b/apps/examples/lcdrw/Makefile new file mode 100644 index 0000000000..053c626703 --- /dev/null +++ b/apps/examples/lcdrw/Makefile @@ -0,0 +1,105 @@ +############################################################################ +# apps/examples/lcdrw/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# LCD Read/Write Test + +ASRCS = +CSRCS = lcdrw_main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# LCD R/W built-in application info + +APPNAME = lcdrw +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +.context: +ifeq ($(CONFIG_EXAMPLES_LCDRW_BUILTIN),y) + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + @touch $@ +endif + +context: .context + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/lcdrw/lcdrw_main.c b/apps/examples/lcdrw/lcdrw_main.c new file mode 100644 index 0000000000..4b717666f7 --- /dev/null +++ b/apps/examples/lcdrw/lcdrw_main.c @@ -0,0 +1,262 @@ +/**************************************************************************** + * examples/lcdrw/lcdrw_main.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ +/* Configuration ************************************************************/ +/* Most of the NX configuration settings are probbably *not* needed by this + * example. But, presumeably you are using NX too and so the checks might + * be good for you. + */ + +#ifndef CONFIG_NX +# error "CONFIG_NX must be defined to use this test" +#endif + +#ifndef CONFIG_NX_LCDDRIVER +# error "CONFIG_NX_LCDDRIVER must be defined to use this test" +#endif + +#ifndef CONFIG_EXAMPLES_LCDRW_BPP +# define CONFIG_EXAMPLES_LCDRW_BPP 16 +#endif + +#if CONFIG_EXAMPLES_LCDRW_BPP != 16 +# error "Currently only RGB565 is supported -- feel free to extend" +#endif + +#ifdef CONFIG_NX_DISABLE_16BPP +# error "CONFIG_NX_DISABLE_16BPP disables 16-bit support" +#endif + +#ifndef CONFIG_EXAMPLES_LDCRW_DEVNO +# define CONFIG_EXAMPLES_LDCRW_DEVNO 0 +#endif + +#ifndef CONFIG_EXAMPLES_LDCRW_XRES +# define CONFIG_EXAMPLES_LDCRW_XRES 240 +#endif + +#ifndef CONFIG_EXAMPLES_LDCRW_YRES +# define CONFIG_EXAMPLES_LDCRW_YRES 320 +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct lcdrw_instance_s +{ + /* LCD device handle and planeinfo */ + + FAR struct lcd_dev_s *dev; + struct lcd_planeinfo_s pinfo; +}; + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ +/**************************************************************************** + * Name: lcdrw_initialize + ****************************************************************************/ + +static inline int lcdrw_initialize(FAR struct lcdrw_instance_s *inst) +{ + int ret; + + /* Initialize the LCD device */ + + printf("screens_initialize: Initializing LCD\n"); + ret = up_lcdinitialize(); + if (ret < 0) + { + fprintf(stderr, "screens_initialize: up_lcdinitialize failed: %d\n", -ret); + return ret; + } + + /* Get the device instance. */ + + printf("Get LCD instance\n"); + inst->dev = up_lcdgetdev(CONFIG_EXAMPLES_LDCRW_DEVNO); + if (!inst->dev) + { + fprintf(stderr, "up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_LDCRW_DEVNO); + return ret; + } + + /* Turn the LCD on at 75% power. This should not be necessary. */ + + (void)inst->dev->setpower(inst->dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4)); + + /* Get the planeinfo structure */ + + ret = inst->dev->getplaneinfo(inst->dev, 0, &inst->pinfo); + if (ret < 0) + { + fprintf(stderr, "getplaneinfo failed: %d\n", ret); + } + return ret; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: lcdrw_main/user_start + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_LCDRW_BUILTIN +# define MAIN_NAME lcdrw_main +#else +# define MAIN_NAME user_start +#endif + +int MAIN_NAME(int argc, char *argv[]) +{ + struct lcdrw_instance_s inst; + nxgl_coord_t row; + nxgl_coord_t col; + uint16_t value; + uint32_t offset; + FAR uint16_t *ptr; + int ret; + + /* Initialize the LCD driver */ + + ret = lcdrw_initialize(&inst); + if (ret < 0) + { + exit(1); + } + + /* Then read each line from the LCD and write to the TIFF file */ + + value = 0; + for (row = 0; row < CONFIG_EXAMPLES_LDCRW_YRES; row++) + { + /* Create a dummy row. The important thing is to try all + * bit combinations in a predictable way. + */ + + ptr = (FAR uint16_t*)inst.pinfo.buffer; + for (col = 0; col < CONFIG_EXAMPLES_LDCRW_XRES; col++) + { + *ptr++ = value++; + } + + /* Write the row to the LCD */ + + ret = inst.pinfo.putrun(row, 0, inst.pinfo.buffer, + CONFIG_EXAMPLES_LDCRW_XRES); + if (ret < 0) + { + fprintf(stderr, "putrun failed: %d\n", ret); + exit(1); + } + } + + /* Print a header */ + + printf(" "); + for (col = 0; col < 15; col++) + { + printf("---%x ", col); + } + printf("---f\n"); + + /* Then read each line back from the LCD (this would hook into + * the TIFF file creation library *very* easily to create a + * TIFF file of the returned values). + */ + + offset = 0; + for (row = 0; row < CONFIG_EXAMPLES_LDCRW_YRES; row++) + { + /* Read the row */ + + ret = inst.pinfo.getrun(row, 0, inst.pinfo.buffer, + CONFIG_EXAMPLES_LDCRW_XRES); + if (ret < 0) + { + fprintf(stderr, "getrun failed: %d\n", ret); + exit(1); + } + + /* Then dump the row to the display */ + + ptr = (FAR uint16_t*)inst.pinfo.buffer; + for (col = 0; col < CONFIG_EXAMPLES_LDCRW_XRES; col++) + { + if ((offset & 15) == 0) + { + printf("%06x ", offset); + } + + value = *ptr++; + offset++; + + if ((offset & 15) == 0) + { + printf("%04x\n", value); + } + else + { + printf("%04x ", value); + } + } + } + fflush(stdout); + + return 0; +} + diff --git a/apps/examples/mm/Makefile b/apps/examples/mm/Makefile new file mode 100644 index 0000000000..e5d9ffb4cf --- /dev/null +++ b/apps/examples/mm/Makefile @@ -0,0 +1,93 @@ +############################################################################ +# apps/examples/mm/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# Memory Management Test + +ASRCS = +CSRCS = mm_main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/mm/mm_main.c b/apps/examples/mm/mm_main.c new file mode 100644 index 0000000000..036c390474 --- /dev/null +++ b/apps/examples/mm/mm_main.c @@ -0,0 +1,300 @@ +/**************************************************************************** + * examples/mm/mm_main.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define NTEST_ALLOCS 32 + +/* #define STOP_ON_ERRORS do{}while(0) */ +#define STOP_ON_ERRORS exit(1) + +/* All other definitions derive from these two */ + +#define MM_MIN_SHIFT 4 /* 16 bytes */ +#define MM_MIN_CHUNK (1 << MM_MIN_SHIFT) +#define MM_GRAN_MASK (MM_MIN_CHUNK-1) +#define MM_ALIGN_UP(a) (((a) + MM_GRAN_MASK) & ~MM_GRAN_MASK) +#define MM_ALIGN_DOWN(a) ((a) & ~MM_GRAN_MASK) + +#ifdef CONFIG_SMALL_MEMORY +# define SIZEOF_MM_ALLOCNODE 4 +#else +# define SIZEOF_MM_ALLOCNODE 8 +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ +/* Test allocations */ + +static const int alloc_sizes[NTEST_ALLOCS] = +{ + 1024, 12, 962, 5692, 10254, 111, 9932, 601, + 222, 2746, 3, 124321, 68, 776, 6750, 852, + 4732, 28, 901, 480, 5011, 1536, 2011, 81647, + 646, 1646, 69179, 194, 2590, 7, 969, 70 +}; + +static const int realloc_sizes[NTEST_ALLOCS] = +{ + 18, 3088, 963, 123, 511, 11666, 3723, 42, + 9374, 1990, 1412, 6, 592, 4088, 11, 5040, + 8663, 91255, 28, 4346, 9172, 168, 229, 4734, + 59139, 221, 7830, 30421, 1666, 4, 812, 416 +}; + +static const int random1[NTEST_ALLOCS] = +{ + 20, 11, 3, 31, 9, 29, 7, 17, + 21, 2, 26, 18, 14, 25, 0, 10, + 27, 19, 22, 28, 8, 30, 12, 15, + 4, 1, 24, 6, 16, 13, 5, 23 +}; + +static const int random2[NTEST_ALLOCS] = +{ + 2, 19, 12, 23, 30, 11, 27, 4, + 20, 7, 0, 16, 28, 15, 5, 24, + 10, 17, 25, 31, 8, 29, 3, 26, + 9, 18, 22, 13, 1, 21, 14, 6 +}; + +static const int random3[NTEST_ALLOCS] = +{ + 8, 17, 3, 18, 26, 23, 30, 11, + 12, 22, 4, 20, 25, 10, 27, 1, + 29, 14, 19, 21, 0, 31, 7, 24, + 9, 15, 2, 28, 16, 6, 13, 5 +}; + +static const int alignment[NTEST_ALLOCS/2] = +{ + 128, 2048, 131072, 8192, 32, 32768, 16384 , 262144, + 512, 4096, 65536, 8, 64, 1024, 16, 4 +}; + +static void *allocs[NTEST_ALLOCS]; +static struct mallinfo alloc_info; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static void mm_showmallinfo(void) +{ + alloc_info = mallinfo(); + printf(" mallinfo:\n"); + printf(" Total space allocated from system = %ld\n", + alloc_info.arena); + printf(" Number of non-inuse chunks = %ld\n", + alloc_info.ordblks); + printf(" Largest non-inuse chunk = %ld\n", + alloc_info.mxordblk); + printf(" Total allocated space = %ld\n", + alloc_info.uordblks); + printf(" Total non-inuse space = %ld\n", + alloc_info.fordblks); +} + +static void do_mallocs(void **mem, const int *size, const int *seq, int n) +{ + int i; + int j; + + for (i = 0; i < n; i++) + { + j = seq[i]; + if (!mem[j]) + { + printf("(%d)Allocating %d bytes\n", i, size[j]); + mem[j] = malloc(size[j]); + printf("(%d)Memory allocated at %p\n", i, mem[j]); + if (mem[j] == NULL) + { + int allocsize = MM_ALIGN_UP(size[j] + SIZEOF_MM_ALLOCNODE); + fprintf(stderr, "(%d)malloc failed for allocsize=%d\n", i, allocsize); + if (allocsize > alloc_info.mxordblk) + { + fprintf(stderr, " Normal, largest free block is only %ld\n", alloc_info.mxordblk); + } + else + { + fprintf(stderr, " ERROR largest free block is %ld\n", alloc_info.mxordblk); + exit(1); + } + } + else + { + memset(mem[j], 0xAA, size[j]); + } + + mm_showmallinfo(); + } + } +} + +static void do_reallocs(void **mem, const int *oldsize, const int *newsize, const int *seq, int n) +{ + int i; + int j; + + for (i = 0; i < n; i++) + { + j = seq[i]; + printf("(%d)Re-allocating at %p from %d to %d bytes\n", + i, mem[j], oldsize[j], newsize[j]); + mem[j] = realloc(mem[j], newsize[j]); + printf("(%d)Memory re-allocated at %p\n", i, mem[j]); + if (mem[j] == NULL) + { + int allocsize = MM_ALIGN_UP(newsize[j] + SIZEOF_MM_ALLOCNODE); + fprintf(stderr, "(%d)realloc failed for allocsize=%d\n", i, allocsize); + if (allocsize > alloc_info.mxordblk) + { + fprintf(stderr, " Normal, largest free block is only %ld\n", alloc_info.mxordblk); + } + else + { + fprintf(stderr, " ERROR largest free block is %ld\n", alloc_info.mxordblk); + exit(1); + } + } + else + { + memset(mem[j], 0x55, newsize[j]); + } + + mm_showmallinfo(); + } +} + +static void do_memaligns(void **mem, const int *size, const int *align, const int *seq, int n) +{ + int i; + int j; + + for (i = 0; i < n; i++) + { + j = seq[i]; + printf("(%d)Allocating %d bytes aligned to 0x%08x\n", + i, size[j], align[i]); + mem[j] = memalign(align[i], size[j]); + printf("(%d)Memory allocated at %p\n", i, mem[j]); + if (mem[j] == NULL) + { + int allocsize = MM_ALIGN_UP(size[j] + SIZEOF_MM_ALLOCNODE) + 2*align[i]; + fprintf(stderr, "(%d)memalign failed for allocsize=%d\n", i, allocsize); + if (allocsize > alloc_info.mxordblk) + { + fprintf(stderr, " Normal, largest free block is only %ld\n", alloc_info.mxordblk); + } + else + { + fprintf(stderr, " ERROR largest free block is %ld\n", alloc_info.mxordblk); + exit(1); + } + } + else + { + memset(mem[j], 0x33, size[j]); + } + + mm_showmallinfo(); + } +} + +static void do_frees(void **mem, const int *size, const int *seq, int n) +{ + int i; + int j; + + for (i = 0; i < n; i++) + { + j = seq[i]; + printf("(%d)Releasing memory at %p (size=%d bytes)\n", + i, mem[j], size[j]); + free(mem[j]); + mem[j] = NULL; + + mm_showmallinfo(); + } +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + mm_showmallinfo(); + + /* Allocate some memory */ + + do_mallocs(allocs, alloc_sizes, random1, NTEST_ALLOCS); + + /* Re-allocate the memory */ + + do_reallocs(allocs, alloc_sizes, realloc_sizes, random2, NTEST_ALLOCS); + + /* Release the memory */ + + do_frees(allocs, realloc_sizes, random3, NTEST_ALLOCS); + + /* Allocate aligned memory */ + + do_memaligns(allocs, alloc_sizes, alignment, random2, NTEST_ALLOCS/2); + do_memaligns(allocs, alloc_sizes, alignment, &random2[NTEST_ALLOCS/2], NTEST_ALLOCS/2); + + /* Release aligned memory */ + + do_frees(allocs, alloc_sizes, random1, NTEST_ALLOCS); + + printf("TEST COMPLETE\n"); + return 0; +} diff --git a/apps/examples/mount/Makefile b/apps/examples/mount/Makefile new file mode 100644 index 0000000000..7e48ea44a9 --- /dev/null +++ b/apps/examples/mount/Makefile @@ -0,0 +1,93 @@ +############################################################################ +# apps/Makefile +# +# Copyright (C) 2007-2008, 2010-2010 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# mount() test + +ASRCS = +CSRCS = mount_main.c ramdisk.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/mount/mount.h b/apps/examples/mount/mount.h new file mode 100644 index 0000000000..68a03674da --- /dev/null +++ b/apps/examples/mount/mount.h @@ -0,0 +1,96 @@ +/**************************************************************************** + * examples/mount/mount.h + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __EXAMPLES_MOUNT_MOUNT_H +#define __EXAMPLES_MOUNT_MOUNT_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Configure the test */ + +#if defined(CONFIG_EXAMPLES_MOUNT_DEVNAME) +# if !defined(CONFIG_FS_WRITABLE) +# error "Writable filesystem required in this configuration" +# endif +# undef CONFIG_EXAMPLES_MOUNT_NSECTORS +# undef CONFIG_EXAMPLES_MOUNT_SECTORSIZE +# undef CONFIG_EXAMPLES_MOUNT_RAMDEVNO +# define MOUNT_DEVNAME CONFIG_EXAMPLES_MOUNT_DEVNAME +#else +# if !defined(CONFIG_FS_FAT) +# error "CONFIG_FS_FAT required in this configuration" +# endif +# if !defined(CONFIG_EXAMPLES_MOUNT_SECTORSIZE) +# define CONFIG_EXAMPLES_MOUNT_SECTORSIZE 512 +# endif +# if !defined(CONFIG_EXAMPLES_MOUNT_NSECTORS) +# define CONFIG_EXAMPLES_MOUNT_NSECTORS 2048 +# endif +# if !defined(CONFIG_EXAMPLES_MOUNT_RAMDEVNO) +# define CONFIG_EXAMPLES_MOUNT_RAMDEVNO 0 +# endif +# define STR_RAMDEVNO(m) #m +# define MKMOUNT_DEVNAME(m) "/dev/ram" STR_RAMDEVNO(m) +# define MOUNT_DEVNAME MKMOUNT_DEVNAME(CONFIG_EXAMPLES_MOUNT_RAMDEVNO) +#endif + + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +extern const char g_source[]; /* Mount 'source' path */ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifndef CONFIG_EXAMPLES_MOUNT_DEVNAME +extern int create_ramdisk(void); +#endif + +#endif /* __EXAMPLES_MOUNT_MOUNT_H */ diff --git a/apps/examples/mount/mount_main.c b/apps/examples/mount/mount_main.c new file mode 100644 index 0000000000..00070b94c0 --- /dev/null +++ b/apps/examples/mount/mount_main.c @@ -0,0 +1,754 @@ +/**************************************************************************** + * examples/mount/mount_main.c + * + * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "mount.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#define TEST_USE_STAT 1 +#define TEST_SHOW_DIRECTORIES 1 +#define TEST_USE_STATFS 1 + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const char g_mntdir[] = "/mnt"; +static const char g_target[] = "/mnt/fs"; +static const char g_filesystemtype[] = "vfat"; + +static const char g_testdir1[] = "/mnt/fs/TestDir"; +static const char g_testdir2[] = "/mnt/fs/NewDir1"; +static const char g_testdir3[] = "/mnt/fs/NewDir2"; +static const char g_testdir4[] = "/mnt/fs/NewDir3"; +#ifdef CONFIG_EXAMPLES_MOUNT_DEVNAME +static const char g_testfile1[] = "/mnt/fs/TestDir/TestFile.txt"; +#endif +static const char g_testfile2[] = "/mnt/fs/TestDir/WrTest1.txt"; +static const char g_testfile3[] = "/mnt/fs/NewDir1/WrTest2.txt"; +static const char g_testfile4[] = "/mnt/fs/NewDir3/Renamed.txt"; +static const char g_testmsg[] = "This is a write test"; + +static int g_nerrors = 0; + +static char g_namebuffer[256]; + +/**************************************************************************** + * Public Data + ****************************************************************************/ + + const char g_source[] = MOUNT_DEVNAME; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +#ifdef TEST_USE_STAT +static void show_stat(const char *path, struct stat *ps) +{ + printf("%s stat:\n", path); + printf("\tmode : %08x\n", ps->st_mode); + if (S_ISREG(ps->st_mode)) + { + printf("\ttype : File\n"); + } + else if (S_ISDIR(ps->st_mode)) + { + printf("\ttype : Directory\n"); + } + else if (S_ISCHR(ps->st_mode)) + { + printf("\ttype : Character driver\n"); + } + else if (S_ISBLK(ps->st_mode)) + { + printf("\ttype : Block driver\n"); + } + else + { + printf("\ttype : Unknown\n"); + } + + printf("\tsize : %d (bytes)\n", ps->st_size); + printf("\tblock size : %d (bytes)\n", ps->st_blksize); + printf("\tsize : %d (blocks)\n", ps->st_blocks); + printf("\taccess time : %d\n", ps->st_atime); + printf("\tmodify time : %d\n", ps->st_mtime); + printf("\tchange time : %d\n", ps->st_ctime); +} +#endif + +/**************************************************************************** + * Name: show_statfs + ****************************************************************************/ + +#ifdef TEST_USE_STATFS +static void show_statfs(const char *path) +{ + struct statfs buf; + int ret; + + /* Try stat() against a file or directory. It should fail with expectederror */ + + printf("show_statfs: Try statfs(%s)\n", path); + ret = statfs(path, &buf); + if (ret == 0) + { + printf("show_statfs: statfs(%s) succeeded\n", path); + printf("\tFS Type : %0x\n", buf.f_type); + printf("\tBlock size : %d\n", buf.f_bsize); + printf("\tNumber of blocks : %d\n", buf.f_blocks); + printf("\tFree blocks : %d\n", buf.f_bfree); + printf("\tFree user blocks : %d\n", buf.f_bavail); + printf("\tNumber file nodes : %d\n", buf.f_files); + printf("\tFree file nodes : %d\n", buf.f_ffree); + printf("\tFile name length : %d\n", buf.f_namelen); + } + else + { + printf("show_statfs: ERROR statfs(%s) failed with errno=%d\n", + path, errno); + g_nerrors++; + } +} +#else +# define show_statfs(p) +#endif + +/**************************************************************************** + * Name: show_directories + ****************************************************************************/ + +#ifdef TEST_SHOW_DIRECTORIES +static void show_directories(const char *path, int indent) +{ + DIR *dirp; + struct dirent *direntry; + int i; + + dirp = opendir(path); + if ( !dirp ) + { + printf("show_directories: ERROR opendir(\"%s\") failed with errno=%d\n", + path, errno); + g_nerrors++; + return; + } + + for (direntry = readdir(dirp); direntry; direntry = readdir(dirp)) + { + for (i = 0; i < 2*indent; i++) + { + putchar(' '); + } + if (DIRENT_ISDIRECTORY(direntry->d_type)) + { + char *subdir; + printf("%s/\n", direntry->d_name); + sprintf(g_namebuffer, "%s/%s", path, direntry->d_name); + subdir = strdup(g_namebuffer); + show_directories( subdir, indent + 1); + free(subdir); + } + else + { + printf("%s\n", direntry->d_name); + } + } + + closedir(dirp); +} +#else +# define show_directories(p,i) +#endif + +/**************************************************************************** + * Name: fail_read_open + ****************************************************************************/ +#ifdef CONFIG_EXAMPLES_MOUNT_DEVNAME +static void fail_read_open(const char *path, int expectederror) +{ + int fd; + + printf("fail_read_open: Try open(%s) for reading\n", path); + + fd = open(path, O_RDONLY); + if (fd >= 0) + { + printf("fail_read_open: ERROR open(%s) succeeded\n", path); + g_nerrors++; + close(fd); + } + else if (errno != expectederror) + { + printf("fail_read_open: ERROR open(%s) failed with errno=%d (expected %d)\n", + path, errno, expectederror); + g_nerrors++; + } +} +#endif + +/**************************************************************************** + * Name: read_test_file + ****************************************************************************/ + +static void read_test_file(const char *path) +{ + char buffer[128]; + int nbytes; + int fd; + + /* Read a test file that is already on the test file system image */ + + printf("read_test_file: opening %s for reading\n", path); + + fd = open(path, O_RDONLY); + if (fd < 0) + { + printf("read_test_file: ERROR failed to open %s, errno=%d\n", + path, errno); + g_nerrors++; + } + else + { + memset(buffer, 0, 128); + nbytes = read(fd, buffer, 128); + if (nbytes < 0) + { + printf("read_test_file: ERROR failed to read from %s, errno=%d\n", + path, errno); + g_nerrors++; + } + else + { + buffer[127]='\0'; + printf("read_test_file: Read \"%s\" from %s\n", buffer, path); + } + close(fd); + } +} + +/**************************************************************************** + * Name: write_test_file + ****************************************************************************/ + +static void write_test_file(const char *path) +{ + int fd; + + /* Write a test file into a pre-existing file on the test file system */ + + printf("write_test_file: opening %s for writing\n", path); + + fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0644); + if (fd < 0) + { + printf("write_test_file: ERROR failed to open %s for writing, errno=%d\n", + path, errno); + g_nerrors++; + } + else + { + int nbytes = write(fd, g_testmsg, strlen(g_testmsg)); + if (nbytes < 0) + { + printf("write_test_file: ERROR failed to write to %s, errno=%d\n", + path, errno); + g_nerrors++; + } + else + { + printf("write_test_file: wrote %d bytes to %s\n", nbytes, path); + } + close(fd); + } +} + +/**************************************************************************** + * Name: fail_mkdir + ****************************************************************************/ + +static void fail_mkdir(const char *path, int expectederror) +{ + int ret; + + /* Try mkdir() against a file or directory. It should fail with expectederror */ + + printf("fail_mkdir: Try mkdir(%s)\n", path); + + ret = mkdir(path, 0666); + if (ret == 0) + { + printf("fail_mkdir: ERROR mkdir(%s) succeeded\n", path); + g_nerrors++; + } + else if (errno != expectederror) + { + printf("fail_mkdir: ERROR mkdir(%s) failed with errno=%d (expected %d)\n", + path, errno, expectederror); + g_nerrors++; + } +} + +/**************************************************************************** + * Name: succeed_mkdir + ****************************************************************************/ + +static void succeed_mkdir(const char *path) +{ + int ret; + + printf("succeed_mkdir: Try mkdir(%s)\n", path); + + ret = mkdir(path, 0666); + if (ret != 0) + { + printf("succeed_mkdir: ERROR mkdir(%s) failed with errno=%d\n", + path, errno); + g_nerrors++; + } +} + +/**************************************************************************** + * Name: fail_rmdir + ****************************************************************************/ + +static void fail_rmdir(const char *path, int expectederror) +{ + int ret; + + /* Try rmdir() against a file or directory. It should fail with expectederror */ + + printf("fail_rmdir: Try rmdir(%s)\n", path); + + ret = rmdir(path); + if (ret == 0) + { + printf("fail_rmdir: ERROR rmdir(%s) succeeded\n", path); + g_nerrors++; + } + else if (errno != expectederror) + { + printf("fail_rmdir: ERROR rmdir(%s) failed with errno=%d (expected %d)\n", + path, errno, expectederror); + g_nerrors++; + } +} + +/**************************************************************************** + * Name: succeed_rmdir + ****************************************************************************/ + +static void succeed_rmdir(const char *path) +{ + int ret; + + printf("succeed_rmdir: Try rmdir(%s)\n", path); + + ret = rmdir(path); + if (ret != 0) + { + printf("succeed_rmdir: ERROR rmdir(%s) failed with errno=%d\n", + path, errno); + g_nerrors++; + } +} + +/**************************************************************************** + * Name: fail_unlink + ****************************************************************************/ + +static void fail_unlink(const char *path, int expectederror) +{ + int ret; + + /* Try unlink() against a file or directory. It should fail with expectederror */ + + printf("fail_unlink: Try unlink(%s)\n", path); + + ret = unlink(path); + if (ret == 0) + { + printf("fail_unlink: ERROR unlink(%s) succeeded\n", path); + g_nerrors++; + } + else if (errno != expectederror) + { + printf("fail_unlink: ERROR unlink(%s) failed with errno=%d (expected %d)\n", + path, errno, expectederror); + g_nerrors++; + } +} + +/**************************************************************************** + * Name: succeed_unlink + ****************************************************************************/ + +static void succeed_unlink(const char *path) +{ + int ret; + + /* Try unlink() against the test file. It should succeed. */ + + printf("succeed_unlink: Try unlink(%s)\n", path); + + ret = unlink(path); + if (ret != 0) + { + printf("succeed_unlink: ERROR unlink(%s) failed with errno=%d\n", + path, errno); + g_nerrors++; + } +} + +/**************************************************************************** + * Name: fail_rename + ****************************************************************************/ + +static void fail_rename(const char *oldpath, const char *newpath, int expectederror) +{ + int ret; + + /* Try rename() against a file or directory. It should fail with expectederror */ + + printf("fail_rename: Try rename(%s->%s)\n", oldpath, newpath); + + ret = rename(oldpath, newpath); + if (ret == 0) + { + printf("fail_rename: ERROR rename(%s->%s) succeeded\n", + oldpath, newpath); + g_nerrors++; + } + else if (errno != expectederror) + { + printf("fail_rename: ERROR rename(%s->%s) failed with errno=%d (expected %d)\n", + oldpath, newpath, errno, expectederror); + g_nerrors++; + } +} + +/**************************************************************************** + * Name: succeed_rename + ****************************************************************************/ + +static void succeed_rename(const char *oldpath, const char *newpath) +{ + int ret; + + printf("succeed_rename: Try rename(%s->%s)\n", oldpath, newpath); + + ret = rename(oldpath, newpath); + if (ret != 0) + { + printf("succeed_rename: ERROR rename(%s->%s) failed with errno=%d\n", + oldpath, newpath, errno); + g_nerrors++; + } +} + +/**************************************************************************** + * Name: fail_stat + ****************************************************************************/ + +#ifdef TEST_USE_STAT +static void fail_stat(const char *path, int expectederror) +{ + struct stat buf; + int ret; + + /* Try stat() against a file or directory. It should fail with expectederror */ + + printf("fail_stat: Try stat(%s)\n", path); + + ret = stat(path, &buf); + if (ret == 0) + { + printf("fail_stat: ERROR stat(%s) succeeded\n", path); + show_stat(path, &buf); + g_nerrors++; + } + else if (errno != expectederror) + { + printf("fail_stat: ERROR stat(%s) failed with errno=%d (expected %d)\n", + path, errno, expectederror); + g_nerrors++; + } +} +#else +# define fail_stat(p,e); +#endif + +/**************************************************************************** + * Name: succeed_stat + ****************************************************************************/ + +#ifdef TEST_USE_STAT +static void succeed_stat(const char *path) +{ + struct stat buf; + int ret; + + printf("succeed_stat: Try stat(%s)\n", path); + + ret = stat(path, &buf); + if (ret != 0) + { + printf("succeed_stat: ERROR stat(%s) failed with errno=%d\n", + path, errno); + g_nerrors++; + } + else + { + printf("succeed_stat: stat(%s) succeeded\n", path); + show_stat(path, &buf); + } +} +#else +#define succeed_stat(p) +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + int ret; + +#ifndef CONFIG_EXAMPLES_MOUNT_DEVNAME + /* Create a RAM disk for the test */ + + ret = create_ramdisk(); + if (ret < 0) + { + printf("user_start: ERROR failed to create RAM disk\n"); + return 1; + } +#endif + + /* Mount the test file system (see arch/sim/src/up_deviceimage.c */ + + printf("user_start: mounting %s filesystem at target=%s with source=%s\n", + g_filesystemtype, g_target, g_source); + + ret = mount(g_source, g_target, g_filesystemtype, 0, NULL); + printf("user_start: mount() returned %d\n", ret); + + if (ret == 0) + { + show_statfs(g_mntdir); + show_statfs(g_target); + +#ifdef CONFIG_EXAMPLES_MOUNT_DEVNAME + /* Read a test file that is already on the test file system image */ + + show_directories("", 0); + succeed_stat(g_testfile1); + show_statfs(g_testfile1); + read_test_file(g_testfile1); +#else + /* Create the test directory that would have been on the canned filesystem */ + + succeed_mkdir(g_testdir1); + show_directories("", 0); + succeed_stat(g_testdir1); + show_statfs(g_testdir1); +#endif + + /* Write a test file into a pre-existing directory on the test file system */ + + fail_stat(g_testfile2, ENOENT); + write_test_file(g_testfile2); + show_directories("", 0); + succeed_stat(g_testfile2); + show_statfs(g_testfile2); + + /* Read the file that we just wrote */ + + read_test_file(g_testfile2); + + /* Try rmdir() against a file on the directory. It should fail with ENOTDIR */ +#ifdef CONFIG_EXAMPLES_MOUNT_DEVNAME + fail_rmdir(g_testfile1, ENOTDIR); +#endif + + /* Try rmdir() against the test directory. It should fail with ENOTEMPTY */ + + fail_rmdir(g_testdir1, ENOTEMPTY); + + /* Try unlink() against the test directory. It should fail with EISDIR */ + + fail_unlink(g_testdir1, EISDIR); + + /* Try unlink() against the test file1. It should succeed. */ +#ifdef CONFIG_EXAMPLES_MOUNT_DEVNAME + succeed_unlink(g_testfile1); + fail_stat(g_testfile1, ENOENT); + show_directories("", 0); +#endif + + /* Attempt to open testfile1 should fail with ENOENT */ +#ifdef CONFIG_EXAMPLES_MOUNT_DEVNAME + fail_read_open(g_testfile1, ENOENT); +#endif + /* Try rmdir() against the test directory. It should still fail with ENOTEMPTY */ + + fail_rmdir(g_testdir1, ENOTEMPTY); + + /* Try mkdir() against the test file2. It should fail with EEXIST. */ + + fail_mkdir(g_testfile2, EEXIST); + + /* Try unlink() against the test file2. It should succeed. */ + + succeed_unlink(g_testfile2); + show_directories("", 0); + fail_stat(g_testfile2, ENOENT); + + /* Try mkdir() against the test dir1. It should fail with EEXIST. */ + + fail_mkdir(g_testdir1, EEXIST); + + /* Try rmdir() against the test directory. mkdir should now succeed. */ + + succeed_rmdir(g_testdir1); + show_directories("", 0); + fail_stat(g_testdir1, ENOENT); + + /* Try mkdir() against the test dir2. It should succeed */ + + succeed_mkdir(g_testdir2); + show_directories("", 0); + succeed_stat(g_testdir2); + show_statfs(g_testdir2); + + /* Try mkdir() against the test dir2. It should fail with EXIST */ + + fail_mkdir(g_testdir2, EEXIST); + + /* Write a test file into a new directory on the test file system */ + + fail_stat(g_testfile3, ENOENT); + write_test_file(g_testfile3); + show_directories("", 0); + succeed_stat(g_testfile3); + show_statfs(g_testfile3); + + /* Read the file that we just wrote */ + + read_test_file(g_testfile3); + + /* Use mkdir() to create test dir3. It should succeed */ + + fail_stat(g_testdir3, ENOENT); + succeed_mkdir(g_testdir3); + show_directories("", 0); + succeed_stat(g_testdir3); + show_statfs(g_testdir3); + + /* Try rename() on the root directory. Should fail with EXDEV*/ + + fail_rename(g_target, g_testdir4, EXDEV); + + /* Try rename() to an existing directory. Should fail with EEXIST */ + + fail_rename(g_testdir2, g_testdir3, EEXIST); + + /* Try rename() to a non-existing directory. Should succeed */ + + fail_stat(g_testdir4, ENOENT); + succeed_rename(g_testdir3, g_testdir4); + show_directories("", 0); + fail_stat(g_testdir3, ENOENT); + succeed_stat(g_testdir4); + show_statfs(g_testdir4); + + /* Try rename() of file. Should work. */ + + fail_stat(g_testfile4, ENOENT); + succeed_rename(g_testfile3, g_testfile4); + show_directories("", 0); + fail_stat(g_testfile3, ENOENT); + succeed_stat(g_testfile4); + show_statfs(g_testfile4); + + /* Make sure that we can still read the renamed file */ + + read_test_file(g_testfile4); + + /* Unmount the file system */ + + printf("user_start: Try unmount(%s)\n", g_target); + + ret = umount(g_target); + if (ret != 0) + { + printf("user_start: ERROR umount() failed, errno %d\n", errno); + g_nerrors++; + } + + printf("user_start: %d errors reported\n", g_nerrors); + } + + fflush(stdout); + return 0; +} diff --git a/apps/examples/mount/ramdisk.c b/apps/examples/mount/ramdisk.c new file mode 100644 index 0000000000..f596dae525 --- /dev/null +++ b/apps/examples/mount/ramdisk.c @@ -0,0 +1,141 @@ +/**************************************************************************** + * examples/mount/ramdisk.c + * + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include "mount.h" + +#ifndef CONFIG_EXAMPLES_MOUNT_DEVNAME + +/**************************************************************************** + * Private Definitions + ****************************************************************************/ + +#define BUFFER_SIZE (CONFIG_EXAMPLES_MOUNT_NSECTORS*CONFIG_EXAMPLES_MOUNT_SECTORSIZE) + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static struct fat_format_s g_fmt = FAT_FORMAT_INITIALIZER; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: create_ramdisk + * + * Description: + * Create a RAM disk of the specified size formatting with a FAT file + * system + * + * Input Parameters: + * None + * + * Return: + * Zero on success, a negated errno on failure. + * + ****************************************************************************/ + +int create_ramdisk(void) +{ + char *pbuffer; + int ret; + + /* Allocate a buffer to hold the file system image. */ + + pbuffer = (char*)malloc(BUFFER_SIZE); + if (!pbuffer) + { + printf("create_ramdisk: Failed to allocate ramdisk of size %d\n", + BUFFER_SIZE); + return -ENOMEM; + } + + /* Register a RAMDISK device to manage this RAM image */ + + ret = ramdisk_register(CONFIG_EXAMPLES_MOUNT_RAMDEVNO, + pbuffer, + CONFIG_EXAMPLES_MOUNT_NSECTORS, + CONFIG_EXAMPLES_MOUNT_SECTORSIZE, + true); + if (ret < 0) + { + printf("create_ramdisk: Failed to register ramdisk at %s: %d\n", + g_source, -ret); + free(pbuffer); + return ret; + } + + /* Create a FAT filesystem on the ramdisk */ + + ret = mkfatfs(g_source, &g_fmt); + if (ret < 0) + { + printf("create_ramdisk: Failed to create FAT filesystem on ramdisk at %s\n", + g_source); + /* free(pbuffer); -- RAM disk is registered */ + return ret; + } + + return 0; +} +#endif /* !CONFIG_EXAMPLES_MOUNT_DEVNAME */ diff --git a/apps/examples/nettest/Makefile b/apps/examples/nettest/Makefile new file mode 100644 index 0000000000..ac07665ab1 --- /dev/null +++ b/apps/examples/nettest/Makefile @@ -0,0 +1,142 @@ +############################################################################ +# examples/nettest/Makefile +# +# Copyright (C) 2007-2008, 2010-2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# Basic TCP networking test + +TARG_ASRCS = +TARG_AOBJS = $(TARG_ASRCS:.S=$(OBJEXT)) + +TARG_CSRCS = nettest.c +ifeq ($(CONFIG_EXAMPLE_NETTEST_SERVER),y) +TARG_CSRCS += nettest_server.c +else +TARG_CSRCS += nettest_client.c +endif + +TARG_COBJS = $(TARG_CSRCS:.c=$(OBJEXT)) + +TARG_SRCS = $(TARG_ASRCS) $(TARG_CSRCS) +TARG_OBJS = $(TARG_AOBJS) $(TARG_COBJS) + +TARG_POSIX = "$(APPDIR)/libapps$(LIBEXT)" +ifeq ($(WINTOOL),y) + TARG_BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + TARG_BIN = "$(TARG_POSIX)" +endif + +HOSTCFLAGS += -DCONFIG_EXAMPLE_NETTEST_HOST=1 +ifeq ($(CONFIG_EXAMPLE_NETTEST_SERVER),y) +HOSTCFLAGS += -DCONFIG_EXAMPLE_NETTEST_SERVER=1 \ + -DCONFIG_EXAMPLE_NETTEST_CLIENTIP="$(CONFIG_EXAMPLE_NETTEST_CLIENTIP)" +endif +ifeq ($(CONFIG_EXAMPLE_NETTEST_PERFORMANCE),y) +HOSTCFLAGS += -DCONFIG_EXAMPLE_NETTEST_PERFORMANCE=1 +endif + + + +HOST_SRCS = host.c +ifeq ($(CONFIG_EXAMPLE_NETTEST_SERVER),y) +HOST_SRCS += nettest_client.c +else +HOST_SRCS += nettest_server.c +endif + +HOST_OBJS = $(HOST_SRCS:.c=.o) +HOST_BIN = host + +ROOTDEPPATH = --dep-path . + +# NET test built-in application info + +APPNAME = nettest +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +# Common build + +VPATH = + +all: .built $(HOST_BIN) +.PHONY: clean depend disclean + +$(TARG_AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(TARG_COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +$(HOST_OBJS): %.o: %.c + @echo "CC: $<" + @$(HOSTCC) -c $(HOSTCFLAGS) $< -o $@ + +$(HOST_BIN): $(HOST_OBJS) + @echo "LD: $@" + @$(HOSTCC) $(HOSTLDFLAGS) $(HOST_OBJS) -o $@ + +.built: $(TARG_OBJS) + @( for obj in $(TARG_OBJS) ; do \ + $(call ARCHIVE, $(TARG_BIN), $${obj}); \ + done ; ) + @touch .built + +.context: +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + @touch $@ +endif + +context: .context + +.depend: Makefile $(TARG_SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(TARG_SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f $(TARG_POSIX) $(HOST_BIN) .built *.o *~ .*.swp + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep + diff --git a/apps/examples/nettest/host.c b/apps/examples/nettest/host.c new file mode 100644 index 0000000000..25cb854551 --- /dev/null +++ b/apps/examples/nettest/host.c @@ -0,0 +1,63 @@ +/**************************************************************************** + * examples/nettest/host.c + * + * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "nettest.h" + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * main + ****************************************************************************/ + +int main(int argc, char **argv, char **envp) +{ +#ifdef CONFIG_EXAMPLE_NETTEST_SERVER + send_client(); +#else + recv_server(); +#endif + + return 0; +} diff --git a/apps/examples/nettest/nettest.c b/apps/examples/nettest/nettest.c new file mode 100644 index 0000000000..7160e693a3 --- /dev/null +++ b/apps/examples/nettest/nettest.c @@ -0,0 +1,121 @@ +/**************************************************************************** + * examples/nettest/nettest.c + * + * Copyright (C) 2007, 2009-2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include +#include + +#include "nettest.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* If CONFIG_NSH_BUILTIN_APPS is defined, then it is assumed that you want + * to execute the DHCPD daemon as an NSH built-in task. + */ + +#ifdef CONFIG_NSH_BUILTIN_APPS +# define MAIN_NAME nettest_main +# define MAIN_NAME_STRING "nettest_main" +#else +# define MAIN_NAME user_start +# define MAIN_NAME_STRING "user_start" +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * user_start + ****************************************************************************/ + +int MAIN_NAME(int argc, char *argv[]) +{ + struct in_addr addr; +#ifdef CONFIG_EXAMPLE_NETTEST_NOMAC + uint8_t mac[IFHWADDRLEN]; +#endif + +/* Many embedded network interfaces must have a software assigned MAC */ + +#ifdef CONFIG_EXAMPLE_NETTEST_NOMAC + mac[0] = 0x00; + mac[1] = 0xe0; + mac[2] = 0xb0; + mac[3] = 0x0b; + mac[4] = 0xba; + mac[5] = 0xbe; + uip_setmacaddr("eth0", mac); +#endif + + /* Set up our host address */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_NETTEST_IPADDR); + uip_sethostaddr("eth0", &addr); + + /* Set up the default router address */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_NETTEST_DRIPADDR); + uip_setdraddr("eth0", &addr); + + /* Setup the subnet mask */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_NETTEST_NETMASK); + uip_setnetmask("eth0", &addr); + +#ifdef CONFIG_EXAMPLE_NETTEST_SERVER + recv_server(); +#else + send_client(); +#endif + + return 0; +} diff --git a/apps/examples/nettest/nettest.h b/apps/examples/nettest/nettest.h new file mode 100644 index 0000000000..b5b6191758 --- /dev/null +++ b/apps/examples/nettest/nettest.h @@ -0,0 +1,95 @@ +/**************************************************************************** + * examples/nettest/nettest.h + * + * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __EXAMPLES_NETTEST_H +#define __EXAMPLES_NETTEST_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLE_NETTEST_HOST +#else +# include +#endif + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLE_NETTEST_HOST + /* HTONS/L macros are unique to uIP */ + +# define HTONS(a) htons(a) +# define HTONL(a) htonl(a) + + /* Used printf for debug output */ + +# ifdef CONFIG_CPP_HAVE_VARARGS +# define message(...) printf(__VA_ARGS__) +# else +# define message printf +# endif + + /* Have SO_LINGER */ + +# define NETTEST_HAVE_SOLINGER 1 + +#else + + /* Used lib_rawprintf() so that there is not confusion from buffered IO */ + +# ifdef CONFIG_CPP_HAVE_VARARGS +# define message(...) lib_rawprintf(__VA_ARGS__) +# else +# define message lib_rawprintf +# endif + + /* At present, uIP does only abortive disconnects */ + +# undef NETTEST_HAVE_SOLINGER +#endif + +#define PORTNO 5471 +#define SENDSIZE 4096 + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +extern void send_client(void); +extern void recv_server(void); + +#endif /* __EXAMPLES_NETTEST_H */ diff --git a/apps/examples/nettest/nettest_client.c b/apps/examples/nettest/nettest_client.c new file mode 100644 index 0000000000..5f95d7b700 --- /dev/null +++ b/apps/examples/nettest/nettest_client.c @@ -0,0 +1,205 @@ +/**************************************************************************** + * examples/nettest/nettest-client.c + * + * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +#include +#include +#include +#include +#include + +#include "nettest.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void send_client(void) +{ + struct sockaddr_in myaddr; + char *outbuf; +#ifndef CONFIG_EXAMPLE_NETTEST_PERFORMANCE + char *inbuf; +#endif + int sockfd; + int nbytessent; +#ifndef CONFIG_EXAMPLE_NETTEST_PERFORMANCE + int nbytesrecvd; + int totalbytesrecvd; +#endif + int ch; + int i; + + /* Allocate buffers */ + + outbuf = (char*)malloc(SENDSIZE); +#ifndef CONFIG_EXAMPLE_NETTEST_PERFORMANCE + inbuf = (char*)malloc(SENDSIZE); + if (!outbuf || !inbuf) +#else + if (!outbuf) +#endif + { + message("client: failed to allocate buffers\n"); + exit(1); + } + + /* Create a new TCP socket */ + + sockfd = socket(PF_INET, SOCK_STREAM, 0); + if (sockfd < 0) + { + message("client socket failure %d\n", errno); + goto errout_with_buffers; + } + + /* Connect the socket to the server */ + + myaddr.sin_family = AF_INET; + myaddr.sin_port = HTONS(PORTNO); +#if 0 + myaddr.sin_addr.s_addr = HTONL(INADDR_LOOPBACK); +#else + myaddr.sin_addr.s_addr = HTONL(CONFIG_EXAMPLE_NETTEST_CLIENTIP); +#endif + + message("client: Connecting...\n"); + if (connect( sockfd, (struct sockaddr*)&myaddr, sizeof(struct sockaddr_in)) < 0) + { + message("client: connect failure: %d\n", errno); + goto errout_with_socket; + } + message("client: Connected\n"); + + /* Initialize the buffer */ + + ch = 0x20; + for (i = 0; i < SENDSIZE; i++ ) + { + outbuf[i] = ch; + if (++ch > 0x7e) + { + ch = 0x20; + } + } + +#ifdef CONFIG_EXAMPLE_NETTEST_PERFORMANCE + /* Then send messages forever */ + + for (;;) + { + nbytessent = send(sockfd, outbuf, SENDSIZE, 0); + if (nbytessent < 0) + { + message("client: send failed: %d\n", errno); + goto errout_with_socket; + } + else if (nbytessent != SENDSIZE) + { + message("client: Bad send length=%d: %d of \n", + nbytessent, SENDSIZE); + goto errout_with_socket; + } + message("Sent %d bytes\n", nbytessent); + } +#else + /* Then send and receive one message */ + + message("client: Sending %d bytes\n", SENDSIZE); + nbytessent = send(sockfd, outbuf, SENDSIZE, 0); + message("client: Sent %d bytes\n", nbytessent); + + if (nbytessent < 0) + { + message("client: send failed: %d\n", errno); + goto errout_with_socket; + } + else if (nbytessent != SENDSIZE) + { + message("client: Bad send length: %d Expected: %d\n", nbytessent, SENDSIZE); + goto errout_with_socket; + } + + totalbytesrecvd = 0; + do + { + message("client: Receiving...\n"); + nbytesrecvd = recv(sockfd, &inbuf[totalbytesrecvd], SENDSIZE - totalbytesrecvd, 0); + + if (nbytesrecvd < 0) + { + message("client: recv failed: %d\n", errno); + goto errout_with_socket; + } + totalbytesrecvd += nbytesrecvd; + message("client: Received %d of %d bytes\n", totalbytesrecvd, SENDSIZE); + } + while (totalbytesrecvd < SENDSIZE); + + if (totalbytesrecvd != SENDSIZE) + { + message("client: Bad recv length: %d Expected: %d\n", totalbytesrecvd, SENDSIZE); + goto errout_with_socket; + } + else if (memcmp(inbuf, outbuf, SENDSIZE) != 0) + { + message("client: Received buffer does not match sent buffer\n"); + goto errout_with_socket; + } + + close(sockfd); + free(outbuf); +#ifndef CONFIG_EXAMPLE_NETTEST_PERFORMANCE + free(inbuf); +#endif + return; +#endif + +errout_with_socket: + close(sockfd); + +errout_with_buffers: + free(outbuf); +#ifndef CONFIG_EXAMPLE_NETTEST_PERFORMANCE + free(inbuf); +#endif + exit(1); +} diff --git a/apps/examples/nettest/nettest_server.c b/apps/examples/nettest/nettest_server.c new file mode 100644 index 0000000000..45ef3a39a8 --- /dev/null +++ b/apps/examples/nettest/nettest_server.c @@ -0,0 +1,235 @@ +/**************************************************************************** + * examples/nettest/nettest-server.c + * + * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include + +#include +#include +#include +#include + +#include "nettest.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void recv_server(void) +{ + struct sockaddr_in myaddr; +#ifdef NETTEST_HAVE_SOLINGER + struct linger ling; +#endif + char *buffer; + int listensd; + int acceptsd; + socklen_t addrlen; + int nbytesread; +#ifndef CONFIG_EXAMPLE_NETTEST_PERFORMANCE + int totalbytesread; + int nbytessent; + int ch; + int i; +#endif + int optval; + + /* Allocate a BIG buffer */ + + buffer = (char*)malloc(2*SENDSIZE); + if (!buffer) + { + message("server: failed to allocate buffer\n"); + exit(1); + } + + + /* Create a new TCP socket */ + + listensd = socket(PF_INET, SOCK_STREAM, 0); + if (listensd < 0) + { + message("server: socket failure: %d\n", errno); + goto errout_with_buffer; + } + + /* Set socket to reuse address */ + + optval = 1; + if (setsockopt(listensd, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, sizeof(int)) < 0) + { + message("server: setsockopt SO_REUSEADDR failure: %d\n", errno); + goto errout_with_listensd; + } + + /* Bind the socket to a local address */ + + myaddr.sin_family = AF_INET; + myaddr.sin_port = HTONS(PORTNO); + myaddr.sin_addr.s_addr = INADDR_ANY; + + if (bind(listensd, (struct sockaddr*)&myaddr, sizeof(struct sockaddr_in)) < 0) + { + message("server: bind failure: %d\n", errno); + goto errout_with_listensd; + } + + /* Listen for connections on the bound TCP socket */ + + if (listen(listensd, 5) < 0) + { + message("server: listen failure %d\n", errno); + goto errout_with_listensd; + } + + /* Accept only one connection */ + + message("server: Accepting connections on port %d\n", PORTNO); + addrlen = sizeof(struct sockaddr_in); + acceptsd = accept(listensd, (struct sockaddr*)&myaddr, &addrlen); + if (acceptsd < 0) + { + message("server: accept failure: %d\n", errno); + goto errout_with_listensd; + } + message("server: Connection accepted -- receiving\n"); + + /* Configure to "linger" until all data is sent when the socket is closed */ + +#ifdef NETTEST_HAVE_SOLINGER + ling.l_onoff = 1; + ling.l_linger = 30; /* timeout is seconds */ + if (setsockopt(acceptsd, SOL_SOCKET, SO_LINGER, &ling, sizeof(struct linger)) < 0) + { + message("server: setsockopt SO_LINGER failure: %d\n", errno); + goto errout_with_acceptsd; + } +#endif + +#ifdef CONFIG_EXAMPLE_NETTEST_PERFORMANCE + /* Then receive data forever */ + + for (;;) + { + nbytesread = recv(acceptsd, buffer, 2*SENDSIZE, 0); + if (nbytesread <= 0) + { + message("server: recv failed: %d\n", errno); + goto errout_with_acceptsd; + } + message("Received %d bytes\n", nbytesread); + } +#else + /* Receive canned message */ + + totalbytesread = 0; + while (totalbytesread < SENDSIZE) + { + message("server: Reading...\n"); + nbytesread = recv(acceptsd, &buffer[totalbytesread], 2*SENDSIZE - totalbytesread, 0); + if (nbytesread <= 0) + { + message("server: recv failed: %d\n", errno); + goto errout_with_acceptsd; + } + + totalbytesread += nbytesread; + message("server: Received %d of %d bytes\n", totalbytesread, SENDSIZE); + } + + /* Verify the message */ + + if (totalbytesread != SENDSIZE) + { + message("server: Received %d / Expected %d bytes\n", totalbytesread, SENDSIZE); + goto errout_with_acceptsd; + } + + ch = 0x20; + for (i = 0; i < SENDSIZE; i++ ) + { + if (buffer[i] != ch) + { + message("server: Byte %d is %02x / Expected %02x\n", i, buffer[i], ch); + goto errout_with_acceptsd; + } + + if (++ch > 0x7e) + { + ch = 0x20; + } + } + + /* Then send the same data back to the client */ + + message("server: Sending %d bytes\n", totalbytesread); + nbytessent = send(acceptsd, buffer, totalbytesread, 0); + if (nbytessent <= 0) + { + message("server: send failed: %d\n", errno); + goto errout_with_acceptsd; + } + message("server: Sent %d bytes\n", nbytessent); + + /* If this platform only does abortive disconnects, then wait a bit to get the + * client side a change to receive the data. + */ + +#if 1 /* Do it for all platforms */ + message("server: Wait before closing\n"); + sleep(60); +#endif + + close(listensd); + close(acceptsd); + free(buffer); + return; +#endif + +errout_with_acceptsd: + close(acceptsd); + +errout_with_listensd: + close(listensd); + +errout_with_buffer: + free(buffer); + exit(1); +} diff --git a/apps/examples/nsh/Makefile b/apps/examples/nsh/Makefile new file mode 100644 index 0000000000..b5844f9edc --- /dev/null +++ b/apps/examples/nsh/Makefile @@ -0,0 +1,93 @@ +############################################################################ +# apps/examples/nsh/Makefile +# +# Copyright (C) 2007-2008, 2010-2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# NuttShell (NSH) Example + +ASRCS = +CSRCS = nsh_main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/nsh/nsh_main.c b/apps/examples/nsh/nsh_main.c new file mode 100644 index 0000000000..53235a8351 --- /dev/null +++ b/apps/examples/nsh/nsh_main.c @@ -0,0 +1,136 @@ +/**************************************************************************** + * examples/nsh/nsh_main.c + * + * Copyright (C) 2007-2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + int mid_priority; +#if defined(CONFIG_NSH_CONSOLE) && defined(CONFIG_NSH_TELNET) + int ret; +#endif + + /* Initialize the NSH library */ + + nsh_initialize(); + + /* Set the priority of this task to something in the middle so that 'nice' + * can both raise and lower the priority. + */ + + mid_priority = (sched_get_priority_max(SCHED_NSH) + sched_get_priority_min(SCHED_NSH)) >> 1; + { + struct sched_param param; + + param.sched_priority = mid_priority; + (void)sched_setscheduler(0, SCHED_NSH, ¶m); + } + + /* If both the console and telnet are selected as front-ends, then run + * the telnet front end on another thread. + */ + +#if defined(CONFIG_NSH_CONSOLE) && defined(CONFIG_NSH_TELNET) +# ifndef CONFIG_CUSTOM_STACK + ret = task_create("nsh_telnetmain", mid_priority, CONFIG_NSH_STACKSIZE, + nsh_telnetmain, NULL); +# else + ret = task_create("nsh_telnetmain", mid_priority, nsh_telnetmain, NULL); +# endif + if (ret < 0) + { + /* The daemon is NOT running. Report the the error then fail... + * either with the serial console up or just exiting. + */ + + fprintf(stderr, "ERROR: Failed to start TELNET daemon: %d\n", errno); + } + + /* If only the telnet front-end is selected, run it on this thread */ + +#elif defined(CONFIG_NSH_TELNET) + return nsh_telnetmain(0, NULL); +#endif + +/* If the serial console front end is selected, then run it on this thread */ + +#ifdef CONFIG_NSH_CONSOLE + return nsh_consolemain(0, NULL); +#endif +} diff --git a/apps/examples/null/Makefile b/apps/examples/null/Makefile new file mode 100644 index 0000000000..3938eb1711 --- /dev/null +++ b/apps/examples/null/Makefile @@ -0,0 +1,93 @@ +############################################################################ +# examples/null/Makefile +# +# Copyright (C) 2007-2008, 2010-2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# The smallest thing you can build -- the NULL example. + +ASRCS = +CSRCS = null_main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/null/null_main.c b/apps/examples/null/null_main.c new file mode 100644 index 0000000000..10fc1bf1e4 --- /dev/null +++ b/apps/examples/null/null_main.c @@ -0,0 +1,67 @@ +/**************************************************************************** + * examples/null/null_main.c + * + * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + return 0; +} diff --git a/apps/examples/nx/Makefile b/apps/examples/nx/Makefile new file mode 100644 index 0000000000..bdeb57e22e --- /dev/null +++ b/apps/examples/nx/Makefile @@ -0,0 +1,108 @@ +############################################################################ +# apps/examples/nx/Makefile +# +# Copyright (C) 2009-2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# NuttX NX Graphics Example. + +ASRCS = +CSRCS = nx_main.c nx_events.c nx_kbdin.c +ifeq ($(CONFIG_NX_MULTIUSER),y) +CSRCS += nx_server.c +endif + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# NX built-in application info + +APPNAME = nx +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +# Common build + +VPATH = + +all: .built +.PHONY: context clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +.context: +ifeq ($(CONFIG_EXAMPLES_NX_BUILTIN),y) + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + @touch $@ +endif + +context: .context + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/nx/nx_events.c b/apps/examples/nx/nx_events.c new file mode 100644 index 0000000000..29fe5fb8a9 --- /dev/null +++ b/apps/examples/nx/nx_events.c @@ -0,0 +1,337 @@ +/**************************************************************************** + * examples/nx/nx_events.c + * + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include "nx_internal.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static void nxeg_redraw(NXEGWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + bool morem, FAR void *arg); +static void nxeg_position(NXEGWINDOW hwnd, FAR const struct nxgl_size_s *size, + FAR const struct nxgl_point_s *pos, + FAR const struct nxgl_rect_s *bounds, + FAR void *arg); +#ifdef CONFIG_NX_MOUSE +static void nxeg_mousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos, + uint8_t buttons, FAR void *arg); +#endif + +#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS +static void nxeg_tbredraw(NXEGWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + bool morem, FAR void *arg); +static void nxeg_tbposition(NXEGWINDOW hwnd, FAR const struct nxgl_size_s *size, + FAR const struct nxgl_point_s *pos, + FAR const struct nxgl_rect_s *bounds, + FAR void *arg); +#ifdef CONFIG_NX_MOUSE +static void nxeg_tbmousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos, + uint8_t buttons, FAR void *arg); +#endif +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +const struct nx_callback_s g_nxcb = +{ + nxeg_redraw, /* redraw */ + nxeg_position /* position */ +#ifdef CONFIG_NX_MOUSE + , nxeg_mousein /* mousein */ +#endif +#ifdef CONFIG_NX_KBD + , nxeg_kbdin /* my kbdin */ +#endif +}; + +#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS +const struct nx_callback_s g_tbcb = +{ + nxeg_tbredraw, /* redraw */ + nxeg_tbposition /* position */ +#ifdef CONFIG_NX_MOUSE + , nxeg_tbmousein /* mousein */ +#endif +#ifdef CONFIG_NX_KBD + , nxeg_tbkbdin /* my kbdin */ +#endif +}; +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxeg_fillwindow + ****************************************************************************/ + +static inline void nxeg_fillwindow(NXEGWINDOW hwnd, + FAR const struct nxgl_rect_s *rect, + FAR struct nxeg_state_s *st) +{ + int ret; + +#ifdef CONFIG_EXAMPLES_NX_RAWWINDOWS + ret = nx_fill(hwnd, rect, st->color); + if (ret < 0) + { + message("nxeg_fillwindow: nx_fill failed: %d\n", errno); + } +#else + ret = nxtk_fillwindow(hwnd, rect, st->color); + if (ret < 0) + { + message("nxeg_fillwindow: nxtk_fillwindow failed: %d\n", errno); + } +#endif +#ifdef CONFIG_NX_KBD + nxeg_filltext(hwnd, rect, st); +#endif +} + +/**************************************************************************** + * Name: nxeg_fillwindow + ****************************************************************************/ + +#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS +static inline void nxeg_filltoolbar(NXTKWINDOW htb, + FAR const struct nxgl_rect_s *rect, + nxgl_mxpixel_t color[CONFIG_NX_NPLANES]) +{ + int ret; + + ret = nxtk_filltoolbar(htb, rect, color); + if (ret < 0) + { + message("nxeg_filltoolbar: nxtk_filltoolbar failed: %d\n", errno); + } +} +#endif + +/**************************************************************************** + * Name: nxeg_redraw + ****************************************************************************/ + +static void nxeg_redraw(NXEGWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + bool more, FAR void *arg) +{ + FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg; + message("nxeg_redraw%d: hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n", + st->wnum, hwnd, + rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, + more ? "true" : "false"); + + nxeg_fillwindow(hwnd, rect, st); +} + +/**************************************************************************** + * Name: nxeg_position + ****************************************************************************/ + +static void nxeg_position(NXEGWINDOW hwnd, FAR const struct nxgl_size_s *size, + FAR const struct nxgl_point_s *pos, + FAR const struct nxgl_rect_s *bounds, + FAR void *arg) +{ + FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg; + + /* Report the position */ + + message("nxeg_position%d: hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n", + st->wnum, hwnd, size->w, size->h, pos->x, pos->y, + bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y); + + /* Have we picked off the window bounds yet? */ + + if (!b_haveresolution) + { + /* Save the window limits (these should be the same for all places and all windows */ + + g_xres = bounds->pt2.x; + g_yres = bounds->pt2.y; + + b_haveresolution = true; + sem_post(&g_semevent); + message("nxeg_position2: Have xres=%d yres=%d\n", g_xres, g_yres); + } +} + +/**************************************************************************** + * Name: nxeg_mousein + ****************************************************************************/ + +#ifdef CONFIG_NX_MOUSE +static void nxeg_mousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos, + uint8_t buttons, FAR void *arg) +{ + FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg; + message("nxeg_mousein%d: hwnd=%p pos=(%d,%d) button=%02x\n", + st->wnum, hwnd, pos->x, pos->y, buttons); +} +#endif + +/**************************************************************************** + * Name: nxeg_tbredraw + ****************************************************************************/ + +#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS +static void nxeg_tbredraw(NXEGWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + bool more, FAR void *arg) +{ + FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg; + message("nxeg_tbredraw%d: hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n", + st->wnum, hwnd, + rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, + more ? "true" : "false"); + nxeg_filltoolbar(hwnd, rect, g_tbcolor); +} +#endif + +/**************************************************************************** + * Name: nxeg_position + ****************************************************************************/ + +#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS +static void nxeg_tbposition(NXEGWINDOW hwnd, FAR const struct nxgl_size_s *size, + FAR const struct nxgl_point_s *pos, + FAR const struct nxgl_rect_s *bounds, + FAR void *arg) +{ + FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg; + + /* Report the position */ + + message("nxeg_ptbosition%d: hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n", + st->wnum, hwnd, size->w, size->h, pos->x, pos->y, + bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y); +} +#endif + +/**************************************************************************** + * Name: nxeg_tbmousein + ****************************************************************************/ + +#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS +#ifdef CONFIG_NX_MOUSE +static void nxeg_tbmousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos, + uint8_t buttons, FAR void *arg) +{ + FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg; + + message("nxeg_tbmousein%d: hwnd=%p pos=(%d,%d) button=%02x\n", + st->wnum, hwnd, pos->x, pos->y, buttons); +} +#endif +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nx_listenerthread + ****************************************************************************/ + +#ifdef CONFIG_NX_MULTIUSER +FAR void *nx_listenerthread(FAR void *arg) +{ + int ret; + + /* Process events forever */ + + for (;;) + { + /* Handle the next event. If we were configured blocking, then + * we will stay right here until the next event is received. Since + * we have dedicated a while thread to servicing events, it would + * be most natural to also select CONFIG_NX_BLOCKING -- if not, the + * following would be a tight infinite loop (unless we added addition + * logic with nx_eventnotify and sigwait to pace it). + */ + + ret = nx_eventhandler(g_hnx); + if (ret < 0) + { + /* An error occurred... assume that we have lost connection with + * the server. + */ + + message("nx_listenerthread: Lost server connection: %d\n", errno); + exit(NXEXIT_LOSTSERVERCONN); + } + + /* If we received a message, we must be connected */ + + if (!g_connected) + { + g_connected = true; + sem_post(&g_semevent); + message("nx_listenerthread: Connected\n"); + } + } +} +#endif diff --git a/apps/examples/nx/nx_internal.h b/apps/examples/nx/nx_internal.h new file mode 100644 index 0000000000..a0fae77a97 --- /dev/null +++ b/apps/examples/nx/nx_internal.h @@ -0,0 +1,317 @@ +/**************************************************************************** + * examples/nx/nx_internal.h + * + * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __EXAMPLES_NX_NX_INTERNAL_H +#define __EXAMPLES_NX_NX_INTERNAL_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ + +#ifndef CONFIG_NX +# error "NX is not enabled (CONFIG_NX)" +#endif + +#ifndef CONFIG_EXAMPLES_NX_VPLANE +# define CONFIG_EXAMPLES_NX_VPLANE 0 +#endif + +#ifndef CONFIG_EXAMPLES_NX_BPP +# define CONFIG_EXAMPLES_NX_BPP 32 +#endif + +#ifndef CONFIG_EXAMPLES_NX_BGCOLOR +# if CONFIG_EXAMPLES_NX_BPP == 24 || CONFIG_EXAMPLES_NX_BPP == 32 +# define CONFIG_EXAMPLES_NX_BGCOLOR 0x007b68ee +# elif CONFIG_EXAMPLES_NX_BPP == 16 +# define CONFIG_EXAMPLES_NX_BGCOLOR 0x7b5d +# else +# define CONFIG_EXAMPLES_NX_BGCOLOR ' ' +# endif +#endif + +#ifndef CONFIG_EXAMPLES_NX_COLOR1 +# if CONFIG_EXAMPLES_NX_BPP == 24 || CONFIG_EXAMPLES_NX_BPP == 32 +# define CONFIG_EXAMPLES_NX_COLOR1 0x00e6e6fa +# elif CONFIG_EXAMPLES_NX_BPP == 16 +# define CONFIG_EXAMPLES_NX_COLOR1 0xe73f +# else +# define CONFIG_EXAMPLES_NX_COLOR1 '1' +# endif +#endif + +#ifndef CONFIG_EXAMPLES_NX_COLOR2 +# if CONFIG_EXAMPLES_NX_BPP == 24 || CONFIG_EXAMPLES_NX_BPP == 32 +# define CONFIG_EXAMPLES_NX_COLOR2 0x00dcdcdc +# elif CONFIG_EXAMPLES_NX_BPP == 16 +# define CONFIG_EXAMPLES_NX_COLOR2 0xdefb +# else +# define CONFIG_EXAMPLES_NX_COLOR2 '2' +# endif +#endif + +#ifndef CONFIG_EXAMPLES_NX_TBCOLOR +# if CONFIG_EXAMPLES_NX_BPP == 24 || CONFIG_EXAMPLES_NX_BPP == 32 +# define CONFIG_EXAMPLES_NX_TBCOLOR 0x00a9a9a9 +# elif CONFIG_EXAMPLES_NX_BPP == 16 +# define CONFIG_EXAMPLES_NX_TBCOLOR 0xad55 +# else +# define CONFIG_EXAMPLES_NX_TBCOLOR 'T' +# endif +#endif + +#ifndef CONFIG_EXAMPLES_NX_FONTID +# define CONFIG_EXAMPLES_NX_FONTID NXFONT_DEFAULT +#endif + +#ifndef CONFIG_EXAMPLES_NX_FONTCOLOR +# if CONFIG_EXAMPLES_NX_BPP == 24 || CONFIG_EXAMPLES_NX_BPP == 32 +# define CONFIG_EXAMPLES_NX_FONTCOLOR 0x00000000 +# elif CONFIG_EXAMPLES_NX_BPP == 16 +# define CONFIG_EXAMPLES_NX_FONTCOLOR 0x0000 +# else +# define CONFIG_EXAMPLES_NX_FONTCOLOR 'F' +# endif +#endif + +#ifndef CONFIG_EXAMPLES_NX_TOOLBAR_HEIGHT +# define CONFIG_EXAMPLES_NX_TOOLBAR_HEIGHT 16 +#endif + +#ifdef CONFIG_NX_MULTIUSER +# ifdef CONFIG_DISABLE_MQUEUE +# error "The multi-threaded example requires MQ support (CONFIG_DISABLE_MQUEUE=n)" +# endif +# ifdef CONFIG_DISABLE_SIGNALS +# error "This example requires signal support (CONFIG_DISABLE_SIGNALS=n)" +# endif +# ifdef CONFIG_DISABLE_PTHREAD +# error "This example requires pthread support (CONFIG_DISABLE_PTHREAD=n)" +# endif +# ifndef CONFIG_NX_BLOCKING +# error "This example depends on CONFIG_NX_BLOCKING" +# endif +# ifndef CONFIG_EXAMPLES_NX_STACKSIZE +# define CONFIG_EXAMPLES_NX_STACKSIZE 2048 +# endif +# ifndef CONFIG_EXAMPLES_NX_LISTENERPRIO +# define CONFIG_EXAMPLES_NX_LISTENERPRIO 100 +# endif +# ifndef CONFIG_EXAMPLES_NX_CLIENTPRIO +# define CONFIG_EXAMPLES_NX_CLIENTPRIO 100 +# endif +# ifndef CONFIG_EXAMPLES_NX_SERVERPRIO +# define CONFIG_EXAMPLES_NX_SERVERPRIO 120 +# endif +# ifndef CONFIG_EXAMPLES_NX_NOTIFYSIGNO +# define CONFIG_EXAMPLES_NX_NOTIFYSIGNO 4 +# endif +#endif + +#ifdef CONFIG_EXAMPLES_NX_RAWWINDOWS +# define NXEGWINDOW NXWINDOW +#else +# define NXEGWINDOW NXTKWINDOW +#endif + +#define NXTK_MAXKBDCHARS 16 + +/* Debug ********************************************************************/ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_DEBUG +# define message(...) lib_lowprintf(__VA_ARGS__) +# define msgflush() +# else +# define message(...) printf(__VA_ARGS__) +# define msgflush() fflush(stdout) +# endif +#else +# ifdef CONFIG_DEBUG +# define message lib_lowprintf +# define msgflush() +# else +# define message printf +# define msgflush() fflush(stdout) +# endif +#endif + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +enum exitcode_e +{ + NXEXIT_SUCCESS = 0, + NXEXIT_SIGPROCMASK, + NXEXIT_SCHEDSETPARAM, + NXEXIT_EVENTNOTIFY, + NXEXIT_TASKCREATE, + NXEXIT_PTHREADCREATE, + NXEXIT_EXTINITIALIZE, + NXEXIT_FBINITIALIZE, + NXEXIT_FBGETVPLANE, + NXEXIT_LCDINITIALIZE, + NXEXIT_LCDGETDEV, + NXEXIT_NXOPEN, + NXEXIT_FONTOPEN, + NXEXIT_NXOPENTOOLBAR, + NXEXIT_NXCONNECT, + NXEXIT_NXSETBGCOLOR, + NXEXIT_NXOPENWINDOW, + NXEXIT_NXSETSIZE, + NXEXIT_NXSETPOSITION, + NXEXIT_NXLOWER, + NXEXIT_NXRAISE, + NXEXIT_NXCLOSEWINDOW, + NXEXIT_LOSTSERVERCONN +}; + +/* Describes one cached glyph bitmap */ + +struct nxeg_glyph_s +{ + uint8_t code; /* Character code */ + uint8_t height; /* Height of this glyph (in rows) */ + uint8_t width; /* Width of this glyph (in pixels) */ + uint8_t stride; /* Width of the glyph row (in bytes) */ + FAR uint8_t *bitmap; /* Allocated bitmap memory */ +}; + +/* Describes on character on the display */ + +struct nxeg_bitmap_s +{ + struct nxgl_rect_s bounds; /* Size/position of bitmap */ + FAR const struct nxeg_glyph_s *glyph; /* The cached glyph */ +}; + +/* Describes the overall state of on one window */ + +struct nxeg_state_s +{ + uint8_t wnum; /* Window number */ + nxgl_mxpixel_t color[CONFIG_NX_NPLANES]; /* Window color */ + +#ifdef CONFIG_NX_KBD + uint8_t height; /* Max height of a font in pixels */ + uint8_t width; /* Max width of a font in pixels */ + uint8_t spwidth; /* The width of a space */ + + uint8_t nchars; /* Number of KBD chars received */ + uint8_t nglyphs; /* Number of glyphs cached */ + + struct nxeg_bitmap_s bm[NXTK_MAXKBDCHARS]; + struct nxeg_glyph_s glyph[NXTK_MAXKBDCHARS]; +#endif +}; + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/* The connecton handle */ + +extern NXHANDLE g_hnx; + +/* NX callback vtables */ + +extern const struct nx_callback_s g_nxcb; +#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS +extern const struct nx_callback_s g_tbcb; +#endif + +/* The font handle */ + +extern NXHANDLE g_fonthandle; + +/* The screen resolution */ + +extern nxgl_coord_t g_xres; +extern nxgl_coord_t g_yres; + +extern bool b_haveresolution; +#ifdef CONFIG_NX_MULTIUSER +extern bool g_connected; +#endif +extern sem_t g_semevent; + +/* Colors used to fill window 1 & 2 */ + +extern nxgl_mxpixel_t g_color1[CONFIG_NX_NPLANES]; +extern nxgl_mxpixel_t g_color2[CONFIG_NX_NPLANES]; +#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS +extern nxgl_mxpixel_t g_tbcolor[CONFIG_NX_NPLANES]; +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_NX_EXTERNINIT +extern FAR NX_DRIVERTYPE *up_nxdrvinit(unsigned int devno); +#endif + +#if defined(CONFIG_NX) && defined(CONFIG_NX_MULTIUSER) +extern int nx_servertask(int argc, char *argv[]); +extern FAR void *nx_listenerthread(FAR void *arg); +#endif + +#ifdef CONFIG_NX_KBD +extern void nxeg_kbdin(NXWINDOW hwnd, uint8_t nch, const uint8_t *ch, FAR void *arg); +#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS +extern void nxeg_tbkbdin(NXWINDOW hwnd, uint8_t nch, const uint8_t *ch, FAR void *arg); +#endif +extern void nxeg_filltext(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + FAR struct nxeg_state_s *st); +#endif + +#endif /* __EXAMPLES_NX_NX_INTERNAL_H */ diff --git a/apps/examples/nx/nx_kbdin.c b/apps/examples/nx/nx_kbdin.c new file mode 100644 index 0000000000..ebb1ef7917 --- /dev/null +++ b/apps/examples/nx/nx_kbdin.c @@ -0,0 +1,467 @@ +/**************************************************************************** + * examples/nx/nx_kbdin.c + * + * Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "nx_internal.h" + +#ifdef CONFIG_NX_KBD + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Select renderer -- Some additional logic would be required to support + * pixel depths that are not directly addressable (1,2,4, and 24). + */ + +#if CONFIG_EXAMPLES_NX_BPP == 1 +# define RENDERER nxf_convert_1bpp +#elif CONFIG_EXAMPLES_NX_BPP == 2 +# define RENDERER nxf_convert_2bpp +#elif CONFIG_EXAMPLES_NX_BPP == 4 +# define RENDERER nxf_convert_4bpp +#elif CONFIG_EXAMPLES_NX_BPP == 8 +# define RENDERER nxf_convert_8bpp +#elif CONFIG_EXAMPLES_NX_BPP == 16 +# define RENDERER nxf_convert_16bpp +#elif CONFIG_EXAMPLES_NX_BPP == 24 +# define RENDERER nxf_convert_24bpp +#elif CONFIG_EXAMPLES_NX_BPP == 32 +# define RENDERER nxf_convert_32bpp +#else +# error "Unsupported CONFIG_EXAMPLES_NX_BPP" +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxeg_fillchar + ****************************************************************************/ + +static void nxeg_fillchar(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + FAR const struct nxeg_bitmap_s *bm) +{ + FAR void *src = (FAR void *)bm->glyph->bitmap; + struct nxgl_rect_s intersection; + int ret; + + /* Handle the special case of spaces which have no glyph bitmap */ + + if (src) + { + /* Get the intersection of the redraw region and the character bitmap */ + + nxgl_rectintersect(&intersection, rect, &bm->bounds); + if (!nxgl_nullrect(&intersection)) + { +#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS + ret = nxtk_bitmapwindow((NXTKWINDOW)hwnd, &intersection, (FAR const void **)&src, + &bm->bounds.pt1, + (unsigned int)bm->glyph->stride); + if (ret < 0) + { + message("nxeg_fillchar: nxtk_bitmapwindow failed: %d\n", errno); + } +#else + ret = nx_bitmap((NXWINDOW)hwnd, &intersection, &src, + &bm->bounds.pt1, + (unsigned int)bm->glyph->stride); + if (ret < 0) + { + message("nxeg_fillchar: nx_bitmapwindow failed: %d\n", errno); + } +#endif + } + } +} + +/**************************************************************************** + * Name: nxeg_renderglyph + ****************************************************************************/ + +static inline FAR const struct nxeg_glyph_s * +nxeg_renderglyph(FAR struct nxeg_state_s *st, + FAR const struct nx_fontbitmap_s *bm, uint8_t ch) +{ + FAR struct nxeg_glyph_s *glyph = NULL; + FAR nxgl_mxpixel_t *ptr; +#if CONFIG_EXAMPLES_NX_BPP < 8 + nxgl_mxpixel_t pixel; +#endif + int bmsize; + int row; + int col; + int ret; + + /* Make sure that there is room for another glyph */ + + message("nxeg_renderglyph: ch=%02x\n", ch); + if (st->nglyphs < NXTK_MAXKBDCHARS) + { + /* Allocate the glyph */ + + glyph = &st->glyph[st->nglyphs]; + glyph->code = ch; + + /* Get the dimensions of the glyph */ + + glyph->width = bm->metric.width + bm->metric.xoffset; + glyph->height = bm->metric.height + bm->metric.yoffset; + + /* Allocate memory to hold the glyph with its offsets */ + + glyph->stride = (glyph->width * CONFIG_EXAMPLES_NX_BPP + 7) / 8; + bmsize = glyph->stride * glyph->height; + glyph->bitmap = (FAR uint8_t *)malloc(bmsize); + + if (glyph->bitmap) + { + /* Initialize the glyph memory to the background color */ + +#if CONFIG_EXAMPLES_NX_BPP < 8 + pixel = st->color[0]; +# if CONFIG_EXAMPLES_NX_BPP == 1 + /* Pack 1-bit pixels into a 2-bits */ + + pixel &= 0x01; + pixel = (pixel) << 1 |pixel; +# endif +# if CONFIG_EXAMPLES_NX_BPP < 4 + /* Pack 2-bit pixels into a nibble */ + + pixel &= 0x03; + pixel = (pixel) << 2 |pixel; +# endif + + /* Pack 4-bit nibbles into a byte */ + + pixel &= 0x0f; + pixel = (pixel) << 4 | pixel; + + ptr = (FAR nxgl_mxpixel_t *)glyph->bitmap; + for (row = 0; row < glyph->height; row++) + { + for (col = 0; col < glyph->stride; col++) + { + /* Transfer the packed bytes into the buffer */ + + *ptr++ = pixel; + } + } + +#elif CONFIG_EXAMPLES_NX_BPP == 24 +# error "Additional logic is needed here for 24bpp support" + +#else /* CONFIG_EXAMPLES_NX_BPP = {8,16,32} */ + + ptr = (FAR nxgl_mxpixel_t *)glyph->bitmap; + for (row = 0; row < glyph->height; row++) + { + /* Just copy the color value into the glyph memory */ + + for (col = 0; col < glyph->width; col++) + { + *ptr++ = st->color[0]; + } + } +#endif + + /* Then render the glyph into the allocated memory */ + + ret = RENDERER((FAR nxgl_mxpixel_t*)glyph->bitmap, + glyph->height, glyph->width, glyph->stride, + bm, CONFIG_EXAMPLES_NX_FONTCOLOR); + if (ret < 0) + { + /* Actually, the RENDERER never returns a failure */ + + message("nxeg_renderglyph: RENDERER failed\n"); + free(glyph->bitmap); + glyph->bitmap = NULL; + glyph = NULL; + } + else + { + /* Make it permanent */ + + st->nglyphs++; + } + } + } + + return glyph; +} + +/**************************************************************************** + * Name: nxeg_addspace + ****************************************************************************/ + +static inline FAR const struct nxeg_glyph_s * +nxeg_addspace(FAR struct nxeg_state_s *st, uint8_t ch) +{ + FAR struct nxeg_glyph_s *glyph = NULL; + + /* Make sure that there is room for another glyph */ + + if (st->nglyphs < NXTK_MAXKBDCHARS) + { + /* Allocate the NULL glyph */ + + glyph = &st->glyph[st->nglyphs]; + memset(glyph, 0, sizeof(struct nxeg_glyph_s)); + + glyph->code = ' '; + glyph->width = st->spwidth; + + st->nglyphs++; + } + return glyph; +} + +/**************************************************************************** + * Name: nxeg_findglyph + ****************************************************************************/ + +static FAR const struct nxeg_glyph_s * +nxeg_findglyph(FAR struct nxeg_state_s *st, uint8_t ch) +{ + int i; + + /* First, try to find the glyph in the cache of pre-rendered glyphs */ + + for (i = 0; i < st->nglyphs; i++) + { + if (st->glyph[i].code == ch) + { + return &st->glyph[i]; + } + } + return NULL; +} + +/**************************************************************************** + * Name: nxeg_getglyph + ****************************************************************************/ + +static FAR const struct nxeg_glyph_s * +nxeg_getglyph(FAR struct nxeg_state_s *st, uint8_t ch) +{ + FAR const struct nxeg_glyph_s *glyph; + FAR const struct nx_fontbitmap_s *bm; + + /* First, try to find the glyph in the cache of pre-rendered glyphs */ + + glyph = nxeg_findglyph(st, ch); + if (!glyph) + { + /* No, it is not cached... Does the code map to a glyph? */ + + bm = nxf_getbitmap(g_fonthandle, ch); + if (!bm) + { + /* No, there is no glyph for this code. Use space */ + + glyph = nxeg_findglyph(st, ' '); + if (!glyph) + { + /* There isn't fake glyph for ' ' yet... create one */ + + glyph = nxeg_addspace(st, ' '); + } + } + else + { + glyph = nxeg_renderglyph(st, bm, ch); + } + } + return glyph; +} + +/**************************************************************************** + * Name: nxeg_addchar + ****************************************************************************/ + +static FAR const struct nxeg_bitmap_s * +nxeg_addchar(FAR struct nxeg_state_s *st, uint8_t ch) +{ + FAR struct nxeg_bitmap_s *bm = NULL; + FAR struct nxeg_bitmap_s *bmleft; + nxgl_coord_t leftx; + + /* Is there space for another character on the display? */ + + if (st->nchars < NXTK_MAXKBDCHARS) + { + /* Yes, setup the bitmap */ + + bm = &st->bm[st->nchars]; + + /* Find the matching glyph */ + + bm->glyph = nxeg_getglyph(st, ch); + if (!bm->glyph) + { + return NULL; + } + + /* Set up the bounds for the bitmap */ + + if (st->nchars <= 0) + { + /* The first character is one space from the left */ + + leftx = st->spwidth; + } + else + { + /* Otherwise, it is to the left of the preceding char */ + + bmleft = &st->bm[st->nchars-1]; + leftx = bmleft->bounds.pt2.x + 1; + } + + bm->bounds.pt1.x = leftx; + bm->bounds.pt1.y = 2; + bm->bounds.pt2.x = leftx + bm->glyph->width - 1; + bm->bounds.pt2.y = 2 + bm->glyph->height - 1; + + st->nchars++; + } + return bm; +} + +/**************************************************************************** + * Name: nxeg_addchars + ****************************************************************************/ + +static inline void nxeg_addchars(NXWINDOW hwnd, FAR struct nxeg_state_s *st, + uint8_t nch, FAR const uint8_t *ch) +{ + FAR const struct nxeg_bitmap_s *bm; + + while (nch--) + { + bm = nxeg_addchar(st, *ch++); + if (bm) + { + nxeg_fillchar(hwnd, &bm->bounds, bm); + } + } +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxeg_kbdin + ****************************************************************************/ + +void nxeg_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, + FAR void *arg) +{ + FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg; + message("nxeg_kbdin%d: hwnd=%p nch=%d\n", st->wnum, hwnd, nch); + nxeg_addchars(hwnd, st, nch, ch); +} + +/**************************************************************************** + * Name: nxeg_tbkbdin + ****************************************************************************/ + +#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS +void nxeg_tbkbdin(NXWINDOW hwnd, uint8_t nch, const uint8_t *ch, FAR void *arg) +{ + FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg; + message("nxeg_tbkbdin: ERROR -- toolbar should not received keyboard input\n"); + message("nxeg_tbkbdin%d: hwnd=%p nch=%d\n", st->wnum, hwnd, nch); +} +#endif + +/**************************************************************************** + * Name: nxeg_filltext + ****************************************************************************/ + +void nxeg_filltext(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + FAR struct nxeg_state_s *st) +{ + int i; + + /* Fill each character on the display (Only the characters within rect + * will actually be redrawn). + */ + + for (i = 0; i < st->nchars; i++) + { + nxeg_fillchar(hwnd, rect, &st->bm[i]); + } +} + +#endif /* CONFIG_NX_KBD */ diff --git a/apps/examples/nx/nx_main.c b/apps/examples/nx/nx_main.c new file mode 100644 index 0000000000..db17ea2f2c --- /dev/null +++ b/apps/examples/nx/nx_main.c @@ -0,0 +1,908 @@ +/**************************************************************************** + * examples/nx/nx_main.c + * + * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_NX_LCDDRIVER +# include +#else +# include +#endif + +#include +#include +#include +#include + +#include "nx_internal.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ +/* If not specified, assume that the hardware supports one video plane */ + +#ifndef CONFIG_EXAMPLES_NX_VPLANE +# define CONFIG_EXAMPLES_NX_VPLANE 0 +#endif + +/* If not specified, assume that the hardware supports one LCD device */ + +#ifndef CONFIG_EXAMPLES_NX_DEVNO +# define CONFIG_EXAMPLES_NX_DEVNO 0 +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static int g_exitcode = NXEXIT_SUCCESS; + +static struct nxeg_state_s g_wstate[2]; + +#ifdef CONFIG_NX_KBD +static const uint8_t g_kbdmsg1[] = "NuttX is cool!"; +static const uint8_t g_kbdmsg2[] = "NuttX is fun!"; +#endif + +/* The font handle */ + +NXHANDLE g_fonthandle; + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* The connecton handler */ + +NXHANDLE g_hnx = NULL; + +/* The screen resolution */ + +nxgl_coord_t g_xres; +nxgl_coord_t g_yres; + +bool b_haveresolution = false; +#ifdef CONFIG_NX_MULTIUSER +bool g_connected = false; +#endif +sem_t g_semevent = {0}; + +/* Colors used to fill window 1 & 2 */ + +nxgl_mxpixel_t g_color1[CONFIG_NX_NPLANES]; +nxgl_mxpixel_t g_color2[CONFIG_NX_NPLANES]; +#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS +nxgl_mxpixel_t g_tbcolor[CONFIG_NX_NPLANES]; +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxeg_drivemouse + ****************************************************************************/ + +#ifdef CONFIG_NX_MOUSE +static void nxeg_drivemouse(void) +{ + nxgl_coord_t x; + nxgl_coord_t y; + nxgl_coord_t xstep = g_xres / 8; + nxgl_coord_t ystep = g_yres / 8; + + for (x = 0; x < g_xres; x += xstep) + { + for (y = 0; y < g_yres; y += ystep) + { + message("nxeg_drivemouse: Mouse left button at (%d,%d)\n", x, y); + (void)nx_mousein(g_hnx, x, y, NX_MOUSE_LEFTBUTTON); + } + } +} +#endif + +/**************************************************************************** + * Name: nxeg_initstate + ****************************************************************************/ + +static void nxeg_initstate(FAR struct nxeg_state_s *st, int wnum, + nxgl_mxpixel_t color) +{ +#ifdef CONFIG_NX_KBD + FAR const struct nx_font_s *fontset; +#endif + + /* Initialize the window number (used for debug output only) and color + * (used for redrawing the window) + */ + + st->wnum = wnum; + st->color[0] = color; + + /* Get information about the font set being used and save this in the + * state structure + */ + +#ifdef CONFIG_NX_KBD + fontset = nxf_getfontset(g_fonthandle); + st->nchars = 0; + st->nglyphs = 0; + st->height = fontset->mxheight; + st->width = fontset->mxwidth; + st->spwidth = fontset->spwidth; +#endif +} + +/**************************************************************************** + * Name: nxeg_freestate + ****************************************************************************/ + +#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS +static void nxeg_freestate(FAR struct nxeg_state_s *st) +{ +#ifdef CONFIG_NX_KBD + int i; + + if (st) + { + for (i = 0; i < st->nglyphs; i++) + { + if (st->glyph[i].bitmap) + { + free(st->glyph[i].bitmap); + } + st->glyph[i].bitmap = NULL; + } + st->nchars = 0; + } +#endif +} +#endif + +/**************************************************************************** + * Name: nxeg_openwindow + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_NX_RAWWINDOWS +static inline NXEGWINDOW nxeg_openwindow(FAR const struct nx_callback_s *cb, + FAR struct nxeg_state_s *state) +{ + NXEGWINDOW hwnd; + + hwnd = nx_openwindow(g_hnx, cb, (FAR void *)state); + if (!hwnd) + { + message("nxeg_openwindow: nx_openwindow failed: %d\n", errno); + g_exitcode = NXEXIT_NXOPENWINDOW; + } + return hwnd; +} +#else +static inline NXEGWINDOW nxeg_openwindow(FAR const struct nx_callback_s *cb, + FAR struct nxeg_state_s *state) +{ + NXEGWINDOW hwnd; + + hwnd = nxtk_openwindow(g_hnx, cb, (FAR void *)state); + if (!hwnd) + { + message("nxeg_openwindow: nxtk_openwindow failed: %d\n", errno); + g_exitcode = NXEXIT_NXOPENWINDOW; + } + return hwnd; +} +#endif + +/**************************************************************************** + * Name: nxeg_closewindow + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_NX_RAWWINDOWS +static inline int nxeg_closewindow(NXEGWINDOW hwnd, FAR struct nxeg_state_s *state) +{ + int ret = nx_closewindow(hwnd); + if (ret < 0) + { + message("nxeg_closewindow: nx_closewindow failed: %d\n", errno); + g_exitcode = NXEXIT_NXCLOSEWINDOW; + } + return ret; +} +#else +static inline int nxeg_closewindow(NXEGWINDOW hwnd, FAR struct nxeg_state_s *state) +{ + int ret = nxtk_closewindow(hwnd); + if (ret < 0) + { + message("nxeg_closewindow: nxtk_closewindow failed: %d\n", errno); + g_exitcode = NXEXIT_NXCLOSEWINDOW; + } + nxeg_freestate(state); + return ret; +} +#endif + +/**************************************************************************** + * Name: nxeg_setsize + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_NX_RAWWINDOWS +static inline int nxeg_setsize(NXEGWINDOW hwnd, FAR struct nxgl_size_s *size) +{ + int ret = nx_setsize(hwnd, size); + if (ret < 0) + { + message("nxeg_setsize: nx_setsize failed: %d\n", errno); + g_exitcode = NXEXIT_NXSETSIZE; + } + return ret; +} +#else +static inline int nxeg_setsize(NXEGWINDOW hwnd, FAR struct nxgl_size_s *size) +{ + int ret = nxtk_setsize(hwnd, size); + if (ret < 0) + { + message("nxeg_setsize: nxtk_setsize failed: %d\n", errno); + g_exitcode = NXEXIT_NXSETSIZE; + } + return ret; +} +#endif + +/**************************************************************************** + * Name: nxeg_setposition + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_NX_RAWWINDOWS +static inline int nxeg_setposition(NXEGWINDOW hwnd, FAR struct nxgl_point_s *pos) +{ + int ret = nx_setposition(hwnd, pos); + if (ret < 0) + { + message("nxeg_setposition: nx_setposition failed: %d\n", errno); + g_exitcode = NXEXIT_NXSETPOSITION; + } + return ret; +} +#else +static inline int nxeg_setposition(NXEGWINDOW hwnd, FAR struct nxgl_point_s *pos) +{ + int ret = nxtk_setposition(hwnd, pos); + if (ret < 0) + { + message("nxeg_setposition: nxtk_setposition failed: %d\n", errno); + g_exitcode = NXEXIT_NXSETPOSITION; + } + return ret; +} +#endif + +/**************************************************************************** + * Name: nxeq_opentoolbar + ****************************************************************************/ + +#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS +static inline int nxeq_opentoolbar(NXEGWINDOW hwnd, nxgl_coord_t height, + FAR const struct nx_callback_s *cb, + FAR struct nxeg_state_s *state) +{ + int ret; + ret = nxtk_opentoolbar(hwnd, height, cb, (FAR void *)state); + if (ret < 0) + { + message("nxeq_opentoolbar: nxtk_opentoolbar failed: %d\n", errno); + g_exitcode = NXEXIT_NXOPENTOOLBAR; + } + return ret; +} +#endif + +/**************************************************************************** + * Name: nxeg_lower + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_NX_RAWWINDOWS +static inline int nxeg_lower(NXEGWINDOW hwnd) +{ + int ret = nx_lower(hwnd); + if (ret < 0) + { + message("nxeg_lower: nx_lower failed: %d\n", errno); + g_exitcode = NXEXIT_NXLOWER; + } + return ret; +} +#else +static inline int nxeg_lower(NXEGWINDOW hwnd) +{ + int ret = nxtk_lower(hwnd); + if (ret < 0) + { + message("nxeg_lower: nxtk_lower failed: %d\n", errno); + g_exitcode = NXEXIT_NXLOWER; + } + return ret; +} +#endif + +/**************************************************************************** + * Name: nxeg_raise + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_NX_RAWWINDOWS +static inline int nxeg_raise(NXEGWINDOW hwnd) +{ + int ret = nx_raise(hwnd); + if (ret < 0) + { + message("nxeg_raise: nx_raise failed: %d\n", errno); + g_exitcode = NXEXIT_NXRAISE; + } + return ret; +} +#else +static inline int nxeg_raise(NXEGWINDOW hwnd) +{ + int ret = nxtk_raise(hwnd); + if (ret < 0) + { + message("nxeg_raise: nxtk_raise failed: %d\n", errno); + g_exitcode = NXEXIT_NXRAISE; + } + return ret; +} +#endif + +/**************************************************************************** + * Name: nxeg_suinitialize + ****************************************************************************/ + +#ifndef CONFIG_NX_MULTIUSER +static inline int nxeg_suinitialize(void) +{ + FAR NX_DRIVERTYPE *dev; + +#if defined(CONFIG_EXAMPLES_NX_EXTERNINIT) + /* Use external graphics driver initialization */ + + message("nxeg_initialize: Initializing external graphics device\n"); + dev = up_nxdrvinit(CONFIG_EXAMPLES_NX_DEVNO); + if (!dev) + { + message("nxeg_initialize: up_nxdrvinit failed, devno=%d\n", CONFIG_EXAMPLES_NX_DEVNO); + g_exitcode = NXEXIT_EXTINITIALIZE; + return ERROR; + } + +#elif defined(CONFIG_NX_LCDDRIVER) + int ret; + + /* Initialize the LCD device */ + + message("nxeg_initialize: Initializing LCD\n"); + ret = up_lcdinitialize(); + if (ret < 0) + { + message("nxeg_initialize: up_lcdinitialize failed: %d\n", -ret); + g_exitcode = NXEXIT_LCDINITIALIZE; + return ERROR; + } + + /* Get the device instance */ + + dev = up_lcdgetdev(CONFIG_EXAMPLES_NX_DEVNO); + if (!dev) + { + message("nxeg_initialize: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NX_DEVNO); + g_exitcode = NXEXIT_LCDGETDEV; + return ERROR; + } + + /* Turn the LCD on at 75% power */ + + (void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4)); +#else + int ret; + + /* Initialize the frame buffer device */ + + message("nxeg_initialize: Initializing framebuffer\n"); + ret = up_fbinitialize(); + if (ret < 0) + { + message("nxeg_initialize: up_fbinitialize failed: %d\n", -ret); + g_exitcode = NXEXIT_FBINITIALIZE; + return ERROR; + } + + dev = up_fbgetvplane(CONFIG_EXAMPLES_NX_VPLANE); + if (!dev) + { + message("nxeg_initialize: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NX_VPLANE); + g_exitcode = NXEXIT_FBGETVPLANE; + return ERROR; + } +#endif + + /* Then open NX */ + + message("nxeg_initialize: Open NX\n"); + g_hnx = nx_open(dev); + if (!g_hnx) + { + message("nxeg_suinitialize: nx_open failed: %d\n", errno); + g_exitcode = NXEXIT_NXOPEN; + return ERROR; + } + return OK; +} +#endif + +/**************************************************************************** + * Name: nxeg_initialize + ****************************************************************************/ + +#ifdef CONFIG_NX_MULTIUSER +static inline int nxeg_muinitialize(void) +{ + struct sched_param param; + pthread_t thread; + pid_t servrid; + int ret; + + /* Set the client task priority */ + + param.sched_priority = CONFIG_EXAMPLES_NX_CLIENTPRIO; + ret = sched_setparam(0, ¶m); + if (ret < 0) + { + message("nxeg_initialize: sched_setparam failed: %d\n" , ret); + g_exitcode = NXEXIT_SCHEDSETPARAM; + return ERROR; + } + + /* Start the server task */ + + message("nxeg_initialize: Starting nx_servertask task\n"); + servrid = task_create("NX Server", CONFIG_EXAMPLES_NX_SERVERPRIO, + CONFIG_EXAMPLES_NX_STACKSIZE, nx_servertask, NULL); + if (servrid < 0) + { + message("nxeg_initialize: Failed to create nx_servertask task: %d\n", errno); + g_exitcode = NXEXIT_TASKCREATE; + return ERROR; + } + + /* Wait a bit to let the server get started */ + + sleep(1); + + /* Connect to the server */ + + g_hnx = nx_connect(); + if (g_hnx) + { + pthread_attr_t attr; + + /* Start a separate thread to listen for server events. This is probably + * the least efficient way to do this, but it makes this example flow more + * smoothly. + */ + + (void)pthread_attr_init(&attr); + param.sched_priority = CONFIG_EXAMPLES_NX_LISTENERPRIO; + (void)pthread_attr_setschedparam(&attr, ¶m); + (void)pthread_attr_setstacksize(&attr, CONFIG_EXAMPLES_NX_STACKSIZE); + + ret = pthread_create(&thread, &attr, nx_listenerthread, NULL); + if (ret != 0) + { + printf("nxeg_initialize: pthread_create failed: %d\n", ret); + g_exitcode = NXEXIT_PTHREADCREATE; + return ERROR; + } + + /* Don't return until we are connected to the server */ + + while (!g_connected) + { + /* Wait for the listener thread to wake us up when we really + * are connected. + */ + + (void)sem_wait(&g_semevent); + } + } + else + { + message("nxeg_initialize: nx_connect failed: %d\n", errno); + g_exitcode = NXEXIT_NXCONNECT; + return ERROR; + } + return OK; +} +#endif + +/**************************************************************************** + * Name: nxeg_initialize + ****************************************************************************/ + +static int nxeg_initialize(void) +{ + int i; + + /* Initialize window colors */ + + for (i = 0; i < CONFIG_NX_NPLANES; i++) + { + g_color1[i] = CONFIG_EXAMPLES_NX_COLOR1; + g_color2[i] = CONFIG_EXAMPLES_NX_COLOR2; +#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS + g_tbcolor[i] = CONFIG_EXAMPLES_NX_TBCOLOR; +#endif + } + +#ifdef CONFIG_NX_MULTIUSER + return nxeg_muinitialize(); +#else + return nxeg_suinitialize(); +#endif +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: user_start/nx_main + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_NX_BUILTIN +# define MAIN_NAME nx_main +# define MAIN_NAME_STRING "nx_main" +#else +# define MAIN_NAME user_start +# define MAIN_NAME_STRING "user_start" +#endif + +int MAIN_NAME(int argc, char *argv[]) +{ + NXEGWINDOW hwnd1; + NXEGWINDOW hwnd2; + struct nxgl_size_s size; + struct nxgl_point_s pt; + nxgl_mxpixel_t color; + int ret; + + /* Initialize */ + + ret = nxeg_initialize(); + message(MAIN_NAME_STRING ": NX handle=%p\n", g_hnx); + if (!g_hnx || ret < 0) + { + message(MAIN_NAME_STRING ": Failed to get NX handle: %d\n", errno); + g_exitcode = NXEXIT_NXOPEN; + goto errout; + } + + /* Get the default font handle */ + + g_fonthandle = nxf_getfonthandle(CONFIG_EXAMPLES_NX_FONTID); + if (!g_fonthandle) + { + message(MAIN_NAME_STRING ": Failed to get font handle: %d\n", errno); + g_exitcode = NXEXIT_FONTOPEN; + goto errout; + } + + /* Set the background to the configured background color */ + + message(MAIN_NAME_STRING ": Set background color=%d\n", CONFIG_EXAMPLES_NX_BGCOLOR); + color = CONFIG_EXAMPLES_NX_BGCOLOR; + ret = nx_setbgcolor(g_hnx, &color); + if (ret < 0) + { + message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno); + g_exitcode = NXEXIT_NXSETBGCOLOR; + goto errout_with_nx; + } + + /* Create window #1 */ + + message(MAIN_NAME_STRING ": Create window #1\n"); + nxeg_initstate(&g_wstate[0], 1, CONFIG_EXAMPLES_NX_COLOR1); + hwnd1 = nxeg_openwindow(&g_nxcb, &g_wstate[0]); + message(MAIN_NAME_STRING ": hwnd1=%p\n", hwnd1); + if (!hwnd1) + { + goto errout_with_nx; + } + + /* Wait until we have the screen resolution */ + + while (!b_haveresolution) + { + (void)sem_wait(&g_semevent); + } + message(MAIN_NAME_STRING ": Screen resolution (%d,%d)\n", g_xres, g_yres); + + /* Set the size of the window 1 */ + + size.w = g_xres / 2; + size.h = g_yres / 2; + + message(MAIN_NAME_STRING ": Set window #1 size to (%d,%d)\n", size.w, size.h); + ret = nxeg_setsize(hwnd1, &size); + if (ret < 0) + { + goto errout_with_hwnd1; + } + + /* Sleep a bit -- both so that we can see the result of the above operations + * but also, in the multi-user case, so that the server can get a chance to + * actually do them! + */ + + message(MAIN_NAME_STRING ": Sleeping\n\n"); + sleep(1); + + /* Set the position of window #1 */ + + pt.x = g_xres / 8; + pt.y = g_yres / 8; + + message(MAIN_NAME_STRING ": Set window #1 postion to (%d,%d)\n", pt.x, pt.y); + ret = nxeg_setposition(hwnd1, &pt); + if (ret < 0) + { + goto errout_with_hwnd1; + } + + /* Sleep a bit */ + + message(MAIN_NAME_STRING ": Sleeping\n\n"); + sleep(1); + + /* Open the toolbar */ + +#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS + message(MAIN_NAME_STRING ": Add toolbar to window #1\n"); + ret = nxeq_opentoolbar(hwnd1, CONFIG_EXAMPLES_NX_TOOLBAR_HEIGHT, &g_tbcb, &g_wstate[0]); + if (ret < 0) + { + goto errout_with_hwnd1; + } + + /* Sleep a bit */ + + message(MAIN_NAME_STRING ": Sleeping\n\n"); + sleep(1); +#endif + + /* Create window #2 */ + + message(MAIN_NAME_STRING ": Create window #2\n"); + nxeg_initstate(&g_wstate[1], 2, CONFIG_EXAMPLES_NX_COLOR2); + hwnd2 = nxeg_openwindow(&g_nxcb, &g_wstate[1]); + message(MAIN_NAME_STRING ": hwnd2=%p\n", hwnd2); + if (!hwnd2) + { + goto errout_with_hwnd1; + } + + /* Sleep a bit */ + + message(MAIN_NAME_STRING ": Sleeping\n\n"); + sleep(1); + + /* Set the size of the window 2 == size of window 1*/ + + message(MAIN_NAME_STRING ": Set hwnd2 size to (%d,%d)\n", size.w, size.h); + ret = nxeg_setsize(hwnd2, &size); + if (ret < 0) + { + goto errout_with_hwnd2; + } + + /* Sleep a bit */ + + message(MAIN_NAME_STRING ": Sleeping\n\n"); + sleep(1); + + /* Set the position of window #2 */ + + pt.x = g_xres - size.w - pt.x; + pt.y = g_yres - size.h - pt.y; + + message(MAIN_NAME_STRING ": Set hwnd2 postion to (%d,%d)\n", pt.x, pt.y); + ret = nxeg_setposition(hwnd2, &pt); + if (ret < 0) + { + goto errout_with_hwnd2; + } + + /* Sleep a bit */ + + message(MAIN_NAME_STRING ": Sleeping\n\n"); + sleep(1); + +#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS + message(MAIN_NAME_STRING ": Add toolbar to window #2\n"); + ret = nxeq_opentoolbar(hwnd2, CONFIG_EXAMPLES_NX_TOOLBAR_HEIGHT, &g_tbcb, &g_wstate[1]); + if (ret < 0) + { + goto errout_with_hwnd2; + } + + /* Sleep a bit */ + + message(MAIN_NAME_STRING ": Sleeping\n\n"); + sleep(1); +#endif + + /* Give keyboard input to the top window -- should be window #2 */ + +#ifdef CONFIG_NX_KBD + message(MAIN_NAME_STRING ": Send keyboard input: %s\n", g_kbdmsg1); + ret = nx_kbdin(g_hnx, strlen((FAR const char *)g_kbdmsg1), g_kbdmsg1); + if (ret < 0) + { + message(MAIN_NAME_STRING ": nx_kbdin failed: %d\n", errno); + goto errout_with_hwnd2; + } + + /* Sleep a bit */ + + message(MAIN_NAME_STRING ": Sleeping\n\n"); + sleep(1); +#endif + + /* Lower window 2 */ + + message(MAIN_NAME_STRING ": Lower window #2\n"); + ret = nxeg_lower(hwnd2); + if (ret < 0) + { + goto errout_with_hwnd2; + } + + /* Sleep a bit */ + + message(MAIN_NAME_STRING ": Sleeping\n\n"); + sleep(1); + + /* Put mouse left-button clicks all over the screen and see who responds */ + +#ifdef CONFIG_NX_MOUSE + nxeg_drivemouse(); + + /* Sleep a bit */ + + message(MAIN_NAME_STRING ": Sleeping\n\n"); + sleep(1); +#endif + + /* Give keyboard input to the top window -- should be window #1 */ + +#ifdef CONFIG_NX_KBD + message(MAIN_NAME_STRING ": Send keyboard input: %s\n", g_kbdmsg2); + ret = nx_kbdin(g_hnx, strlen((FAR const char *)g_kbdmsg2), g_kbdmsg2); + if (ret < 0) + { + message(MAIN_NAME_STRING ": nx_kbdin failed: %d\n", errno); + goto errout_with_hwnd2; + } + + /* Sleep a bit */ + + message(MAIN_NAME_STRING ": Sleeping\n\n"); + sleep(1); +#endif + + /* Raise window 2 */ + + message(MAIN_NAME_STRING ": Raise window #2\n"); + ret = nxeg_raise(hwnd2); + if (ret < 0) + { + goto errout_with_hwnd2; + } + + /* Put mouse left-button clicks all over the screen and see who responds */ + +#ifdef CONFIG_NX_MOUSE + nxeg_drivemouse(); +#endif + + /* Sleep a bit */ + + message(MAIN_NAME_STRING ": Sleeping\n\n"); + sleep(2); + + /* Close the window 2 */ + +errout_with_hwnd2: + message(MAIN_NAME_STRING ": Close window #2\n"); + (void)nxeg_closewindow(hwnd2, &g_wstate[1]); + + /* Close the window1 */ + +errout_with_hwnd1: + message(MAIN_NAME_STRING ": Close window #1\n"); + (void)nxeg_closewindow(hwnd1, &g_wstate[0]); + +errout_with_nx: +#ifdef CONFIG_NX_MULTIUSER + /* Disconnect from the server */ + + message(MAIN_NAME_STRING ": Disconnect from the server\n"); + nx_disconnect(g_hnx); +#else + /* Close the server */ + + message(MAIN_NAME_STRING ": Close NX\n"); + nx_close(g_hnx); +#endif +errout: + return g_exitcode; +} diff --git a/apps/examples/nx/nx_server.c b/apps/examples/nx/nx_server.c new file mode 100644 index 0000000000..a7a305d634 --- /dev/null +++ b/apps/examples/nx/nx_server.c @@ -0,0 +1,152 @@ +/**************************************************************************** + * examples/nx/nx_server.c + * + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#ifdef CONFIG_NX_LCDDRIVER +# include +#else +# include +#endif + +#include "nx_internal.h" + +#ifdef CONFIG_NX_MULTIUSER + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nx_servertask + ****************************************************************************/ + +int nx_servertask(int argc, char *argv[]) +{ + FAR NX_DRIVERTYPE *dev; + int ret; + +#if defined(CONFIG_EXAMPLES_NX_EXTERNINIT) + /* Use external graphics driver initialization */ + + message("nxeg_initialize: Initializing external graphics device\n"); + dev = up_nxdrvinit(CONFIG_EXAMPLES_NX_DEVNO); + if (!dev) + { + message("nxeg_initialize: up_nxdrvinit failed, devno=%d\n", CONFIG_EXAMPLES_NX_DEVNO); + g_exitcode = NXEXIT_EXTINITIALIZE; + return ERROR; + } + +#elif defined(CONFIG_NX_LCDDRIVER) + /* Initialize the LCD device */ + + message("nx_servertask: Initializing LCD\n"); + ret = up_lcdinitialize(); + if (ret < 0) + { + message("nx_servertask: up_lcdinitialize failed: %d\n", -ret); + return 1; + } + + /* Get the device instance */ + + dev = up_lcdgetdev(CONFIG_EXAMPLES_NX_DEVNO); + if (!dev) + { + message("nx_servertask: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NX_DEVNO); + return 2; + } + + /* Turn the LCD on at 75% power */ + + (void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4)); +#else + /* Initialize the frame buffer device */ + + message("nx_servertask: Initializing framebuffer\n"); + ret = up_fbinitialize(); + if (ret < 0) + { + message("nx_servertask: up_fbinitialize failed: %d\n", -ret); + return 1; + } + + dev = up_fbgetvplane(CONFIG_EXAMPLES_NX_VPLANE); + if (!dev) + { + message("nx_servertask: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NX_VPLANE); + return 2; + } +#endif + + /* Then start the server */ + + ret = nx_run(dev); + message("nx_servertask: nx_run returned: %d\n", errno); + return 3; +} + +#endif /* CONFIG_NX_MULTIUSER */ diff --git a/apps/examples/nxffs/Makefile b/apps/examples/nxffs/Makefile new file mode 100644 index 0000000000..1021bfc6d1 --- /dev/null +++ b/apps/examples/nxffs/Makefile @@ -0,0 +1,93 @@ +############################################################################ +# apps/examples/nxffs/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# Hello, World! Example + +ASRCS = +CSRCS = nxffs_main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/nxffs/nxffs_main.c b/apps/examples/nxffs/nxffs_main.c new file mode 100644 index 0000000000..863f8bb433 --- /dev/null +++ b/apps/examples/nxffs/nxffs_main.c @@ -0,0 +1,947 @@ +/**************************************************************************** + * examples/nxffs/nxffs_main.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ +/* Configuration ************************************************************/ +/* The default is to use the RAM MTD device at drivers/mtd/rammtd.c. But + * an architecture-specific MTD driver can be used instead by defining + * CONFIG_EXAMPLES_NXFFS_ARCHINIT. In this case, the initialization logic + * will call nxffs_archinitialize() to obtain the MTD driver instance. + */ + +#ifndef CONFIG_EXAMPLES_NXFFS_ARCHINIT + +/* This must exactly match the default configuration in drivers/mtd/rammtd.c */ + +# ifndef CONFIG_RAMMTD_BLOCKSIZE +# define CONFIG_RAMMTD_BLOCKSIZE 512 +# endif + +# ifndef CONFIG_RAMMTD_ERASESIZE +# define CONFIG_RAMMTD_ERASESIZE 4096 +# endif + +# ifndef CONFIG_EXAMPLES_NXFFS_NEBLOCKS +# define CONFIG_EXAMPLES_NXFFS_NEBLOCKS (32) +# endif + +# undef CONFIG_EXAMPLES_NXFFS_BUFSIZE +# define CONFIG_EXAMPLES_NXFFS_BUFSIZE \ + (CONFIG_RAMMTD_ERASESIZE * CONFIG_EXAMPLES_NXFFS_NEBLOCKS) +#endif + +#ifndef CONFIG_EXAMPLES_NXFFS_MAXNAME +# define CONFIG_EXAMPLES_NXFFS_MAXNAME 128 +#endif + +#if CONFIG_EXAMPLES_NXFFS_MAXNAME > 255 +# undef CONFIG_EXAMPLES_NXFFS_MAXNAME +# define CONFIG_EXAMPLES_NXFFS_MAXNAME 255 +#endif + +#ifndef CONFIG_EXAMPLES_NXFFS_MAXFILE +# define CONFIG_EXAMPLES_NXFFS_MAXFILE 8192 +#endif + +#ifndef CONFIG_EXAMPLES_NXFFS_MAXIO +# define CONFIG_EXAMPLES_NXFFS_MAXIO 347 +#endif + +#ifndef CONFIG_EXAMPLES_NXFFS_MAXOPEN +# define CONFIG_EXAMPLES_NXFFS_MAXOPEN 512 +#endif + +#ifndef CONFIG_EXAMPLES_NXFFS_MOUNTPT +# define CONFIG_EXAMPLES_NXFFS_MOUNTPT "/mnt/nxffs" +#endif + +#ifndef CONFIG_EXAMPLES_NXFFS_NLOOPS +# define CONFIG_EXAMPLES_NXFFS_NLOOPS 100 +#endif + +#ifndef CONFIG_EXAMPLES_NXFFS_VERBOSE +# define CONFIG_EXAMPLES_NXFFS_VERBOSE 0 +#endif + +#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_FS) +# define message lib_rawprintf +# define msgflush() +#else +# define message printf +# define msgflush() fflush(stdout); +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct nxffs_filedesc_s +{ + FAR char *name; + bool deleted; + size_t len; + uint32_t crc; +}; + +/**************************************************************************** + * Private Data + ****************************************************************************/ +/* Pre-allocated simulated flash */ + +#ifndef CONFIG_EXAMPLES_NXFFS_ARCHINIT +static uint8_t g_simflash[CONFIG_EXAMPLES_NXFFS_BUFSIZE]; +#endif + +static uint8_t g_fileimage[CONFIG_EXAMPLES_NXFFS_MAXFILE]; +static struct nxffs_filedesc_s g_files[CONFIG_EXAMPLES_NXFFS_MAXOPEN]; +static const char g_mountdir[] = CONFIG_EXAMPLES_NXFFS_MOUNTPT "/"; +static int g_nfiles; +static int g_ndeleted; + +static struct mallinfo g_mmbefore; +static struct mallinfo g_mmprevious; +static struct mallinfo g_mmafter; + +/**************************************************************************** + * External Functions + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_NXFFS_ARCHINIT +extern FAR struct mtd_dev_s *nxffs_archinitialize(void); +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxffs_memusage + ****************************************************************************/ + +static void nxffs_showmemusage(struct mallinfo *mmbefore, + struct mallinfo *mmafter) +{ + message("VARIABLE BEFORE AFTER\n"); + message("======== ======== ========\n"); + message("arena %8x %8x\n", mmbefore->arena, mmafter->arena); + message("ordblks %8d %8d\n", mmbefore->ordblks, mmafter->ordblks); + message("mxordblk %8x %8x\n", mmbefore->mxordblk, mmafter->mxordblk); + message("uordblks %8x %8x\n", mmbefore->uordblks, mmafter->uordblks); + message("fordblks %8x %8x\n", mmbefore->fordblks, mmafter->fordblks); +} + +/**************************************************************************** + * Name: nxffs_loopmemusage + ****************************************************************************/ + +static void nxffs_loopmemusage(void) +{ + /* Get the current memory usage */ + +#ifdef CONFIG_CAN_PASS_STRUCTS + g_mmafter = mallinfo(); +#else + (void)mallinfo(&g_mmafter); +#endif + + /* Show the change from the previous loop */ + + message("\nEnd of loop memory usage:\n"); + nxffs_showmemusage(&g_mmprevious, &g_mmafter); + + /* Set up for the next test */ + +#ifdef CONFIG_CAN_PASS_STRUCTS + g_mmprevious = g_mmafter; +#else + memcpy(&g_mmprevious, &g_mmafter, sizeof(struct mallinfo)); +#endif +} + +/**************************************************************************** + * Name: nxffs_endmemusage + ****************************************************************************/ + +static void nxffs_endmemusage(void) +{ +#ifdef CONFIG_CAN_PASS_STRUCTS + g_mmafter = mallinfo(); +#else + (void)mallinfo(&g_mmafter); +#endif + message("\nFinal memory usage:\n"); + nxffs_showmemusage(&g_mmbefore, &g_mmafter); +} + +/**************************************************************************** + * Name: nxffs_randchar + ****************************************************************************/ + +static inline char nxffs_randchar(void) +{ + int value = rand() % 63; + if (value == 0) + { + return '/'; + } + else if (value <= 10) + { + return value + '0' - 1; + } + else if (value <= 36) + { + return value + 'a' - 11; + } + else /* if (value <= 62) */ + { + return value + 'A' - 37; + } +} + +/**************************************************************************** + * Name: nxffs_randname + ****************************************************************************/ + +static inline void nxffs_randname(FAR struct nxffs_filedesc_s *file) +{ + int dirlen; + int maxname; + int namelen; + int alloclen; + int i; + + dirlen = strlen(g_mountdir); + maxname = CONFIG_EXAMPLES_NXFFS_MAXNAME - dirlen; + namelen = (rand() % maxname) + 1; + alloclen = namelen + dirlen; + + file->name = (FAR char*)malloc(alloclen + 1); + if (!file->name) + { + message("ERROR: Failed to allocate name, length=%d\n", namelen); + msgflush(); + exit(5); + } + + memcpy(file->name, g_mountdir, dirlen); + for (i = dirlen; i < alloclen; i++) + { + file->name[i] = nxffs_randchar(); + } + + file->name[alloclen] = '\0'; +} + +/**************************************************************************** + * Name: nxffs_randfile + ****************************************************************************/ + +static inline void nxffs_randfile(FAR struct nxffs_filedesc_s *file) +{ + int i; + + file->len = (rand() % CONFIG_EXAMPLES_NXFFS_MAXFILE) + 1; + for (i = 0; i < file->len; i++) + { + g_fileimage[i] = nxffs_randchar(); + } + file->crc = crc32(g_fileimage, file->len); +} + +/**************************************************************************** + * Name: nxffs_freefile + ****************************************************************************/ + +static void nxffs_freefile(FAR struct nxffs_filedesc_s *file) +{ + if (file->name) + { + free(file->name); + } + memset(file, 0, sizeof(struct nxffs_filedesc_s)); +} + +/**************************************************************************** + * Name: nxffs_wrfile + ****************************************************************************/ + +static inline int nxffs_wrfile(FAR struct nxffs_filedesc_s *file) +{ + size_t offset; + int fd; + int ret; + + /* Create a random file */ + + nxffs_randname(file); + nxffs_randfile(file); + fd = open(file->name, O_WRONLY | O_CREAT | O_EXCL, 0666); + if (fd < 0) + { + /* If it failed because there is no space on the device, then don't + * complain. + */ + + if (errno != ENOSPC) + { + message("ERROR: Failed to open file for writing: %d\n", errno); + message(" File name: %s\n", file->name); + message(" File size: %d\n", file->len); + } + nxffs_freefile(file); + return ERROR; + } + + /* Write a random amount of data to the file */ + + for (offset = 0; offset < file->len; ) + { + size_t maxio = (rand() % CONFIG_EXAMPLES_NXFFS_MAXIO) + 1; + size_t nbytestowrite = file->len - offset; + ssize_t nbyteswritten; + + if (nbytestowrite > maxio) + { + nbytestowrite = maxio; + } + + nbyteswritten = write(fd, &g_fileimage[offset], nbytestowrite); + if (nbyteswritten < 0) + { + int err = errno; + + /* If the write failed because there is no space on the device, + * then don't complain. + */ + + if (err != ENOSPC) + { + message("ERROR: Failed to write file: %d\n", err); + message(" File name: %s\n", file->name); + message(" File size: %d\n", file->len); + message(" Write offset: %d\n", offset); + message(" Write size: %d\n", nbytestowrite); + ret = ERROR; + } + close(fd); + + /* Remove any garbage file that might have been left behind */ + + ret = unlink(file->name); + if (ret < 0) + { + message(" Failed to remove partial file\n"); + } + else + { +#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 + message(" Successfully removed partial file\n"); +#endif + } + + nxffs_freefile(file); + return ERROR; + } + else if (nbyteswritten != nbytestowrite) + { + message("ERROR: Partial write:\n"); + message(" File name: %s\n", file->name); + message(" File size: %d\n", file->len); + message(" Write offset: %d\n", offset); + message(" Write size: %d\n", nbytestowrite); + message(" Written: %d\n", nbyteswritten); + } + offset += nbyteswritten; + } + + close(fd); + return OK; +} + +/**************************************************************************** + * Name: nxffs_fillfs + ****************************************************************************/ + +static int nxffs_fillfs(void) +{ + FAR struct nxffs_filedesc_s *file; + int ret; + int i; + + /* Create a file for each unused file structure */ + + for (i = 0; i < CONFIG_EXAMPLES_NXFFS_MAXOPEN; i++) + { + file = &g_files[i]; + if (file->name == NULL) + { + ret = nxffs_wrfile(file); + if (ret < 0) + { +#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 + message("ERROR: Failed to write file %d\n", i); +#endif + return ERROR; + } + +#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 + message(" Created file %s\n", file->name); +#endif + g_nfiles++; + } + } + + return OK; +} + +/**************************************************************************** + * Name: nxffs_rdblock + ****************************************************************************/ + +static ssize_t nxffs_rdblock(int fd, FAR struct nxffs_filedesc_s *file, + size_t offset, size_t len) +{ + size_t maxio = (rand() % CONFIG_EXAMPLES_NXFFS_MAXIO) + 1; + ssize_t nbytesread; + + if (len > maxio) + { + len = maxio; + } + + nbytesread = read(fd, &g_fileimage[offset], len); + if (nbytesread < 0) + { + message("ERROR: Failed to read file: %d\n", errno); + message(" File name: %s\n", file->name); + message(" File size: %d\n", file->len); + message(" Read offset: %d\n", offset); + message(" Read size: %d\n", len); + return ERROR; + } + else if (nbytesread == 0) + { +#if 0 /* No... we do this on purpose sometimes */ + message("ERROR: Unexpected end-of-file:\n"); + message(" File name: %s\n", file->name); + message(" File size: %d\n", file->len); + message(" Read offset: %d\n", offset); + message(" Read size: %d\n", len); +#endif + return ERROR; + } + else if (nbytesread != len) + { + message("ERROR: Partial read:\n"); + message(" File name: %s\n", file->name); + message(" File size: %d\n", file->len); + message(" Read offset: %d\n", offset); + message(" Read size: %d\n", len); + message(" Bytes read: %d\n", nbytesread); + } + return nbytesread; +} + +/**************************************************************************** + * Name: nxffs_rdfile + ****************************************************************************/ + +static inline int nxffs_rdfile(FAR struct nxffs_filedesc_s *file) +{ + size_t ntotalread; + ssize_t nbytesread; + uint32_t crc; + int fd; + + /* Open the file for reading */ + + fd = open(file->name, O_RDONLY); + if (fd < 0) + { + if (!file->deleted) + { + message("ERROR: Failed to open file for reading: %d\n", errno); + message(" File name: %s\n", file->name); + message(" File size: %d\n", file->len); + } + return ERROR; + } + + /* Read all of the data info the fileimage buffer using random read sizes */ + + for (ntotalread = 0; ntotalread < file->len; ) + { + nbytesread = nxffs_rdblock(fd, file, ntotalread, file->len - ntotalread); + if (nbytesread < 0) + { + close(fd); + return ERROR; + } + + ntotalread += nbytesread; + } + + /* Verify the file image CRC */ + + crc = crc32(g_fileimage, file->len); + if (crc != file->crc) + { + message("ERROR: Bad CRC: %d vs %d\n", crc, file->crc); + message(" File name: %s\n", file->name); + message(" File size: %d\n", file->len); + close(fd); + return ERROR; + } + + /* Try reading past the end of the file */ + + nbytesread = nxffs_rdblock(fd, file, ntotalread, 1024) ; + if (nbytesread > 0) + { + message("ERROR: Read past the end of file\n"); + message(" File name: %s\n", file->name); + message(" File size: %d\n", file->len); + message(" Bytes read: %d\n", nbytesread); + close(fd); + return ERROR; + } + + close(fd); + return OK; +} + +/**************************************************************************** + * Name: nxffs_verifyfs + ****************************************************************************/ + +static int nxffs_verifyfs(void) +{ + FAR struct nxffs_filedesc_s *file; + int ret; + int i; + + /* Create a file for each unused file structure */ + + for (i = 0; i < CONFIG_EXAMPLES_NXFFS_MAXOPEN; i++) + { + file = &g_files[i]; + if (file->name != NULL) + { + ret = nxffs_rdfile(file); + if (ret < 0) + { + if (file->deleted) + { +#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 + message("Deleted file %d OK\n", i); +#endif + nxffs_freefile(file); + g_ndeleted--; + g_nfiles--; + } + else + { + message("ERROR: Failed to read a file: %d\n", i); + message(" File name: %s\n", file->name); + message(" File size: %d\n", file->len); + return ERROR; + } + } + else + { + if (file->deleted) + { +#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 + message("Succesffully read a deleted file\n"); + message(" File name: %s\n", file->name); + message(" File size: %d\n", file->len); +#endif + nxffs_freefile(file); + g_ndeleted--; + g_nfiles--; + return ERROR; + } + else + { +#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 + message(" Verifed file %s\n", file->name); +#endif + } + } + } + } + + return OK; +} + +/**************************************************************************** + * Name: nxffs_delfiles + ****************************************************************************/ + +static int nxffs_delfiles(void) +{ + FAR struct nxffs_filedesc_s *file; + int ndel; + int ret; + int i; + int j; + + /* Are there any files to be deleted? */ + + int nfiles = g_nfiles - g_ndeleted; + if (nfiles < 1) + { + return 0; + } + + /* Yes... How many files should we delete? */ + + ndel = (rand() % nfiles) + 1; + + /* Now pick which files to delete */ + + for (i = 0; i < ndel; i++) + { + /* Guess a file index */ + + int ndx = (rand() % (g_nfiles - g_ndeleted)); + + /* And delete the next undeleted file after that random index */ + + for (j = ndx + 1; j != ndx;) + { + file = &g_files[j]; + if (file->name && !file->deleted) + { + ret = unlink(file->name); + if (ret < 0) + { + message("ERROR: Unlink %d failed: %d\n", i+1, errno); + message(" File name: %s\n", file->name); + message(" File size: %d\n", file->len); + message(" File index: %d\n", j); + } + else + { +#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 + message(" Deleted file %s\n", file->name); +#endif + file->deleted = true; + g_ndeleted++; + break; + } + } + + /* Increment the index and test for wrap-around */ + + if (++j >= CONFIG_EXAMPLES_NXFFS_MAXOPEN) + { + j = 0; + } + + } + } + + return OK; +} + +/**************************************************************************** + * Name: nxffs_delallfiles + ****************************************************************************/ + +static int nxffs_delallfiles(void) +{ + FAR struct nxffs_filedesc_s *file; + int ret; + int i; + + for (i = 0; i < CONFIG_EXAMPLES_NXFFS_MAXOPEN; i++) + { + file = &g_files[i]; + if (file->name) + { + ret = unlink(file->name); + if (ret < 0) + { + message("ERROR: Unlink %d failed: %d\n", i+1, errno); + message(" File name: %s\n", file->name); + message(" File size: %d\n", file->len); + message(" File index: %d\n", i); + } + else + { +#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 + message(" Deleted file %s\n", file->name); +#endif + nxffs_freefile(file); + } + } + } + + g_nfiles = 0; + g_ndeleted = 0; + return OK; +} + +/**************************************************************************** + * Name: nxffs_directory + ****************************************************************************/ + +static int nxffs_directory(void) +{ + DIR *dirp; + FAR struct dirent *entryp; + int number; + + /* Open the directory */ + + dirp = opendir(CONFIG_EXAMPLES_NXFFS_MOUNTPT); + + if (!dirp) + { + /* Failed to open the directory */ + + message("ERROR: Failed to open directory '%s': %d\n", + CONFIG_EXAMPLES_NXFFS_MOUNTPT, errno); + return ERROR; + } + + /* Read each directory entry */ + + message("Directory:\n"); + number = 1; + do + { + entryp = readdir(dirp); + if (entryp) + { + message("%2d. Type[%d]: %s Name: %s\n", + number, entryp->d_type, + entryp->d_type == DTYPE_FILE ? "File " : "Error", + entryp->d_name); + } + number++; + } + while (entryp != NULL); + + closedir(dirp); + return OK; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + FAR struct mtd_dev_s *mtd; + unsigned int i; + int ret; + + /* Seed the random number generated */ + + srand(0x93846); + + /* Create and initialize a RAM MTD device instance */ + +#ifdef CONFIG_EXAMPLES_NXFFS_ARCHINIT + mtd = nxffs_archinitialize(); +#else + mtd = rammtd_initialize(g_simflash, CONFIG_EXAMPLES_NXFFS_BUFSIZE); +#endif + if (!mtd) + { + message("ERROR: Failed to create RAM MTD instance\n"); + msgflush(); + exit(1); + } + + /* Initialize to provide NXFFS on an MTD interface */ + + ret = nxffs_initialize(mtd); + if (ret < 0) + { + message("ERROR: NXFFS initialization failed: %d\n", -ret); + msgflush(); + exit(2); + } + + /* Mount the file system */ + + ret = mount(NULL, CONFIG_EXAMPLES_NXFFS_MOUNTPT, "nxffs", 0, NULL); + if (ret < 0) + { + message("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + msgflush(); + exit(3); + } + + /* Set up memory monitoring */ + +#ifdef CONFIG_CAN_PASS_STRUCTS + g_mmbefore = mallinfo(); + g_mmprevious = g_mmbefore; +#else + (void)mallinfo(&g_mmbefore); + memcpy(&g_mmprevious, &g_mmbefore, sizeof(struct mallinfo)); +#endif + + /* Loop a few times ... file the file system with some random, files, + * delete some files randomly, fill the file system with more random file, + * delete, etc. This beats the FLASH very hard! + */ + +#if CONFIG_EXAMPLES_NXFFS_NLOOPS == 0 + for (i = 0; ; i++) +#else + for (i = 1; i <= CONFIG_EXAMPLES_NXFFS_NLOOPS; i++) +#endif + { + /* Write a files to the NXFFS file system until either (1) all of the + * open file structures are utilized or until (2) NXFFS reports an error + * (hopefully that the file system is full) + */ + + message("\n=== FILLING %d =============================\n", i); + ret = nxffs_fillfs(); + message("Filled file system\n"); + message(" Number of files: %d\n", g_nfiles); + message(" Number deleted: %d\n", g_ndeleted); + nxffs_dump(mtd, CONFIG_EXAMPLES_NXFFS_VERBOSE); + + /* Directory listing */ + + nxffs_directory(); + + /* Verify all files written to FLASH */ + + ret = nxffs_verifyfs(); + if (ret < 0) + { + message("ERROR: Failed to verify files\n"); + message(" Number of files: %d\n", g_nfiles); + message(" Number deleted: %d\n", g_ndeleted); + } + else + { +#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 + message("Verified!\n"); + message(" Number of files: %d\n", g_nfiles); + message(" Number deleted: %d\n", g_ndeleted); +#endif + } + + /* Delete some files */ + + message("\n=== DELETING %d ============================\n", i); + ret = nxffs_delfiles(); + if (ret < 0) + { + message("ERROR: Failed to delete files\n"); + message(" Number of files: %d\n", g_nfiles); + message(" Number deleted: %d\n", g_ndeleted); + } + else + { + message("Deleted some files\n"); + message(" Number of files: %d\n", g_nfiles); + message(" Number deleted: %d\n", g_ndeleted); + } + nxffs_dump(mtd, CONFIG_EXAMPLES_NXFFS_VERBOSE); + + /* Directory listing */ + + nxffs_directory(); + + /* Verify all files written to FLASH */ + + ret = nxffs_verifyfs(); + if (ret < 0) + { + message("ERROR: Failed to verify files\n"); + message(" Number of files: %d\n", g_nfiles); + message(" Number deleted: %d\n", g_ndeleted); + } + else + { +#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 + message("Verified!\n"); + message(" Number of files: %d\n", g_nfiles); + message(" Number deleted: %d\n", g_ndeleted); +#endif + } + + /* Show memory usage */ + + nxffs_loopmemusage(); + msgflush(); + } + + /* Delete all files then show memory usage again */ + + nxffs_delallfiles(); + nxffs_endmemusage(); + msgflush(); + return 0; +} + diff --git a/apps/examples/nxflat/Makefile b/apps/examples/nxflat/Makefile new file mode 100644 index 0000000000..d2b99eb133 --- /dev/null +++ b/apps/examples/nxflat/Makefile @@ -0,0 +1,98 @@ +############################################################################ +# apps/examples/nxflat/Makefile +# +# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# NXFLAT Example + +ASRCS = +CSRCS = nxflat_main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: headers clean depend disclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +headers: + @$(MAKE) -C tests TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +# We can't make dependencies in this directory because the required +# header files may not yet exist. + +.depend: + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/nxflat/nxflat_main.c b/apps/examples/nxflat/nxflat_main.c new file mode 100644 index 0000000000..12d88c3d5c --- /dev/null +++ b/apps/examples/nxflat/nxflat_main.c @@ -0,0 +1,224 @@ +/**************************************************************************** + * examples/nxflat/nxflat_main.c + * + * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "tests/romfs.h" +#include "tests/dirlist.h" +#include "tests/symtab.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Check configuration. This is not all of the configuration settings that + * are required -- only the more obvious. + */ + +#if CONFIG_NFILE_DESCRIPTORS < 1 +# error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file" +#endif + +#ifndef CONFIG_NXFLAT +# error "You must select CONFIG_NXFLAT in your configuration file" +#endif + +#ifndef CONFIG_FS_ROMFS +# error "You must select CONFIG_FS_ROMFS in your configuration file" +#endif + +#ifdef CONFIG_DISABLE_MOUNTPOINT +# error "You must not disable mountpoints via CONFIG_DISABLE_MOUNTPOINT in your configuration file" +#endif + +#ifdef CONFIG_BINFMT_DISABLE +# error "You must not disable loadable modules via CONFIG_BINFMT_DISABLE in your configuration file" +#endif + +/* Describe the ROMFS file system */ + +#define SECTORSIZE 512 +#define NSECTORS(b) (((b)+SECTORSIZE-1)/SECTORSIZE) +#define ROMFSDEV "/dev/ram0" +#define MOUNTPT "/mnt/romfs" + +/* If CONFIG_DEBUG is enabled, use dbg instead of printf so that the + * output will be synchronous with the debug output. + */ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_DEBUG +# define message(format, arg...) dbg(format, ##arg) +# define err(format, arg...) dbg(format, ##arg) +# else +# define message(format, arg...) printf(format, ##arg) +# define err(format, arg...) fprintf(stderr, format, ##arg) +# endif +#else +# ifdef CONFIG_DEBUG +# define message dbg +# define err dbg +# else +# define message printf +# define err printf +# endif +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const char delimiter[] = + "****************************************************************************"; + +static char path[128]; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: testheader + ****************************************************************************/ + +static inline void testheader(FAR const char *progname) +{ + message("\n%s\n* Executing %s\n%s\n\n", delimiter, progname, delimiter); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + struct binary_s bin; + int ret; + int i; + + /* Initialize the NXFLAT binary loader */ + + message("Initializing the NXFLAT binary loader\n"); + ret = nxflat_initialize(); + if (ret < 0) + { + err("ERROR: Initialization of the NXFLAT loader failed: %d\n", ret); + exit(1); + } + + /* Create a ROM disk for the ROMFS filesystem */ + + message("Registering romdisk\n"); + ret = romdisk_register(0, romfs_img, NSECTORS(romfs_img_len), SECTORSIZE); + if (ret < 0) + { + err("ERROR: romdisk_register failed: %d\n", ret); + nxflat_uninitialize(); + exit(1); + } + + /* Mount the file system */ + + message("Mounting ROMFS filesystem at target=%s with source=%s\n", + MOUNTPT, ROMFSDEV); + + ret = mount(ROMFSDEV, MOUNTPT, "romfs", MS_RDONLY, NULL); + if (ret < 0) + { + err("ERROR: mount(%s,%s,romfs) failed: %s\n", + ROMFSDEV, MOUNTPT, errno); + nxflat_uninitialize(); + } + + /* Now excercise every progrm in the ROMFS file system */ + + for (i = 0; dirlist[i]; i++) + { + testheader(dirlist[i]); + + memset(&bin, 0, sizeof(struct binary_s)); + snprintf(path, 128, "%s/%s", MOUNTPT, dirlist[i]); + + bin.filename = path; + bin.exports = exports; + bin.nexports = NEXPORTS; + + ret = load_module(&bin); + if (ret < 0) + { + err("ERROR: Failed to load program '%s'\n", dirlist[i]); + exit(1); + } + + ret = exec_module(&bin, 50); + if (ret < 0) + { + err("ERROR: Failed to execute program '%s'\n", dirlist[i]); + unload_module(&bin); + } + + message("Wait a bit for test completion\n"); + sleep(4); + } + + message("End-of-Test.. Exit-ing\n"); + return 0; +} diff --git a/apps/examples/nxflat/tests/Makefile b/apps/examples/nxflat/tests/Makefile new file mode 100644 index 0000000000..b5ecc041a6 --- /dev/null +++ b/apps/examples/nxflat/tests/Makefile @@ -0,0 +1,103 @@ +############################################################################ +# apps/examples/nxflat/tests/Makefile +# +# Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# Most of these do no build yet +#SUBDIRS = errno hello hello++ longjmp mutex pthread signal task struct +SUBDIRS = errno hello mutex pthread task struct + +NXFLAT_DIR = $(APPDIR)/examples/nxflat +TESTS_DIR = $(NXFLAT_DIR)/tests +ROMFS_DIR = $(TESTS_DIR)/romfs +ROMFS_IMG = $(TESTS_DIR)/romfs.img +ROMFS_HDR = $(TESTS_DIR)/romfs.h +ROMFS_DIRLIST = $(TESTS_DIR)/dirlist.h +SYMTAB = $(TESTS_DIR)/symtab.h + +define DIR_template +$(1)_$(2): + @$(MAKE) -C $(1) $(3) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" CROSSDEV=$(CROSSDEV) +endef + +all: $(ROMFS_HDR) $(ROMFS_DIRLIST) $(SYMTAB) +.PHONY: all build clean install populate + +$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),build, all))) +$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),clean,clean))) +$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),install,install))) + +# Build program(s) in each sud-directory + +build: $(foreach DIR, $(SUBDIRS), $(DIR)_build) + +# Install each program in the romfs directory + +install: $(foreach DIR, $(SUBDIRS), $(DIR)_install) + +# Create the romfs directory + +$(ROMFS_DIR): + @mkdir $(ROMFS_DIR) + +# Populate the romfs directory + +populate: $(ROMFS_DIR) build install + +# Create the romfs.img file from the populated romfs directory + +$(ROMFS_IMG): populate + @genromfs -f $@ -d $(ROMFS_DIR) -V "NXFLATTEST" + +# Create the romfs.h header file from the romfs.img file + +$(ROMFS_HDR) : $(ROMFS_IMG) + @(cd $(TESTS_DIR); xxd -i romfs.img | sed -e "s/^unsigned/static const unsigned/g" >$@) + +# Create the dirlist.h header file from the romfs directory + +$(ROMFS_DIRLIST) : populate + @$(TESTS_DIR)/mkdirlist.sh $(ROMFS_DIR) >$@ + +# Create the exported symbol table list from the derived *-thunk.S files + +$(SYMTAB): build + @$(TESTS_DIR)/mksymtab.sh $(TESTS_DIR) >$@ + +# Clean each subdirectory + +clean: $(foreach DIR, $(SUBDIRS), $(DIR)_clean) + @rm -f $(ROMFS_HDR) $(ROMFS_IMG) $(SYMTAB) + @rm -rf $(ROMFS_DIR) + + diff --git a/apps/examples/nxflat/tests/errno/Makefile b/apps/examples/nxflat/tests/errno/Makefile new file mode 100644 index 0000000000..158768b852 --- /dev/null +++ b/apps/examples/nxflat/tests/errno/Makefile @@ -0,0 +1,78 @@ +############################################################################ +# examples/nxflat/tests/hello/Makefile +# +# Copyright (C) 2009 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config # Current configuration +-include $(TOPDIR)/Make.defs # Basic make info + +BIN = errno + +R1SRCS = $(BIN).c +R1OBJS = $(R1SRCS:.c=.o) + +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) + +all: $(BIN) + +$(R1OBJS): %.o: %.c + @echo "CC: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(R2OBJ): %.o: %.S + @echo "AS: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(BIN).r1: $(R1OBJS) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS1) -o $@ $^ + +$(R2SRC): $(BIN).r1 + @echo "MK: $<" + @$(MKNXFLAT) -o $@ $^ + +$(BIN).r2: $(R2OBJ) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) + +$(BIN): $(BIN).r2 + @echo "LD: $<" + @$(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ + +clean: + @rm -f $(BIN) $(R2SRC) *.o *.r1 *.r2 *~ .*.swp core + +install: + @install -D $(BIN) $(ROMFS_DIR)/$(BIN) + diff --git a/apps/examples/nxflat/tests/errno/errno.c b/apps/examples/nxflat/tests/errno/errno.c new file mode 100644 index 0000000000..b066791650 --- /dev/null +++ b/apps/examples/nxflat/tests/errno/errno.c @@ -0,0 +1,83 @@ +/**************************************************************************** + * examples/nxflat/tests/errno/errno.c + * + * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +static const char g_nonexistent[] = "aflav-sautga-ay"; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int main(int argc, char **argv) +{ + FILE *test_stream; + + /* Try using stdout and stderr explicitly. These are global variables + * exported from the base code. + */ + + fprintf(stdout, "Hello, World on stdout\n"); + fprintf(stderr, "Hello, World on stderr\n"); + + /* Try opening a non-existent file using buffered IO. */ + + test_stream = fopen(g_nonexistent, "r"); + if (test_stream) + { + fprintf(stderr, "Hmm... Delete \"%s\" and try this again\n", + g_nonexistent); + exit(1); + } + + /* Now print the errno on stderr. Errno is also a global + * variable exported by the base code. + */ + + fprintf(stderr, "We failed to open \"%s!\" errno is %d\n", + g_nonexistent, errno); + + return 0; +} diff --git a/apps/examples/nxflat/tests/hello++/Makefile b/apps/examples/nxflat/tests/hello++/Makefile new file mode 100644 index 0000000000..113520da5d --- /dev/null +++ b/apps/examples/nxflat/tests/hello++/Makefile @@ -0,0 +1,180 @@ +############################################################################ +# examples/nxflat/tests/hello/Makefile +# +# Copyright (C) 2009 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config # Current configuration +-include $(TOPDIR)/Make.defs # Basic make info + +BIN1 = hello++1 +BIN2 = hello++2 +BIN3 = hello++3 +#BIN4 = hello++4 +ALL_BIN = $(BIN1) $(BIN2) $(BIN3) $(BIN4) + +R1SRCS1 = $(BIN1).c +R1OBJS1 = $(R1SRCS1:.c=.o) +R2SRC1 = $(BIN1)-thunk.S +R2OBJ1 = $(R2SRC1:.S=.o) + +R1SRCS2 = $(BIN2).c +R1OBJS2 = $(R1SRCS2:.c=.o) +R2SRC2 = $(BIN2)-thunk.S +R2OBJ2 = $(R2SRC2:.S=.o) + +R1SRCS3 = $(BIN3).c +R1OBJS3 = $(R1SRCS3:.c=.o) +R2SRC3 = $(BIN3)-thunk.S +R2OBJ3 = $(R2SRC3:.S=.o) + +#R1SRCS4 = $(BIN4).c +#R1OBJS4 = $(R1SRCS4:.c=.o) +#R2SRC4 = $(BIN4)-thunk.S +#R2OBJ4 = $(R2SRC4:.S=.o) + +DERIVED = $(R2SRC1) $(R2SRC2) $(R2SRC3) $(R2SRC4) + +R1CXXOBJS = $(R1OBJS1) $(R1OBJS2) $(R1OBJS3) # $(R1OBJS4) +R2AOBJS = $(R2OBJ1) $(R2OBJ2) $(R2OBJ3) # $(R2OBJ4) + +LIBSTDC_STUBS_DIR = $(TOPDIR)/libxx +LIBSTDC_STUBS_LIB = $(LIBSTDC_STUBS_DIR)/liblibxx.a + +all: $(BIN1) $(BIN2) $(BIN3) # $(BIN4) + +$(R1CXXOBJS): %.o: %.cpp + @echo "CC: $<" + @$(CXX) -c $(CXXPICFLAGS) $< -o $@ + +$(R2AOBJS): %.o: %.S + @echo "AS: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +# This contains libstdc++ stubs to that you can build C++ code +# without actually having libstdc++ + +$(LIBSTDC_STUBS_LIB): + @$(MAKE) -C $(LIBSTDC_STUBS_DIR) TOPDIR=$(TOPDIR) + +# BIN1 and BIN2 link just like C code because they contain no +# static constructors. BIN1 is equivalent to a C hello world; +# BIN2 contains a class that implements hello world, but it is +# not statically initialized. + +$(BIN1).r1: $(R1OBJS1) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS1) -o $@ $^ + +$(R2SRC1): $(BIN1).r1 + @echo "MK: $<" + @$(MKNXFLAT) -o $@ $^ + +$(BIN1).r2: $(R2OBJ1) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS1) $(R2OBJ1) + +$(BIN1): $(BIN1).r2 + @echo "LD: $<" + @$(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ + +$(BIN2).r1: $(R1OBJS2) $(LIBSTDC_STUBS_LIB) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS1) -o $@ $^ + +$(R2SRC2): $(BIN2).r1 + @echo "MK: $<" + @$(MKNXFLAT) -o $@ $^ + +$(BIN2).r2: $(R2OBJ2) + @$(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS2) $(R2OBJ2) + +$(BIN2): $(BIN2).r2 + @echo "LD: $<" + @$(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ + +# BIN3 and BIN4 require that we include --cxx in the xflat-ld command. +# This will instruct xflat-ld that we want it to put together the correct +# startup files to handle the C++ static initializers. +# +# BIN3 is equivalent to BIN2 except that is uses static initializers + +$(BIN3).r1: $(R1OBJS3) $(LIBSTDC_STUBS_LIB) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS1) -o $@ $^ + +$(R2SRC3): $(BIN3).r1 + @echo "MK: $<" + @$(MKNXFLAT) -o $@ $^ + +$(BIN3).r2: $(R2OBJ3) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS3) $(R2OBJ3) + +$(BIN3): $(BIN3).r2 + @echo "LD: $<" + @$(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ + +# BIN4 is similar to BIN3 except that it uses the streams code from libstdc++ +# +# NOTE: libstdc++ is not available for XFLAT as of this writing +# +#$(BIN4).r1: $(R1OBJS4) $(LIBSTDC_STUBS_LIB) +# @echo "LD: $<" +# $(LD) $(NXFLATLDFLAGS1) -o $@ $^ +# +#$(R2SRC4): $(BIN4).r1 +# @echo "MK: $<" +# $(MKNXFLAT) -o $@ $^ +# +#$(BIN4).r2: $(R2OBJ4)# @echo "LD: $<" +# $(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS4) $(R2OBJ4) +# +#$(BIN4): $(BIN4).r2 +# @echo "LD: $<" +# $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ + +clean: + @rm -f $(ALL_BIN) $(DERIVED) *.o *.r1 *.r2 *~ .*.swp core + +install: $(ALL_BIN) + @install -D $(BIN1) $(ROMFS_DIR)/$(BIN1) + @install -D $(BIN2) $(ROMFS_DIR)/$(BIN2) + @install -D $(BIN3) $(ROMFS_DIR)/$(BIN3) +# @install -D $(BIN4) $(ROMFS_DIR)/$(BIN4) + + + + + + + diff --git a/apps/examples/nxflat/tests/hello++/hello++1.cpp b/apps/examples/nxflat/tests/hello++/hello++1.cpp new file mode 100644 index 0000000000..779f3307a7 --- /dev/null +++ b/apps/examples/nxflat/tests/hello++/hello++1.cpp @@ -0,0 +1,60 @@ +///////////////////////////////////////////////////////////////////////////// +// examples/nxflat/tests/hello++/hello++1.c +// +// Copyright (C) 2009 Gregory Nutt. All rights reserved. +// Author: Gregory Nutt +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in +// the documentation and/or other materials provided with the +// distribution. +// 3. Neither the name NuttX nor the names of its contributors may be +// used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// +///////////////////////////////////////////////////////////////////////////// +// +// This is an trivial version of "Hello, World" program. It illustrates +// that we can build C programs using the C++ compiler. +// +// - Building a C++ program to use the C library +// - No class creation +// - NO Streams +// - NO Static constructor and destructors +// +///////////////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////////////////// +// Included Files +///////////////////////////////////////////////////////////////////////////// + +#include + +///////////////////////////////////////////////////////////////////////////// +// Public Functions +///////////////////////////////////////////////////////////////////////////// + +int main(int argc, char **argv) +{ + printf("Hello, World!\n"); + return 0; +} diff --git a/apps/examples/nxflat/tests/hello++/hello++2.cpp b/apps/examples/nxflat/tests/hello++/hello++2.cpp new file mode 100644 index 0000000000..87166f3ab2 --- /dev/null +++ b/apps/examples/nxflat/tests/hello++/hello++2.cpp @@ -0,0 +1,123 @@ +///////////////////////////////////////////////////////////////////////////// +// examples/nxflat/tests/hello++/hello++2.c +// +// Copyright (C) 2009 Gregory Nutt. All rights reserved. +// Author: Gregory Nutt +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in +// the documentation and/or other materials provided with the +// distribution. +// 3. Neither the name NuttX nor the names of its contributors may be +// used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// +///////////////////////////////////////////////////////////////////////////// +// +// This is an another trivial version of "Hello, World" design. It illustrates +// +// - Building a C++ program to use the C library +// - Basic class creation +// - NO Streams +// - NO Static constructor and destructors +// +///////////////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////////////////// +// Included Files +///////////////////////////////////////////////////////////////////////////// + +#include + +///////////////////////////////////////////////////////////////////////////// +// Classes +///////////////////////////////////////////////////////////////////////////// + +class CThingSayer +{ + const char *szWhatToSay; +public: + CThingSayer(void) + { + printf("CThingSayer::CThingSayer: I am!\n"); + szWhatToSay = (const char*)NULL; + } + + ~CThingSayer(void) + { + printf("CThingSayer::~CThingSayer: I cease to be\n"); + if (szWhatToSay) + { + printf("CThingSayer::~CThingSayer: I will never say '%s' again\n", + szWhatToSay); + } + szWhatToSay = (const char*)NULL; + } + + void Initialize(const char *czSayThis) + { + printf("CThingSayer::Initialize: When told, I will say '%s'\n", + czSayThis); + szWhatToSay = czSayThis; + } + + void SayThing(void) + { + printf("CThingSayer::SayThing: I am now saying '%s'\n", szWhatToSay); + } +}; + +///////////////////////////////////////////////////////////////////////////// +// Public Functions +///////////////////////////////////////////////////////////////////////////// + +int main(int argc, char **argv) +{ + CThingSayer *MyThingSayer; + + printf("main: Started. Creating MyThingSayer\n"); + + // Create an instance of the CThingSayer class + // We should see the message from constructor, CThingSayer::CThingSayer(), + + MyThingSayer = new CThingSayer; + printf("main: Created MyThingSayer=0x%08lx\n", (long)MyThingSayer); + + // Tell MyThingSayer that "Hello, World!" is the string to be said + + printf("main: Calling MyThingSayer->Initialize\n");; + MyThingSayer->Initialize("Hello, World!"); + + // Tell MyThingSayer to say the thing we told it to say + + printf("main: Calling MyThingSayer->SayThing\n");; + MyThingSayer->SayThing(); + + // We should see the message from the destructor, + // CThingSayer::~CThingSayer(), AFTER we see the following + + printf("main: Destroying MyThingSayer\n"); + delete MyThingSayer; + + printf("main: Returning\n");; + return 0; +} diff --git a/apps/examples/nxflat/tests/hello++/hello++3.cpp b/apps/examples/nxflat/tests/hello++/hello++3.cpp new file mode 100644 index 0000000000..ed7302fa65 --- /dev/null +++ b/apps/examples/nxflat/tests/hello++/hello++3.cpp @@ -0,0 +1,132 @@ +///////////////////////////////////////////////////////////////////////////// +// examples/nxflat/tests/hello++/hello++3.c +// +// Copyright (C) 2009 Gregory Nutt. All rights reserved. +// Author: Gregory Nutt +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in +// the documentation and/or other materials provided with the +// distribution. +// 3. Neither the name NuttX nor the names of its contributors may be +// used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// +///////////////////////////////////////////////////////////////////////////// +// +// This is an another trivial version of "Hello, World" design. It illustrates +// +// - Building a C++ program to use the C library and stdio +// - Basic class creation with virtual methods. +// - Static constructor and destructors (in main program only) +// - NO Streams +// +///////////////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////////////////// +// Included Files +///////////////////////////////////////////////////////////////////////////// + +#include + +///////////////////////////////////////////////////////////////////////////// +// Classes +///////////////////////////////////////////////////////////////////////////// + +class CThingSayer +{ + const char *szWhatToSay; +public: + CThingSayer(void); + virtual ~CThingSayer(void); + virtual void Initialize(const char *czSayThis); + virtual void SayThing(void); +}; + +// A static instance of the CThingSayer class. This instance MUST +// be constructed by the system BEFORE the program is started at +// main() and must be destructed by the system AFTER the main() +// returns to the system + +static CThingSayer MyThingSayer; + +// These are implementations of the methods of the CThingSayer class + +CThingSayer::CThingSayer(void) +{ + printf("CThingSayer::CThingSayer: I am!\n"); + szWhatToSay = (const char*)NULL; +} + +CThingSayer::~CThingSayer(void) +{ + printf("CThingSayer::~CThingSayer: I cease to be\n"); + if (szWhatToSay) + { + printf("CThingSayer::~CThingSayer: I will never say '%s' again\n", + szWhatToSay); + } + szWhatToSay = (const char*)NULL; +} + +void CThingSayer::Initialize(const char *czSayThis) +{ + printf("CThingSayer::Initialize: When told, I will say '%s'\n", + czSayThis); + szWhatToSay = czSayThis; +} + +void CThingSayer::SayThing(void) +{ + printf("CThingSayer::SayThing: I am now saying '%s'\n", szWhatToSay); +} + +///////////////////////////////////////////////////////////////////////////// +// Public Functions +///////////////////////////////////////////////////////////////////////////// + +int main(int argc, char **argv) +{ + // We should see the message from constructor, CThingSayer::CThingSayer(), + // BEFORE we see the following messages. That is proof that the + // C++ static initializer is working + + printf("main: Started. MyThingSayer should already exist\n"); + + // Tell MyThingSayer that "Hello, World!" is the string to be said + + printf("main: Calling MyThingSayer.Initialize\n");; + MyThingSayer.Initialize("Hello, World!"); + + // Tell MyThingSayer to say the thing we told it to say + + printf("main: Calling MyThingSayer.SayThing\n");; + MyThingSayer.SayThing(); + + // We are finished, return. We should see the message from the + // destructor, CThingSayer::~CThingSayer(), AFTER we see the following + // message. That is proof that the C++ static destructor logic + // is working + + printf("main: Returning. MyThingSayer should be destroyed\n");; + return 0; +} diff --git a/apps/examples/nxflat/tests/hello++/hello++4.cpp b/apps/examples/nxflat/tests/hello++/hello++4.cpp new file mode 100644 index 0000000000..97d0260937 --- /dev/null +++ b/apps/examples/nxflat/tests/hello++/hello++4.cpp @@ -0,0 +1,150 @@ +///////////////////////////////////////////////////////////////////////////// +// examples/nxflat/tests/hello++/hello++4.c +// +// Copyright (C) 2009 Gregory Nutt. All rights reserved. +// Author: Gregory Nutt +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in +// the documentation and/or other materials provided with the +// distribution. +// 3. Neither the name NuttX nor the names of its contributors may be +// used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// +///////////////////////////////////////////////////////////////////////////// +// +// This is an excessively complex version of "Hello, World" design to +// illustrate some basic properties of C++: +// +// - Building a C++ program +// - Streams / statically linked libstdc++ +// - Static constructor and destructors (in main program only) +// +///////////////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////////////////// +// Included Files +///////////////////////////////////////////////////////////////////////////// + +#include +#include + +#ifndef NULL +# define NULL ((void*)0L) +#endif + +///////////////////////////////////////////////////////////////////////////// +// Classes +///////////////////////////////////////////////////////////////////////////// + +using namespace std; + +// A hello world sayer class + +class CThingSayer +{ + const char *szWhatToSay; +public: + CThingSayer(void); + virtual ~CThingSayer(void); + virtual void Initialize(const char *czSayThis); + virtual void SayThing(void); +}; + +///////////////////////////////////////////////////////////////////////////// +// Private Data +///////////////////////////////////////////////////////////////////////////// + +// A static instance of the CThingSayer class. This instance MUST +// be constructed by the system BEFORE the program is started at +// main() and must be destructed by the system AFTER the main() +// returns to the system + +static CThingSayer MyThingSayer; + +///////////////////////////////////////////////////////////////////////////// +// Method Implementations +///////////////////////////////////////////////////////////////////////////// + +// These are implementations of the methods of the CThingSayer class + +CThingSayer::CThingSayer(void) +{ + cout << "CThingSayer::CThingSayer: I am!" << endl; + szWhatToSay = (const char*)NULL; +} + +CThingSayer::~CThingSayer(void) +{ + cout << "CThingSayer::~CThingSayer: I cease to be" << endl; + if (szWhatToSay) + { + cout << "CThingSayer::~CThingSayer: I will never say '" + << szWhatToSay << "' again" << endl; + } + szWhatToSay = (const char*)NULL; +} + +void CThingSayer::Initialize(const char *czSayThis) +{ + cout << "CThingSayer::Initialize: When told, I will say '" + << czSayThis << "'" << endl; + szWhatToSay = czSayThis; +} + +void CThingSayer::SayThing(void) +{ + cout << "CThingSayer::SayThing: I am now saying '" + << szWhatToSay << "'" << endl; +} + +///////////////////////////////////////////////////////////////////////////// +// Public Functions +///////////////////////////////////////////////////////////////////////////// + +int main(int argc, char **argv) +{ + // We should see the message from constructor, CThingSayer::CThingSayer(), + // BEFORE we see the following messages. That is proof that the + // C++ static initializer is working + + cout << "main: Started" << endl; + + // Tell MyThingSayer that "Hello, World!" is the string to be said + + cout << "main: Calling MyThingSayer.Initialize" << endl; + MyThingSayer.Initialize("Hello, World!"); + + // Tell MyThingSayer to say the thing we told it to say + + cout << "main: Calling MyThingSayer.SayThing" << endl; + MyThingSayer.SayThing(); + + // We are finished, return. We should see the message from the + // destructor, CThingSayer::~CThingSayer(), AFTER we see the following + // message. That is proof that the C++ static destructor logic + // is working + + cout << "main: Returning" << endl; + return 0; +} diff --git a/apps/examples/nxflat/tests/hello/Makefile b/apps/examples/nxflat/tests/hello/Makefile new file mode 100644 index 0000000000..ccde7a98f2 --- /dev/null +++ b/apps/examples/nxflat/tests/hello/Makefile @@ -0,0 +1,78 @@ +############################################################################ +# examples/nxflat/tests/hello/Makefile +# +# Copyright (C) 2009 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config # Current configuration +-include $(TOPDIR)/Make.defs # Basic make info + +BIN = hello + +R1SRCS = $(BIN).c +R1OBJS = $(R1SRCS:.c=.o) + +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) + +all: $(BIN) + +$(R1OBJS): %.o: %.c + @echo "CC: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(R2OBJ): %.o: %.S + @echo "AS: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(BIN).r1: $(R1OBJS) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS1) -o $@ $^ + +$(R2SRC): $(BIN).r1 + @echo "MK: $<" + @$(MKNXFLAT) -o $@ $^ + +$(BIN).r2: $(R2OBJ) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) + +$(BIN): $(BIN).r2 + @echo "LD: $<" + @$(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ + +clean: + @rm -f $(BIN) $(R2SRC) *.o *.r1 *.r2 *~ .*.swp core + +install: + @install -D $(BIN) $(ROMFS_DIR)/$(BIN) + diff --git a/apps/examples/nxflat/tests/hello/hello.c b/apps/examples/nxflat/tests/hello/hello.c new file mode 100644 index 0000000000..028bdfe007 --- /dev/null +++ b/apps/examples/nxflat/tests/hello/hello.c @@ -0,0 +1,78 @@ +/**************************************************************************** + * examples/nxflat/tests/hello/hello.c + * + * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int main(int argc, char **argv) +{ + int i; + + /* Mandatory "Hello, world!" */ + + puts("Getting ready to say \"Hello, world\"\n"); + printf("Hello, world!\n"); + puts("It has been said.\n"); + + /* Print arguments */ + + printf("argc\t= %d\n", argc); + printf("argv\t= 0x%p\n", argv); + + for (i = 0; i < argc; i++) + { + printf("argv[%d]\t= ", i); + if (argv[i]) + { + printf("(0x%p) \"%s\"\n", argv[i], argv[i]); + } + else + { + printf("NULL?\n"); + } + } + + printf("argv[%d]\t= 0x%p\n", argc, argv[argc]); + printf("Goodbye, world!\n"); + return 0; +} diff --git a/apps/examples/nxflat/tests/longjmp/Makefile b/apps/examples/nxflat/tests/longjmp/Makefile new file mode 100644 index 0000000000..d0c93ebbda --- /dev/null +++ b/apps/examples/nxflat/tests/longjmp/Makefile @@ -0,0 +1,78 @@ +############################################################################ +# examples/nxflat/tests/longjmp/Makefile +# +# Copyright (C) 2009 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config # Current configuration +-include $(TOPDIR)/Make.defs # Basic make info + +BIN = longjmp + +R1SRCS = $(BIN).c +R1OBJS = $(R1SRCS:.c=.o) + +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) + +all: $(BIN) + +$(R1OBJS): %.o: %.c + @echo "CC: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(R2OBJ): %.o: %.S + @echo "AS: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(BIN).r1: $(R1OBJS) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS1) -o $@ $^ + +$(R2SRC): $(BIN).r1 + @echo "MK: $<" + @$(MKNXFLAT) -o $@ $^ + +$(BIN).r2: $(R2OBJ) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) + +$(BIN): $(BIN).r2 + @echo "LD: $<" + @$(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ + +clean: + @rm -f $(BIN) $(R2SRC) *.o *.r1 *.r2 *~ .*.swp core + +install: + @install -D $(BIN) $(ROMFS_DIR)/$(BIN) + diff --git a/apps/examples/nxflat/tests/longjmp/longjmp.c b/apps/examples/nxflat/tests/longjmp/longjmp.c new file mode 100644 index 0000000000..b5b317d996 --- /dev/null +++ b/apps/examples/nxflat/tests/longjmp/longjmp.c @@ -0,0 +1,128 @@ +/**************************************************************************** + * examples/nxflat/tests/longjmp/longjmp.c + * + * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define MAIN_VAL 47 +#define FUNC_VAL 92 +#define LEAF_VAL 163 + +#define FUNCTION_ARG MAIN_VAL +#define LEAF_ARG (FUNCTION_ARG + FUNC_VAL) +#define SETJMP_RETURN (LEAF_ARG + LEAF_VAL) + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static jmp_buf env; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static int leaf(int *some_arg) +{ + int some_local_variable = *some_arg + LEAF_VAL; + + printf("leaf: received %d\n", *some_arg); + + if (*some_arg != LEAF_ARG) + printf("leaf: ERROR: expected %d\n", LEAF_ARG); + + printf("leaf: Calling longjmp() with %d\n", some_local_variable); + + longjmp(env, some_local_variable); +} + +static int function(int some_arg) +{ + int some_local_variable = some_arg + FUNC_VAL; + int retval; + + printf("function: received %d\n", some_arg); + + if (some_arg != FUNCTION_ARG) + printf("function: ERROR: expected %d\n", FUNCTION_ARG); + + printf("function: Calling leaf() with %d\n", some_local_variable); + + retval = leaf(&some_local_variable); + + printf("function: ERROR -- leaf returned!\n"); + return retval; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int main(int argc, char **argv) +{ + int value; + + printf("main: Calling setjmp\n"); + value = setjmp(env); + printf("main: setjmp returned %d\n", value); + + if (value == 0) + { + printf("main: Normal setjmp return\n"); + printf("main: Calling function with %d\n", MAIN_VAL); + function(MAIN_VAL); + printf("main: ERROR -- function returned!\n"); + return 1; + } + else if (value != SETJMP_RETURN) + { + printf("main: ERROR: Expected %d\n", SETJMP_RETURN); + return 1; + } + else + { + printf("main: SUCCESS: setjmp return from longjmp call\n"); + return 0; + } +} + diff --git a/apps/examples/nxflat/tests/mkdirlist.sh b/apps/examples/nxflat/tests/mkdirlist.sh new file mode 100755 index 0000000000..cc55ac0b56 --- /dev/null +++ b/apps/examples/nxflat/tests/mkdirlist.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +usage="Usage: %0 " + +dir=$1 +if [ -z "$dir" ]; then + echo "ERROR: Missing " + echo "" + echo $usage + exit 1 +fi + +if [ ! -d "$dir" ]; then + echo "ERROR: Directory $dir does not exist" + echo "" + echo $usage + exit 1 +fi + +echo "#ifndef __EXAMPLES_NXFLAT_TESTS_DIRLIST_H" +echo "#define __EXAMPLES_NXFLAT_TESTS_DIRLIST_H" +echo "" +echo "static const char *dirlist[] =" +echo "{" + +for file in `ls $dir`; do + echo " \"$file\"," +done + +echo " NULL" +echo "};" +echo "" +echo "#endif /* __EXAMPLES_NXFLAT_TESTS_DIRLIST_H */" + + diff --git a/apps/examples/nxflat/tests/mksymtab.sh b/apps/examples/nxflat/tests/mksymtab.sh new file mode 100755 index 0000000000..611d3a87a0 --- /dev/null +++ b/apps/examples/nxflat/tests/mksymtab.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +usage="Usage: %0 " + +dir=$1 +if [ -z "$dir" ]; then + echo "ERROR: Missing " + echo "" + echo $usage + exit 1 +fi + +if [ ! -d "$dir" ]; then + echo "ERROR: Directory $dir does not exist" + echo "" + echo $usage + exit 1 +fi + +varlist=`find $dir -name "*-thunk.S"| xargs grep -h asciz | cut -f3 | sort | uniq` + +echo "#ifndef __EXAMPLES_NXFLAT_TESTS_SYMTAB_H" +echo "#define __EXAMPLES_NXFLAT_TESTS_SYMTAB_H" +echo "" +echo "#include " +echo "" +echo "static const struct symtab_s exports[] = " +echo "{" + +for string in $varlist; do + var=`echo $string | sed -e "s/\"//g"` + echo " {$string, $var}," +done + +echo "};" +echo "#define NEXPORTS (sizeof(exports)/sizeof(struct symtab_s))" +echo "" +echo "#endif /* __EXAMPLES_NXFLAT_TESTS_SYMTAB_H */" + diff --git a/apps/examples/nxflat/tests/mutex/Makefile b/apps/examples/nxflat/tests/mutex/Makefile new file mode 100644 index 0000000000..8c9fbb4a31 --- /dev/null +++ b/apps/examples/nxflat/tests/mutex/Makefile @@ -0,0 +1,78 @@ +############################################################################ +# examples/nxflat/tests/mutex/Makefile +# +# Copyright (C) 2009 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config # Current configuration +-include $(TOPDIR)/Make.defs # Basic make info + +BIN = mutex + +R1SRCS = $(BIN).c +R1OBJS = $(R1SRCS:.c=.o) + +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) + +all: $(BIN) + +$(R1OBJS): %.o: %.c + @echo "CC: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(R2OBJ): %.o: %.S + @echo "AS: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(BIN).r1: $(R1OBJS) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS1) -o $@ $^ + +$(R2SRC): $(BIN).r1 + @echo "MK: $<" + @$(MKNXFLAT) -o $@ $^ + +$(BIN).r2: $(R2OBJ) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) + +$(BIN): $(BIN).r2 + @echo "LD: $<" + @$(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ + +clean: + @rm -f $(BIN) $(R2SRC) *.o *.r1 *.r2 *~ .*.swp core + +install: + @install -D $(BIN) $(ROMFS_DIR)/$(BIN) + diff --git a/apps/examples/nxflat/tests/mutex/mutex.c b/apps/examples/nxflat/tests/mutex/mutex.c new file mode 100644 index 0000000000..78a63306db --- /dev/null +++ b/apps/examples/nxflat/tests/mutex/mutex.c @@ -0,0 +1,149 @@ +/**************************************************************************** + * examples/nxflat/tests/mutex/mutex.c + * + * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include +#include + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static pthread_mutex_t mut; +static volatile int my_mutex = 0; +static unsigned long nloops[2] = {0, 0}; +static unsigned long nerrors[2] = {0, 0}; +static volatile bool bendoftest; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/* NOTE: it is necessary for functions that are referred to by function pointers + * pointer to be declared with global scope (at least for ARM). Otherwise, + * a relocation type that is not supported by NXFLAT is generated by GCC. + */ + +void thread_func(void *parameter) +{ + int my_id = (int)parameter; + int my_ndx = my_id - 1; + int i; + + /* Loop 20 times. There is a 100 MS delay in the loop so this should + * take about 2 seconds. The main thread will stop this thread after + * 2 seconds by setting bendoftest in any event. + */ + + for (i = 0; i < 20 && !bendoftest; i++); + { + if ((pthread_mutex_lock(&mut)) != 0) + { + printf("ERROR thread %d: pthread_mutex_lock failed\n", my_id); + } + + if (my_mutex == 1) + { + printf("ERROR thread=%d: " + "my_mutex should be zero, instead my_mutex=%d\n", + my_id, my_mutex); + nerrors[my_ndx]++; + } + + my_mutex = 1; + usleep(100000); + my_mutex = 0; + + if ((pthread_mutex_unlock(&mut)) != 0) + { + printf("ERROR thread %d: pthread_mutex_unlock failed\n", my_id); + } + + nloops[my_ndx]++; + } +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int main(int argc, char **argv) +{ + pthread_t thread1; + pthread_t thread2; + + /* Initialize the mutex */ + + pthread_mutex_init(&mut, NULL); + + /* Start two thread instances */ + + printf("Starting thread 1\n"); + bendoftest = false; + if ((pthread_create(&thread1, NULL, (void*)thread_func, (void*)1)) != 0) + { + fprintf(stderr, "Error in thread#1 creation\n"); + } + + printf("Starting thread 2\n"); + if ((pthread_create(&thread2, NULL, (void*)thread_func, (void*)2)) != 0) + { + fprintf(stderr, "Error in thread#2 creation\n"); + } + + /* Wait a bit for the threads to do their thing. */ + + sleep(2); + + /* Then ask them politely to stop running */ + + printf("Stopping threads\n"); + bendoftest = true; + pthread_join(thread1, NULL); + pthread_join(thread2, NULL); + + printf("\tThread1\tThread2\n"); + printf("Loops\t%ld\t%ld\n", nloops[0], nloops[1]); + printf("Errors\t%ld\t%ld\n", nerrors[0], nerrors[1]); + + return 0; +} + diff --git a/apps/examples/nxflat/tests/pthread/Makefile b/apps/examples/nxflat/tests/pthread/Makefile new file mode 100644 index 0000000000..27da42e7cd --- /dev/null +++ b/apps/examples/nxflat/tests/pthread/Makefile @@ -0,0 +1,78 @@ +############################################################################ +# examples/nxflat/tests/pthread/Makefile +# +# Copyright (C) 2009 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config # Current configuration +-include $(TOPDIR)/Make.defs # Basic make info + +BIN = pthread + +R1SRCS = $(BIN).c +R1OBJS = $(R1SRCS:.c=.o) + +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) + +all: $(BIN) + +$(R1OBJS): %.o: %.c + @echo "CC: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(R2OBJ): %.o: %.S + @echo "AS: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(BIN).r1: $(R1OBJS) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS1) -o $@ $^ + +$(R2SRC): $(BIN).r1 + @echo "MK: $<" + @$(MKNXFLAT) -o $@ $^ + +$(BIN).r2: $(R2OBJ) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) + +$(BIN): $(BIN).r2 + @echo "LD: $<" + @$(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ + +clean: + @rm -f $(BIN) $(R2SRC) *.o *.r1 *.r2 *~ .*.swp core + +install: + @install -D $(BIN) $(ROMFS_DIR)/$(BIN) + diff --git a/apps/examples/nxflat/tests/pthread/pthread.c b/apps/examples/nxflat/tests/pthread/pthread.c new file mode 100644 index 0000000000..019ec453e1 --- /dev/null +++ b/apps/examples/nxflat/tests/pthread/pthread.c @@ -0,0 +1,143 @@ +/**************************************************************************** + * examples/nxflat/tests/pthread/pthread.c + * + * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define CHILD_ARG ((void*)0x12345678) +#define CHILD_RET ((void*)0x87654321) + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +enum exit_values_e +{ + TESTRESULT_SUCCESS = 0, + TESTRESULT_PTHREAD_ATTR_INIT_FAIL, + TESTRESULT_PTHREAD_CREATE_FAIL, + TESTRESULT_PTHREAD_JOIN_FAIL, + TESTRESULT_CHILD_ARG_FAIL, + TESTRESULT_CHILD_RETVAL_FAIL, +}; + +/**************************************************************************** + * External Functions + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/* NOTE: it is necessary for functions that are referred to by function pointers + * pointer to be declared with global scope (at least for ARM). Otherwise, + * a relocation type that is not supported by NXFLAT is generated by GCC. + */ + +void *child_start_routine(void *arg) +{ + printf("CHILD: started with arg=%d\n", (int)arg); + + if (arg != CHILD_ARG) + { + printf("CHILD: expected arg=%d\n", (int)CHILD_ARG); + return (void*)TESTRESULT_CHILD_ARG_FAIL; + } + sleep(2); + + printf("CHILD: returning %d\n", (int)CHILD_RET); + pthread_exit(CHILD_RET); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int main(int argc, char **argv) +{ + pthread_attr_t attr; + pthread_t thread; + void *retval; + int status; + + puts("PARENT: started\n"); + + status = pthread_attr_init(&attr); + if (status != 0) + { + printf("PARENT: pthread_attr_init() returned %d\n", status); + exit(TESTRESULT_PTHREAD_ATTR_INIT_FAIL); + } + + printf("PARENT: calling pthread_start with arg=%d\n", (int)CHILD_ARG); + status = pthread_create(&thread, &attr, child_start_routine, CHILD_ARG); + if (status != 0) + { + printf("PARENT: pthread_create() returned %d\n", status); + exit(TESTRESULT_PTHREAD_CREATE_FAIL); + } + + status = pthread_join(thread, &retval); + if (status != 0) + { + printf("PARENT pthread_join() returned %d\n", status); + + exit(TESTRESULT_PTHREAD_JOIN_FAIL); + } + + printf("PARENT child exitted with %d\n", (int)retval); + if (retval != CHILD_RET) + { + printf("PARENT child thread did not exit with %d\n", (int)CHILD_RET); + exit(TESTRESULT_CHILD_RETVAL_FAIL); + } + + puts("PARENT returning success\n"); + return TESTRESULT_SUCCESS; +} diff --git a/apps/examples/nxflat/tests/signal/Makefile b/apps/examples/nxflat/tests/signal/Makefile new file mode 100644 index 0000000000..d967fbf09a --- /dev/null +++ b/apps/examples/nxflat/tests/signal/Makefile @@ -0,0 +1,78 @@ +############################################################################ +# examples/nxflat/tests/signal/Makefile +# +# Copyright (C) 2009 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config # Current configuration +-include $(TOPDIR)/Make.defs # Basic make info + +BIN = signal + +R1SRCS = $(BIN).c +R1OBJS = $(R1SRCS:.c=.o) + +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) + +all: $(BIN) + +$(R1OBJS): %.o: %.c + @echo "CC: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(R2OBJ): %.o: %.S + @echo "AS: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(BIN).r1: $(R1OBJS) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS1) -o $@ $^ + +$(R2SRC): $(BIN).r1 + @echo "MK: $<" + @$(MKNXFLAT) -o $@ $^ + +$(BIN).r2: $(R2OBJ) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) + +$(BIN): $(BIN).r2 + @echo "LD: $<" + @$(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ + +clean: + @rm -f $(BIN) $(R2SRC) *.o *.r1 *.r2 *~ .*.swp core + +install: + @install -D $(BIN) $(ROMFS_DIR)/$(BIN) + diff --git a/apps/examples/nxflat/tests/signal/signal.c b/apps/examples/nxflat/tests/signal/signal.c new file mode 100644 index 0000000000..ff1c58305e --- /dev/null +++ b/apps/examples/nxflat/tests/signal/signal.c @@ -0,0 +1,308 @@ +/**************************************************************************** + * examples/nxflat/tests/signal/signal.c + * + * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#define USEC_PER_MSEC 1000 +#define MSEC_PER_SEC 1000 +#define USEC_PER_SEC (USEC_PER_MSEC * MSEC_PER_SEC) +#define SHORT_DELAY (USEC_PER_SEC / 3) + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static int sigusr1_rcvd = 0; +static int sigusr2_rcvd = 0; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: sigusr1_sighandler + ****************************************************************************/ + +/* NOTE: it is necessary for functions that are referred to by function pointers + * pointer to be declared with global scope (at least for ARM). Otherwise, + * a relocation type that is not supported by NXFLAT is generated by GCC. + */ + +void sigusr1_sighandler(int signo) +{ + printf("sigusr1_sighandler: Received SIGUSR1, signo=%d\n", signo); + sigusr1_rcvd = 1; +} + +/**************************************************************************** + * Name: sigusr2_sigaction + ***************************************************************************/ + +/* NOTE: it is necessary for functions that are referred to by function pointers + * pointer to be declared with global scope (at least for ARM). Otherwise, + * a relocation type that is not supported by NXFLAT is generated by GCC. + */ + +#ifdef __USE_POSIX199309 +void sigusr2_sigaction(int signo, siginfo_t *siginfo, void *arg) +{ + printf("sigusr2_sigaction: Received SIGUSR2, signo=%d siginfo=%p arg=%p\n", + signo, siginfo, arg); + +#ifdef HAVE_SIGQUEUE + if (siginfo) + { + printf(" si_signo = %d\n", siginfo->si_signo); + printf(" si_errno = %d\n", siginfo->si_errno); + printf(" si_code = %d\n", siginfo->si_code); + printf(" si_pid = %d\n", siginfo->si_pid); + printf(" si_uid = %d\n", siginfo->si_uid); + printf(" si_status = %d\n", siginfo->si_status); + printf(" si_utime = %ld\n", (long)siginfo->si_utime); + printf(" si_stime = %ld\n", (long)siginfo->si_stime); + printf(" si_value = %d\n", siginfo->si_value.sival_int); + printf(" si_int = %d\n", siginfo->si_int); + printf(" si_ptr = %p\n", siginfo->si_ptr); + printf(" si_addr = %p\n", siginfo->si_addr); + printf(" si_band = %ld\n", siginfo->si_band); + printf(" si_fd = %d\n", siginfo->si_fd); + } +#endif + sigusr2_rcvd = 1; +} +#else +void sigusr2_sigaction(int signo) +{ + printf("sigusr2_sigaction: Received SIGUSR2, signo=%d\n", signo); + sigusr2_rcvd = 1; +} + +#endif + +/**************************************************************************** + * Name: sigusr2_sighandler + ****************************************************************************/ + +static void sigusr2_sighandler(int signo) +{ + printf("sigusr2_sighandler: Received SIGUSR2, signo=%d\n", signo); + sigusr2_rcvd = 1; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: main + ****************************************************************************/ + +int main(int argc, char **argv) +{ + struct sigaction act; + struct sigaction oact; + void (*old_sigusr1_sighandler)(int signo); + void (*old_sigusr2_sighandler)(int signo); + pid_t mypid = getpid(); +#if defined(__USE_POSIX199309) && defined(HAVE_SIGQUEUE) + sigval_t sigval; +#endif + int status; + + printf("Setting up signal handlers from pid=%d\n", mypid); + + /* Set up so that sigusr1_sighandler will respond to SIGUSR1 */ + + old_sigusr1_sighandler = signal(SIGUSR1, sigusr1_sighandler); + if (old_sigusr1_sighandler == SIG_ERR) + { + fprintf(stderr, "Failed to install SIGUSR1 handler, errno=%d\n", + errno); + exit(1); + } + + printf("Old SIGUSR1 sighandler at %p\n", old_sigusr1_sighandler); + printf("New SIGUSR1 sighandler at %p\n", sigusr1_sighandler); + + /* Set up so that sigusr2_sigaction will respond to SIGUSR2 */ + + memset(&act, 0, sizeof(struct sigaction)); + act.sa_sigaction = sigusr2_sigaction; + act.sa_flags = SA_SIGINFO; + + (void)sigemptyset(&act.sa_mask); + + status = sigaction(SIGUSR2, &act, &oact); + if (status != 0) + { + fprintf(stderr, "Failed to install SIGUSR2 handler, errno=%d\n", + errno); + exit(2); + } + + printf("Old SIGUSR2 sighandler at %p\n", oact.sa_handler); + printf("New SIGUSR2 sighandler at %p\n", sigusr2_sigaction); + printf("Raising SIGUSR1 from pid=%d\n", mypid); + + fflush(stdout); usleep(SHORT_DELAY); + + /* Send SIGUSR1 to ourselves via raise() */ + + status = raise(SIGUSR1); + if (status != 0) + { + fprintf(stderr, "Failed to raise SIGUSR1, errno=%d\n", errno); + exit(3); + } + + usleep(SHORT_DELAY); + printf("SIGUSR1 raised from pid=%d\n", mypid); + + /* Verify that we received SIGUSR1 */ + + if (sigusr1_rcvd == 0) + { + fprintf(stderr, "SIGUSR1 not received\n"); + exit(4); + } + sigusr1_rcvd = 0; + + /* Send SIGUSR2 to ourselves */ + + printf("Killing SIGUSR2 from pid=%d\n", mypid); + fflush(stdout); usleep(SHORT_DELAY); + +#if defined(__USE_POSIX199309) && defined(HAVE_SIGQUEUE) + /* Send SIGUSR2 to ourselves via sigqueue() */ + + sigval.sival_int = 87; + status = sigqueue(mypid, SIGUSR2, sigval); + if (status != 0) + { + fprintf(stderr, "Failed to queue SIGUSR2, errno=%d\n", errno); + exit(5); + } + + usleep(SHORT_DELAY); + printf("SIGUSR2 queued from pid=%d, sigval=97\n", mypid); +#else + /* Send SIGUSR2 to ourselves via kill() */ + + status = kill(mypid, SIGUSR2); + if (status != 0) + { + fprintf(stderr, "Failed to kill SIGUSR2, errno=%d\n", errno); + exit(5); + } + + usleep(SHORT_DELAY); + printf("SIGUSR2 killed from pid=%d\n", mypid); +#endif + /* Verify that SIGUSR2 was received */ + + if (sigusr2_rcvd == 0) + { + fprintf(stderr, "SIGUSR2 not received\n"); + exit(6); + } + sigusr2_rcvd = 0; + + /* Remove the sigusr2_sigaction handler and replace the SIGUSR2 + * handler with sigusr2_sighandler. + */ + + printf("Resetting SIGUSR2 signal handler from pid=%d\n", mypid); + + old_sigusr2_sighandler = signal(SIGUSR2, sigusr2_sighandler); + if (old_sigusr2_sighandler == SIG_ERR) + { + fprintf(stderr, "Failed to install SIGUSR2 handler, errno=%d\n", + errno); + exit(7); + } + + printf("Old SIGUSR2 sighandler at %p\n", old_sigusr2_sighandler); + printf("New SIGUSR2 sighandler at %p\n", sigusr2_sighandler); + + /* Verify that the handler that was removed was sigusr2_sigaction */ + + if ((void*)old_sigusr2_sighandler != (void*)sigusr2_sigaction) + { + fprintf(stderr, + "Old SIGUSR2 signhanlder (%p) is not sigusr2_sigation (%p)\n", + old_sigusr2_sighandler, sigusr2_sigaction); + exit(8); + } + + /* Send SIGUSR2 to ourselves via kill() */ + + printf("Killing SIGUSR2 from pid=%d\n", mypid); + fflush(stdout); usleep(SHORT_DELAY); + + status = kill(mypid, SIGUSR2); + if (status != 0) + { + fprintf(stderr, "Failed to kill SIGUSR2, errno=%d\n", errno); + exit(9); + } + + usleep(SHORT_DELAY); + printf("SIGUSR2 killed from pid=%d\n", mypid); + + /* Verify that SIGUSR2 was received */ + + if (sigusr2_rcvd == 0) + { + fprintf(stderr, "SIGUSR2 not received\n"); + exit(10); + } + sigusr2_rcvd = 0; + + return 0; +} diff --git a/apps/examples/nxflat/tests/struct/Makefile b/apps/examples/nxflat/tests/struct/Makefile new file mode 100644 index 0000000000..7a5f3fb821 --- /dev/null +++ b/apps/examples/nxflat/tests/struct/Makefile @@ -0,0 +1,80 @@ +############################################################################ +# examples/nxflat/tests/hello/Makefile +# +# Copyright (C) 2009 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config # Current configuration +-include $(TOPDIR)/Make.defs # Basic make info + +CFLAGS += -I. + +BIN = struct + +R1SRCS = struct_main.c struct_dummy.c +R1OBJS = $(R1SRCS:.c=.o) + +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) + +all: $(BIN) + +$(R1OBJS): %.o: %.c + @echo "CC: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(R2OBJ): %.o: %.S + @echo "AS: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(BIN).r1: $(R1OBJS) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS1) -o $@ $^ + +$(R2SRC): $(BIN).r1 + @echo "MK: $<" + @$(MKNXFLAT) -o $@ $^ + +$(BIN).r2: $(R2OBJ) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) + +$(BIN): $(BIN).r2 + @echo "LD: $<" + @$(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ + +clean: + @rm -f $(BIN) $(R2SRC) *.o *.r1 *.r2 *~ .*.swp core + +install: + @install -D $(BIN) $(ROMFS_DIR)/$(BIN) + diff --git a/apps/examples/nxflat/tests/struct/struct.h b/apps/examples/nxflat/tests/struct/struct.h new file mode 100644 index 0000000000..0b1747d8c3 --- /dev/null +++ b/apps/examples/nxflat/tests/struct/struct.h @@ -0,0 +1,89 @@ +/**************************************************************************** + * examples/nxflat/tests/struct/struct.h + * + * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __EXAMPLES_NXFLAT_TESTS_STRUCT_STRUCT_H +#define __EXAMPLES_NXFLAT_TESTS_STRUCT_STRUCT_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define DUMMY_SCALAR_VALUE1 42 +#define DUMMY_SCALAR_VALUE2 87 +#define DUMMY_SCALAR_VALUE3 117 + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +typedef void (*dummy_t)(void); + +struct struct_dummy_s +{ + int n; /* This is a simple scalar value (DUMMY_SCALAR_VALUE3) */ +}; + +struct struct_s +{ + int n; /* This is a simple scalar value (DUMMY_SCALAR_VALUE1) */ + const int *pn; /* This is a pointer to a simple scalar value */ + const struct struct_dummy_s *ps; /* This is a pointer to a structure */ + dummy_t pf; /* This is a pointer to a function */ +}; + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +extern int dummy_scalar; /* (DUMMY_SCALAR_VALUE2) */ +extern const struct struct_dummy_s dummy_struct; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +extern void dummyfunc(void); +extern const struct struct_s *getstruct(void); + +#endif /* __EXAMPLES_NXFLAT_TESTS_STRUCT_STRUCT_H */ + + diff --git a/apps/examples/nxflat/tests/struct/struct_dummy.c b/apps/examples/nxflat/tests/struct/struct_dummy.c new file mode 100644 index 0000000000..7f0be6a1f2 --- /dev/null +++ b/apps/examples/nxflat/tests/struct/struct_dummy.c @@ -0,0 +1,65 @@ +/**************************************************************************** + * examples/nxflat/tests/struct/struct_dummy.c + * + * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +#include "struct.h" + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +const struct struct_s dummy = +{ + DUMMY_SCALAR_VALUE1, + &dummy_scalar, + &dummy_struct, + (dummy_t)dummyfunc +}; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +const struct struct_s *getstruct(void) +{ + return &dummy; +} + diff --git a/apps/examples/nxflat/tests/struct/struct_main.c b/apps/examples/nxflat/tests/struct/struct_main.c new file mode 100644 index 0000000000..d82cdd7069 --- /dev/null +++ b/apps/examples/nxflat/tests/struct/struct_main.c @@ -0,0 +1,109 @@ +/**************************************************************************** + * examples/nxflat/tests/struct/struct_main.c + * + * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +#include "struct.h" + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +const struct struct_dummy_s dummy_struct = +{ + DUMMY_SCALAR_VALUE3 +}; + +int dummy_scalar = DUMMY_SCALAR_VALUE2; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int main(int argc, char **argv) +{ + const struct struct_s *mystruct = getstruct(); + + printf("Calling getstruct()\n"); + mystruct = getstruct(); + printf("getstruct returned %p\n", mystruct); + printf(" n = %d (vs %d) %s\n", + mystruct->n, DUMMY_SCALAR_VALUE1, + mystruct->n == DUMMY_SCALAR_VALUE1 ? "PASS" : "FAIL"); + + printf(" pn = %p (vs %p) %s\n", + mystruct->pn, &dummy_scalar, + mystruct->pn == &dummy_scalar ? "PASS" : "FAIL"); + if (mystruct->pn == &dummy_scalar) + { + printf(" *pn = %d (vs %d) %s\n", + *mystruct->pn, DUMMY_SCALAR_VALUE2, + *mystruct->pn == DUMMY_SCALAR_VALUE2 ? "PASS" : "FAIL"); + } + + printf(" ps = %p (vs %p) %s\n", + mystruct->ps, &dummy_struct, + mystruct->ps == &dummy_struct ? "PASS" : "FAIL"); + if (mystruct->ps == &dummy_struct) + { + printf(" ps->n = %d (vs %d) %s\n", + mystruct->ps->n, DUMMY_SCALAR_VALUE3, + mystruct->ps->n == DUMMY_SCALAR_VALUE3 ? "PASS" : "FAIL"); + } + + printf(" pf = %p (vs %p) %s\n", + mystruct->pf, dummyfunc, + mystruct->pf == dummyfunc ? "PASS" : "FAIL"); + if (mystruct->pf == dummyfunc) + { + printf("Calling mystruct->pf()\n"); + mystruct->pf(); + } + + printf("Exit-ing\n"); + return 0; +} + +void dummyfunc(void) +{ + printf("In dummyfunc() -- PASS\n"); +} + + diff --git a/apps/examples/nxflat/tests/task/Makefile b/apps/examples/nxflat/tests/task/Makefile new file mode 100644 index 0000000000..0881d4717a --- /dev/null +++ b/apps/examples/nxflat/tests/task/Makefile @@ -0,0 +1,79 @@ +############################################################################ +# examples/nxflat/tests/task/Makefile +# +# Copyright (C) 2009 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config # Current configuration +-include $(TOPDIR)/Make.defs # Basic make info + +BIN = task + +R1SRCS = $(BIN).c +R1OBJS = $(R1SRCS:.c=.o) + +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) + +all: $(BIN) + +$(R1OBJS): %.o: %.c + @echo "CC: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(R2OBJ): %.o: %.S + @echo "AS: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(BIN).r1: $(R1OBJS) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS1) -o $@ $^ + +$(R2SRC): $(BIN).r1 + @echo "MK: $<" + @$(MKNXFLAT) -o $@ $^ + +$(BIN).r2: $(R2OBJ) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) + +$(BIN): $(BIN).r2 + @echo "LD: $<" + @$(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ + +clean: + @rm -f $(BIN) $(R2SRC) *.o *.r1 *.r2 *~ .*.swp core + +install: + @install -D $(BIN) $(ROMFS_DIR)/$(BIN) + + diff --git a/apps/examples/nxflat/tests/task/task.c b/apps/examples/nxflat/tests/task/task.c new file mode 100644 index 0000000000..63e8188ed5 --- /dev/null +++ b/apps/examples/nxflat/tests/task/task.c @@ -0,0 +1,143 @@ +/**************************************************************************** + * examples/nxflat/tests/task/parent.c + * + * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static char child_name[] = "child"; +static char child_arg[] = "Hello from your parent!"; +static sem_t g_sem; + +#if CONFIG_TASK_NAME_SIZE == 0 +static char no_name[] = ""; +#endif + +/**************************************************************************** + * Privite Functions + ****************************************************************************/ + +/* NOTE: it is necessary for functions that are referred to by function pointers + * pointer to be declared with global scope (at least for ARM). Otherwise, + * a relocation type that is not supported by NXFLAT is generated by GCC. + */ + + int child_task(int argc, char **argv) +{ + printf("Child: execv was successful!\n"); + printf("Child: argc=%d\n", argc); + + if (argc != 2) + { + printf("Child: expected argc to be 2\n"); + printf("Child: Exit-ting with status=2\n"); + exit(2); + } + printf("Child: argv[0]=\"%s\"\n", argv[0]); + +#if CONFIG_TASK_NAME_SIZE == 0 + if (strcmp(argv[0], no_name) != 0) + { + printf("Child: expected argv[0] to be \"%s\"\n", no_name); + printf("Child: Exit-ting with status=3\n"); + exit(3); + } +#else + if (strncmp(argv[0], child_name, CONFIG_TASK_NAME_SIZE) != 0) + { + printf("Child: expected argv[0] to be \"%s\"\n", child_name); + printf("Child: Exit-ting with status=3\n"); + exit(3); + } +#endif + + printf("Child: argv[1]=\"%s\"\n", argv[1]); + + if (strcmp(argv[1], child_arg) != 0) + { + printf("Child: expected argv[1] to be \"%s\"\n", child_arg); + printf("Child: Exit-ting with status=4\n"); + exit(4); + } + + printf("Child: Exit-ting with status=0\n"); + sem_post(&g_sem); + return 0; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int main(int argc, char **argv) +{ + pid_t parent_pid = getpid(); + char *child_argv[2]; + pid_t child_pid; + + printf("Parent: Started, pid=%d\n", parent_pid); + + sem_init(&g_sem, 0, 0); + + printf("Parent: Calling task_create()\n"); + + child_argv[0] = child_arg; + child_argv[1] = 0; + child_pid = task_create(child_name, 50, 512, child_task, (const char**)child_argv); + if (child_pid < 0) + { + printf("Parent: task_create failed: %d\n", errno); + } + + printf("Parent: Waiting for child (pid=%d)\n", child_pid); + sem_wait(&g_sem); + printf("Parent: Exit-ing\n"); + sem_destroy(&g_sem); + return 0; +} + diff --git a/apps/examples/nxhello/Makefile b/apps/examples/nxhello/Makefile new file mode 100644 index 0000000000..84fb417756 --- /dev/null +++ b/apps/examples/nxhello/Makefile @@ -0,0 +1,105 @@ +############################################################################ +# apps/examples/nxhello/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# NuttX NX Graphics Example. + +ASRCS = +CSRCS = nxhello_main.c nxhello_bkgd.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# NXHELLO built-in application info + +APPNAME = nxhello +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +# Common build + +VPATH = + +all: .built +.PHONY: context clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +.context: +ifeq ($(CONFIG_EXAMPLES_NXHELLO_BUILTIN),y) + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + @touch $@ +endif + +context: .context + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/nxhello/nxhello.h b/apps/examples/nxhello/nxhello.h new file mode 100644 index 0000000000..1692858563 --- /dev/null +++ b/apps/examples/nxhello/nxhello.h @@ -0,0 +1,196 @@ +/**************************************************************************** + * examples/nxhello/nxhello.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_EXAMPLES_NXHELLO_NXHELLO_H +#define __APPS_EXAMPLES_NXHELLO_NXHELLO_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ + +#ifndef CONFIG_NX +# error "NX is not enabled (CONFIG_NX)" +#endif + +#ifndef CONFIG_EXAMPLES_NXHELLO_VPLANE +# define CONFIG_EXAMPLES_NXHELLO_VPLANE 0 +#endif + +#ifndef CONFIG_EXAMPLES_NXHELLO_BPP +# define CONFIG_EXAMPLES_NXHELLO_BPP 32 +#endif + +#ifndef CONFIG_EXAMPLES_NXHELLO_BGCOLOR +# if CONFIG_EXAMPLES_NXHELLO_BPP == 24 || CONFIG_EXAMPLES_NXHELLO_BPP == 32 +# define CONFIG_EXAMPLES_NXHELLO_BGCOLOR 0x007b68ee +# elif CONFIG_EXAMPLES_NXHELLO_BPP == 16 +# define CONFIG_EXAMPLES_NXHELLO_BGCOLOR 0x7b5d +# else +# define CONFIG_EXAMPLES_NXHELLO_BGCOLOR ' ' +# endif +#endif + +#ifndef CONFIG_EXAMPLES_NXHELLO_FONTID +# define CONFIG_EXAMPLES_NXHELLO_FONTID NXFONT_DEFAULT +#endif + +#ifndef CONFIG_EXAMPLES_NXHELLO_FONTCOLOR +# if CONFIG_EXAMPLES_NXHELLO_BPP == 24 || CONFIG_EXAMPLES_NXHELLO_BPP == 32 +# define CONFIG_EXAMPLES_NXHELLO_FONTCOLOR 0x00000000 +# elif CONFIG_EXAMPLES_NXHELLO_BPP == 16 +# define CONFIG_EXAMPLES_NXHELLO_FONTCOLOR 0x0000 +# else +# define CONFIG_EXAMPLES_NXHELLO_FONTCOLOR 'F' +# endif +#endif + +/* Debug ********************************************************************/ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_DEBUG +# define message(...) lib_lowprintf(__VA_ARGS__) +# define msgflush() +# else +# define message(...) printf(__VA_ARGS__) +# define msgflush() fflush(stdout) +# endif +#else +# ifdef CONFIG_DEBUG +# define message lib_lowprintf +# define msgflush() +# else +# define message printf +# define msgflush() fflush(stdout) +# endif +#endif + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +enum exitcode_e +{ + NXEXIT_SUCCESS = 0, + NXEXIT_EXTINITIALIZE, + NXEXIT_FBINITIALIZE, + NXEXIT_FBGETVPLANE, + NXEXIT_LCDINITIALIZE, + NXEXIT_LCDGETDEV, + NXEXIT_NXOPEN, + NXEXIT_FONTOPEN, + NXEXIT_NXREQUESTBKGD, + NXEXIT_NXSETBGCOLOR +}; + +/* Describes one cached glyph bitmap */ + +struct nxhello_glyph_s +{ + uint8_t code; /* Character code */ + uint8_t height; /* Height of this glyph (in rows) */ + uint8_t width; /* Width of this glyph (in pixels) */ + uint8_t stride; /* Width of the glyph row (in bytes) */ + uint8_t usecnt; /* Use count */ + FAR uint8_t *bitmap; /* Allocated bitmap memory */ +}; + +/* Describes on character on the display */ + +struct nxhello_bitmap_s +{ + uint8_t code; /* Character code */ + uint8_t flags; /* See BMFLAGS_* */ + struct nxgl_point_s pos; /* Character position */ +}; + +struct nxhello_data_s +{ + /* The NX handles */ + + NXHANDLE hnx; + NXHANDLE hbkgd; + NXHANDLE hfont; + + /* The screen resolution */ + + nxgl_coord_t xres; + nxgl_coord_t yres; + + volatile bool havepos; + sem_t sem; + volatile int code; +}; + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/* NXHELLO state data */ + +extern struct nxhello_data_s g_nxhello; + +/* NX callback vtables */ + +extern const struct nx_callback_s g_bgcb; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_NXHELLO_EXTERNINIT +extern FAR NX_DRIVERTYPE *up_nxdrvinit(unsigned int devno); +#endif + +/* Background window interfaces */ + +extern void nxhello_hello(NXWINDOW hwnd); + +#endif /* __APPS_EXAMPLES_NXHELLO_NXHELLO_H */ diff --git a/apps/examples/nxhello/nxhello_bkgd.c b/apps/examples/nxhello/nxhello_bkgd.c new file mode 100644 index 0000000000..93b7798e11 --- /dev/null +++ b/apps/examples/nxhello/nxhello_bkgd.c @@ -0,0 +1,443 @@ +/**************************************************************************** + * examples/nxhello/nxhello_bkgd.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "nxhello.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Select renderer -- Some additional logic would be required to support + * pixel depths that are not directly addressable (1,2,4, and 24). + */ + +#if CONFIG_EXAMPLES_NXHELLO_BPP == 1 +# define RENDERER nxf_convert_1bpp +#elif CONFIG_EXAMPLES_NXHELLO_BPP == 2 +# define RENDERER nxf_convert_2bpp +#elif CONFIG_EXAMPLES_NXHELLO_BPP == 4 +# define RENDERER nxf_convert_4bpp +#elif CONFIG_EXAMPLES_NXHELLO_BPP == 8 +# define RENDERER nxf_convert_8bpp +#elif CONFIG_EXAMPLES_NXHELLO_BPP == 16 +# define RENDERER nxf_convert_16bpp +#elif CONFIG_EXAMPLES_NXHELLO_BPP == 24 +# define RENDERER nxf_convert_24bpp +#elif CONFIG_EXAMPLES_NXHELLO_BPP == 32 +# define RENDERER nxf_convert_32bpp +#else +# error "Unsupported CONFIG_EXAMPLES_NXHELLO_BPP" +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static void nxhello_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + bool morem, FAR void *arg); +static void nxhello_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, + FAR const struct nxgl_point_s *pos, + FAR const struct nxgl_rect_s *bounds, + FAR void *arg); +#ifdef CONFIG_NX_MOUSE +static void nxhello_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, + uint8_t buttons, FAR void *arg); +#endif + +#ifdef CONFIG_NX_KBD +static void nxhello_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, + FAR void *arg); +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const char g_hello[] = "Hello, World!"; + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* Background window call table */ + +const struct nx_callback_s g_bgcb = +{ + nxhello_redraw, /* redraw */ + nxhello_position /* position */ +#ifdef CONFIG_NX_MOUSE + , nxhello_mousein /* mousein */ +#endif +#ifdef CONFIG_NX_KBD + , nxhello_kbdin /* my kbdin */ +#endif +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxhello_redraw + ****************************************************************************/ + +static void nxhello_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + bool more, FAR void *arg) +{ + gvdbg("hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n", + hwnd, rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, + more ? "true" : "false"); +} + +/**************************************************************************** + * Name: nxhello_position + ****************************************************************************/ + +static void nxhello_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, + FAR const struct nxgl_point_s *pos, + FAR const struct nxgl_rect_s *bounds, + FAR void *arg) +{ + /* Report the position */ + + gvdbg("hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n", + hwnd, size->w, size->h, pos->x, pos->y, + bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y); + + /* Have we picked off the window bounds yet? */ + + if (!g_nxhello.havepos) + { + /* Save the background window handle */ + + g_nxhello.hbkgd = hwnd; + + /* Save the window limits */ + + g_nxhello.xres = bounds->pt2.x + 1; + g_nxhello.yres = bounds->pt2.y + 1; + + g_nxhello.havepos = true; + sem_post(&g_nxhello.sem); + gvdbg("Have xres=%d yres=%d\n", g_nxhello.xres, g_nxhello.yres); + } +} + +/**************************************************************************** + * Name: nxhello_mousein + ****************************************************************************/ + +#ifdef CONFIG_NX_MOUSE +static void nxhello_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, + uint8_t buttons, FAR void *arg) +{ + message("nxhello_mousein: hwnd=%p pos=(%d,%d) button=%02x\n", + hwnd, pos->x, pos->y, buttons); +} +#endif + +/**************************************************************************** + * Name: nxhello_kbdin + ****************************************************************************/ + +#ifdef CONFIG_NX_KBD +static void nxhello_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, + FAR void *arg) +{ + gvdbg("hwnd=%p nch=%d\n", hwnd, nch); + + /* In this example, there is no keyboard so a keyboard event is not + * expected. + */ + + message("nxhello_kbdin: Unexpected keyboard callback\n"); +} +#endif + +/**************************************************************************** + * Name: nxhello_center + ****************************************************************************/ + +static void nxhello_center(FAR struct nxgl_point_s *pos, + FAR const struct nx_font_s *fontset) +{ + FAR const struct nx_fontbitmap_s *fbm; + FAR uint8_t *ptr; + unsigned int width; + + /* Get the width of the collection of characters so that we can center the + * hello world message. + */ + + for (ptr = (uint8_t*)g_hello, width = 0; *ptr; ptr++) + { + /* Get the font bitmap for this character */ + + fbm = nxf_getbitmap(g_nxhello.hfont, *ptr); + if (fbm) + { + /* Add the font size */ + + width += fbm->metric.width + fbm->metric.xoffset; + } + else + { + /* Use the width of a space */ + + width += fontset->spwidth; + } + } + + /* Now we know how to center the string. Create a the position and + * the bounding box + */ + + pos->x = (g_nxhello.xres - width) / 2; + pos->y = (g_nxhello.yres - fontset->mxheight) / 2; +} + +/**************************************************************************** + * Name: nxhello_initglyph + ****************************************************************************/ + +static void nxhello_initglyph(FAR uint8_t *glyph, uint8_t height, + uint8_t width, uint8_t stride) +{ + FAR nxgl_mxpixel_t *ptr; +#if CONFIG_EXAMPLES_NXHELLO_BPP < 8 + nxgl_mxpixel_t pixel; +#endif + unsigned int row; + unsigned int col; + + /* Initialize the glyph memory to the background color */ + +#if CONFIG_EXAMPLES_NXHELLO_BPP < 8 + + pixel = CONFIG_EXAMPLES_NXHELLO_BGCOLOR; + +#if CONFIG_NX_NPLANES > 1 +# warning "More logic is needed for the case where CONFIG_NX_PLANES > 1" +#endif +# if CONFIG_EXAMPLES_NXHELLO_BPP == 1 + /* Pack 1-bit pixels into a 2-bits */ + + pixel &= 0x01; + pixel = (pixel) << 1 |pixel; + +# endif +# if CONFIG_EXAMPLES_NXHELLO_BPP < 4 + + /* Pack 2-bit pixels into a nibble */ + + pixel &= 0x03; + pixel = (pixel) << 2 |pixel; + +# endif + + /* Pack 4-bit nibbles into a byte */ + + pixel &= 0x0f; + pixel = (pixel) << 4 | pixel; + + ptr = (FAR nxgl_mxpixel_t *)glyph; + for (row = 0; row < fheight; row++) + { + for (col = 0; col < stride; col++) + { + /* Transfer the packed bytes into the buffer */ + + *ptr++ = pixel; + } + } + +#elif CONFIG_EXAMPLES_NXHELLO_BPP == 24 +# error "Additional logic is needed here for 24bpp support" + +#else /* CONFIG_EXAMPLES_NXHELLO_BPP = {8,16,32} */ + + ptr = (FAR nxgl_mxpixel_t *)glyph; + for (row = 0; row < height; row++) + { + /* Just copy the color value into the glyph memory */ + + for (col = 0; col < width; col++) + { + *ptr++ = CONFIG_EXAMPLES_NXHELLO_BGCOLOR; +#if CONFIG_NX_NPLANES > 1 +# warning "More logic is needed for the case where CONFIG_NX_PLANES > 1" +#endif + } + } +#endif +} + + /**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxhello_hello + * + * Description: + * Print "Hello, World!" in the center of the display. + * + ****************************************************************************/ + +void nxhello_hello(NXWINDOW hwnd) +{ + FAR const struct nx_font_s *fontset; + FAR const struct nx_fontbitmap_s *fbm; + FAR uint8_t *glyph; + FAR const char *ptr; + FAR struct nxgl_point_s pos; + FAR struct nxgl_rect_s dest; + FAR const void *src[CONFIG_NX_NPLANES]; + unsigned int glyphsize; + unsigned int mxstride; + int ret; + + /* Get information about the font we are going to use */ + + fontset = nxf_getfontset(g_nxhello.hfont); + + /* Allocate a bit of memory to hold the largest rendered font */ + + mxstride = (fontset->mxwidth * CONFIG_EXAMPLES_NXHELLO_BPP + 7) >> 3; + glyphsize = (unsigned int)fontset->mxheight * mxstride; + glyph = (FAR uint8_t*)malloc(glyphsize); + + /* NOTE: no check for failure to allocate the memory. In a real application + * you would need to handle that event. + */ + + /* Get a position so the the "Hello, World!" string will be centered on the + * display. + */ + + nxhello_center(&pos, fontset); + message("nxhello_hello: Position (%d,%d)\n", pos.x, pos.y); + + /* Now we can say "hello" in the center of the display. */ + + for (ptr = g_hello; *ptr; ptr++) + { + /* Get the bitmap font for this ASCII code */ + + fbm = nxf_getbitmap(g_nxhello.hfont, *ptr); + if (fbm) + { + uint8_t fheight; /* Height of this glyph (in rows) */ + uint8_t fwidth; /* Width of this glyph (in pixels) */ + uint8_t fstride; /* Width of the glyph row (in bytes) */ + + /* Get information about the font bitmap */ + + fwidth = fbm->metric.width + fbm->metric.xoffset; + fheight = fbm->metric.height + fbm->metric.yoffset; + fstride = (fwidth * CONFIG_EXAMPLES_NXHELLO_BPP + 7) >> 3; + + /* Initialize the glyph memory to the background color */ + + nxhello_initglyph(glyph, fheight, fwidth, fstride); + + /* Then render the glyph into the allocated memory */ + +#if CONFIG_NX_NPLANES > 1 +# warning "More logic is needed for the case where CONFIG_NX_PLANES > 1" +#endif + (void)RENDERER((FAR nxgl_mxpixel_t*)glyph, fheight, fwidth, + fstride, fbm, CONFIG_EXAMPLES_NXHELLO_FONTCOLOR); + + /* Describe the destination of the font with a rectangle */ + + dest.pt1.x = pos.x; + dest.pt1.y = pos.y; + dest.pt2.x = pos.x + fwidth - 1; + dest.pt2.y = pos.y + fheight - 1; + + /* Then put the font on the display */ + + src[0] = (FAR const void *)glyph; +#if CONFIG_NX_NPLANES > 1 +# warning "More logic is needed for the case where CONFIG_NX_PLANES > 1" +#endif + ret = nx_bitmap((NXWINDOW)hwnd, &dest, src, &pos, fstride); + if (ret < 0) + { + message("nxhello_write: nx_bitmapwindow failed: %d\n", errno); + } + + /* Skip to the right the width of the font */ + + pos.x += fwidth; + } + else + { + /* No bitmap (probably because the font is a space). Skip to the + * right the width of a space. + */ + + pos.x += fontset->spwidth; + } + } + + /* Free the allocated glyph */ + + free(glyph); +} diff --git a/apps/examples/nxhello/nxhello_main.c b/apps/examples/nxhello/nxhello_main.c new file mode 100644 index 0000000000..e71df98d1e --- /dev/null +++ b/apps/examples/nxhello/nxhello_main.c @@ -0,0 +1,294 @@ +/**************************************************************************** + * examples/nxhello/nxhello_main.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_NX_LCDDRIVER +# include +#else +# include +#endif + +#include +#include +#include +#include + +#include "nxhello.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ +/* If not specified, assume that the hardware supports one video plane */ + +#ifndef CONFIG_EXAMPLES_NXHELLO_VPLANE +# define CONFIG_EXAMPLES_NXHELLO_VPLANE 0 +#endif + +/* If not specified, assume that the hardware supports one LCD device */ + +#ifndef CONFIG_EXAMPLES_NXHELLO_DEVNO +# define CONFIG_EXAMPLES_NXHELLO_DEVNO 0 +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +struct nxhello_data_s g_nxhello = +{ + NULL, /* hnx */ + NULL, /* hbkgd */ + NULL, /* hfont */ + 0, /* xres */ + 0, /* yres */ + false, /* havpos */ + { 0 }, /* sem */ + NXEXIT_SUCCESS /* exit code */ +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxhello_initialize + ****************************************************************************/ + +static inline int nxhello_initialize(void) +{ + FAR NX_DRIVERTYPE *dev; + +#if defined(CONFIG_EXAMPLES_NXHELLO_EXTERNINIT) + /* Use external graphics driver initialization */ + + message("nxhello_initialize: Initializing external graphics device\n"); + dev = up_nxdrvinit(CONFIG_EXAMPLES_NXHELLO_DEVNO); + if (!dev) + { + message("nxhello_initialize: up_nxdrvinit failed, devno=%d\n", + CONFIG_EXAMPLES_NXHELLO_DEVNO); + g_nxhello.code = NXEXIT_EXTINITIALIZE; + return ERROR; + } + +#elif defined(CONFIG_NX_LCDDRIVER) + int ret; + + /* Initialize the LCD device */ + + message("nxhello_initialize: Initializing LCD\n"); + ret = up_lcdinitialize(); + if (ret < 0) + { + message("nxhello_initialize: up_lcdinitialize failed: %d\n", -ret); + g_nxhello.code = NXEXIT_LCDINITIALIZE; + return ERROR; + } + + /* Get the device instance */ + + dev = up_lcdgetdev(CONFIG_EXAMPLES_NXHELLO_DEVNO); + if (!dev) + { + message("nxhello_initialize: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NXHELLO_DEVNO); + g_nxhello.code = NXEXIT_LCDGETDEV; + return ERROR; + } + + /* Turn the LCD on at 75% power */ + + (void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4)); +#else + int ret; + + /* Initialize the frame buffer device */ + + message("nxhello_initialize: Initializing framebuffer\n"); + ret = up_fbinitialize(); + if (ret < 0) + { + message("nxhello_initialize: up_fbinitialize failed: %d\n", -ret); + g_nxhello.code = NXEXIT_FBINITIALIZE; + return ERROR; + } + + dev = up_fbgetvplane(CONFIG_EXAMPLES_NXHELLO_VPLANE); + if (!dev) + { + message("nxhello_initialize: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXHELLO_VPLANE); + g_nxhello.code = NXEXIT_FBGETVPLANE; + return ERROR; + } +#endif + + /* Then open NX */ + + message("nxhello_initialize: Open NX\n"); + g_nxhello.hnx = nx_open(dev); + if (!g_nxhello.hnx) + { + message("nxhello_initialize: nx_open failed: %d\n", errno); + g_nxhello.code = NXEXIT_NXOPEN; + return ERROR; + } + return OK; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: user_start/nxhello_main + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_NXHELLO_BUILTIN +# define MAIN_NAME nxhello_main +# define MAIN_NAME_STRING "nxhello_main" +#else +# define MAIN_NAME user_start +# define MAIN_NAME_STRING "user_start" +#endif + +int MAIN_NAME(int argc, char *argv[]) +{ + nxgl_mxpixel_t color; + int ret; + + /* Initialize NX */ + + ret = nxhello_initialize(); + message(MAIN_NAME_STRING ": NX handle=%p\n", g_nxhello.hnx); + if (!g_nxhello.hnx || ret < 0) + { + message(MAIN_NAME_STRING ": Failed to get NX handle: %d\n", errno); + g_nxhello.code = NXEXIT_NXOPEN; + goto errout; + } + + /* Get the default font handle */ + + g_nxhello.hfont = nxf_getfonthandle(CONFIG_EXAMPLES_NXHELLO_FONTID); + if (!g_nxhello.hfont) + { + message(MAIN_NAME_STRING ": Failed to get font handle: %d\n", errno); + g_nxhello.code = NXEXIT_FONTOPEN; + goto errout; + } + + /* Set the background to the configured background color */ + + message(MAIN_NAME_STRING ": Set background color=%d\n", + CONFIG_EXAMPLES_NXHELLO_BGCOLOR); + + color = CONFIG_EXAMPLES_NXHELLO_BGCOLOR; + ret = nx_setbgcolor(g_nxhello.hnx, &color); + if (ret < 0) + { + message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno); + g_nxhello.code = NXEXIT_NXSETBGCOLOR; + goto errout_with_nx; + } + + /* Get the background window */ + + ret = nx_requestbkgd(g_nxhello.hnx, &g_bgcb, NULL); + if (ret < 0) + { + message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno); + g_nxhello.code = NXEXIT_NXREQUESTBKGD; + goto errout_with_nx; + } + + /* Wait until we have the screen resolution. We'll have this immediately + * unless we are dealing with the NX server. + */ + + while (!g_nxhello.havepos) + { + (void)sem_wait(&g_nxhello.sem); + } + message(MAIN_NAME_STRING ": Screen resolution (%d,%d)\n", g_nxhello.xres, g_nxhello.yres); + + /* Now, say hello and exit, sleeping a little before each. */ + + sleep(1); + nxhello_hello(g_nxhello.hbkgd); + sleep(1); + + /* Release background */ + + (void)nx_releasebkgd(g_nxhello.hbkgd); + + /* Close NX */ + +errout_with_nx: + message(MAIN_NAME_STRING ": Close NX\n"); + nx_close(g_nxhello.hnx); +errout: + return g_nxhello.code; +} diff --git a/apps/examples/nximage/Makefile b/apps/examples/nximage/Makefile new file mode 100755 index 0000000000..4e0822687c --- /dev/null +++ b/apps/examples/nximage/Makefile @@ -0,0 +1,105 @@ +############################################################################ +# apps/examples/nximage/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# NuttX NX Graphics Example. + +ASRCS = +CSRCS = nximage_main.c nximage_bkgd.c nximage_bitmap.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# NXIMAGE built-in application info + +APPNAME = nximage +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +# Common build + +VPATH = + +all: .built +.PHONY: context clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +.context: +ifeq ($(CONFIG_EXAMPLES_NXIMAGE_BUILTIN),y) + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + @touch $@ +endif + +context: .context + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/nximage/nximage.h b/apps/examples/nximage/nximage.h new file mode 100755 index 0000000000..117eff6710 --- /dev/null +++ b/apps/examples/nximage/nximage.h @@ -0,0 +1,219 @@ +/**************************************************************************** + * examples/nximage/nximage.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_EXAMPLES_NXIMAGE_NXIMAGE_H +#define __APPS_EXAMPLES_NXIMAGE_NXIMAGE_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ + +#ifndef CONFIG_NX +# error "NX is not enabled (CONFIG_NX)" +#endif + +#ifndef CONFIG_EXAMPLES_NXIMAGE_VPLANE +# define CONFIG_EXAMPLES_NXIMAGE_VPLANE 0 +#endif + +#ifndef CONFIG_EXAMPLES_NXIMAGE_BPP +# define CONFIG_EXAMPLES_NXIMAGE_BPP 16 +#endif + +#if defined(CONFIG_EXAMPLES_NXIMAGE_XSCALEp5) +# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE1p0 +# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5 +# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0 +#elif defined(CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5) +# undef CONFIG_EXAMPLES_NXIMAGE_XSCALEp5 +# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE1p0 +# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0 +#elif defined(CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0) +# undef CONFIG_EXAMPLES_NXIMAGE_XSCALEp5 +# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE1p0 +# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5 +#else +# undef CONFIG_EXAMPLES_NXIMAGE_XSCALEp5 +# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE1p0 +# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5 +# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0 +# define CONFIG_EXAMPLES_NXIMAGE_XSCALE1p0 1 +#endif + +#if defined(CONFIG_EXAMPLES_NXIMAGE_YSCALEp5) +# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE1p0 +# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5 +# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0 +#elif defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5) +# undef CONFIG_EXAMPLES_NXIMAGE_YSCALEp5 +# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE1p0 +# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0 +#elif defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0) +# undef CONFIG_EXAMPLES_NXIMAGE_YSCALEp5 +# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE1p0 +# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5 +#else +# undef CONFIG_EXAMPLES_NXIMAGE_YSCALEp5 +# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE1p0 +# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5 +# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0 +# define CONFIG_EXAMPLES_NXIMAGE_YSCALE1p0 1 +#endif + +/* Debug ********************************************************************/ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_DEBUG +# define message(...) lib_lowprintf(__VA_ARGS__) +# define msgflush() +# else +# define message(...) printf(__VA_ARGS__) +# define msgflush() fflush(stdout) +# endif +#else +# ifdef CONFIG_DEBUG +# define message lib_lowprintf +# define msgflush() +# else +# define message printf +# define msgflush() fflush(stdout) +# endif +#endif + +/* Image Information ********************************************************/ + +#define IMAGE_HEIGHT 160 /* Number of rows in the raw image */ +#define IMAGE_WIDTH 160 /* Number of columns in the raw image */ + +#if defined(CONFIG_EXAMPLES_NXIMAGE_XSCALEp5) +# define SCALED_WIDTH 80 /* Number of columns in the scaled image */ +#elif defined(CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5) +# define SCALED_WIDTH 240 /* Number of columns in the scaled image */ +#elif defined(CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0) +# define SCALED_WIDTH 320 /* Number of columns in the scaled image */ +#else +# define SCALED_WIDTH 160 /* Number of columns in the scaled image */ +#endif + +#if defined(CONFIG_EXAMPLES_NXIMAGE_YSCALEp5) +# define SCALED_HEIGHT 80 /* Number of rows in the scaled image */ +#elif defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5) +# define SCALED_HEIGHT 240 /* Number of rows in the scaled image */ +#elif defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0) +# define SCALED_HEIGHT 320 /* Number of rows in the scaled image */ +#else +# define SCALED_HEIGHT 160 /* Number of rows in the scaled image */ +#endif + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +enum exitcode_e +{ + NXEXIT_SUCCESS = 0, + NXEXIT_EXTINITIALIZE, + NXEXIT_FBINITIALIZE, + NXEXIT_FBGETVPLANE, + NXEXIT_LCDINITIALIZE, + NXEXIT_LCDGETDEV, + NXEXIT_NXOPEN, + NXEXIT_NXREQUESTBKGD, + NXEXIT_NXSETBGCOLOR +}; + +struct nximage_data_s +{ + /* The NX handles */ + + NXHANDLE hnx; + NXHANDLE hbkgd; + + /* The screen resolution */ + + nxgl_coord_t xres; + nxgl_coord_t yres; + + volatile bool havepos; + sem_t sem; + volatile int code; +}; + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/* NXIMAGE state data */ + +extern struct nximage_data_s g_nximage; + +/* NX callback vtables */ + +extern const struct nx_callback_s g_bgcb; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT +extern FAR NX_DRIVERTYPE *up_nxdrvinit(unsigned int devno); +#endif + +/* Background window interfaces */ + +extern void nximage_image(NXWINDOW hwnd); + +/* Image interfaces */ + +extern nxgl_mxpixel_t nximage_bgcolor(void); +extern nxgl_mxpixel_t nximage_avgcolor(nxgl_mxpixel_t color1, nxgl_mxpixel_t color2); +extern void nximage_blitrow(FAR nxgl_mxpixel_t *run, FAR const void **state); + +#endif /* __APPS_EXAMPLES_NXIMAGE_NXIMAGE_H */ diff --git a/apps/examples/nximage/nximage_bitmap.c b/apps/examples/nximage/nximage_bitmap.c new file mode 100644 index 0000000000..6b0d137187 --- /dev/null +++ b/apps/examples/nximage/nximage_bitmap.c @@ -0,0 +1,3711 @@ +/******************************************************************************************** + * examples/nximage/nximage_bitmap.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ********************************************************************************************/ + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include + +#include +#include + +#include +#include + +#include "nximage.h" + +/******************************************************************************************** + * Pre-processor Definitions + ********************************************************************************************/ + +#if CONFIG_EXAMPLES_NXIMAGE_BPP == 24 + +# ifdef CONFIG_EXAMPLES_NXIMAGE_GREYSCALE +# error "24-bit greyscale not supported" +# endif + +# define IMAGE_NLUTCODES 164 /* Number of unique RGB colors in the image */ + +#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 16 + +# ifdef CONFIG_EXAMPLES_NXIMAGE_GREYSCALE +# error "16-bit greyscale not supported" +# endif + +# define IMAGE_NLUTCODES 141 /* Number of unique RGB colors in the image */ + +#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 8 + +# ifdef CONFIG_EXAMPLES_NXIMAGE_GREYSCALE +# define IMAGE_NLUTCODES 116 /* Number of unique greyscale levels in the image */ +# else +# define IMAGE_NLUTCODES 27 /* Number of unique RGB colors in the image */ +# endif + +#else +# error "Unsupport pixel format" +#endif + +/******************************************************************************************** + * Private Types + ********************************************************************************************/ + +struct pix_run_s +{ + uint8_t npix; /* Number of pixels */ + uint8_t code; /* Pixel RGB code */ +}; + +/******************************************************************************************** + * Private Data + ********************************************************************************************/ +/* RGB24 (8-8-8) Colors */ + +#if CONFIG_EXAMPLES_NXIMAGE_BPP == 24 + +static const nxgl_mxpixel_t g_lut[IMAGE_NLUTCODES] = +{ + 0x000000, 0x0a0804, 0x382616, 0x390c0f, 0x390d0f, 0x0a0203, 0x390b0e, 0x3a0d0f, /* Codes 0-7 */ + 0x350d0e, 0x1d0709, 0x24090b, 0x230f0d, 0x3b2817, 0x341511, 0x230a0b, 0x3a2817, /* Codes 8-15 */ + 0x350c0e, 0x1e1c1a, 0x3c3934, 0x390a0d, 0x0b0a09, 0x3c3933, 0x3b2321, 0x3d3d37, /* Codes 16-23 */ + 0x3c3b36, 0x38090b, 0x312e2a, 0x3c312d, 0x391516, 0x3c3c36, 0x3d3c36, 0x241212, /* Codes 24-31 */ + 0x1f0a0b, 0x1f0a0a, 0x1e090a, 0x2d0b0d, 0x3c3833, 0x3d3a36, 0x322f2a, 0x261f16, /* Codes 32-39 */ + 0x2f2617, 0x18130b, 0x3f3e38, 0x1e0507, 0x210a0b, 0x250a0c, 0x3f3f3f, 0x3d3a35, /* Codes 40-47 */ + 0x2e2414, 0x080704, 0x3e3b36, 0x2f2517, 0x3b2423, 0x2f211f, 0x3c3832, 0x363026, /* Codes 48-55 */ + 0x3e3c3a, 0x362f25, 0x390c0e, 0x3b2f2c, 0x3f3e3d, 0x3e3c39, 0x3b0d0f, 0x0a0805, /* Codes 56-63 */ + 0x2f2516, 0x2b1e14, 0x2d2114, 0x20080a, 0x2d0a0d, 0x3d3934, 0x32291c, 0x360d0f, /* Codes 64-71 */ + 0x2c201e, 0x2e2415, 0x2d2115, 0x1e070a, 0x3b2917, 0x3f3d37, 0x1e0406, 0x200a0b, /* Codes 72-79 */ + 0x340b0e, 0x2e0b0d, 0x220607, 0x3c2322, 0x3c3831, 0x373126, 0x1d0306, 0x2c2014, /* Codes 80-87 */ + 0x20090a, 0x030001, 0x1d090a, 0x3d0e10, 0x3b090c, 0x270b0c, 0x2d211f, 0x0a0703, /* Codes 88-95 */ + 0x382414, 0x39080c, 0x3e3c36, 0x2d1e1d, 0x1c0204, 0x1b0002, 0x230609, 0x1f0708, /* Codes 96-103 */ + 0x24080b, 0x342614, 0x3c3935, 0x342716, 0x38100e, 0x391210, 0x3c3731, 0x3e3d37, /* Codes 104-111 */ + 0x3a090c, 0x2b0b0d, 0x2e1e12, 0x381210, 0x3a2120, 0x23090b, 0x2f0c0d, 0x1c0709, /* Codes 112-119 */ + 0x1d0405, 0x380a0d, 0x3b0b0d, 0x2d090b, 0x1e0708, 0x340a0c, 0x230709, 0x2d1e1c, /* Codes 120-127 */ + 0x0a0001, 0x3c3a35, 0x351f13, 0x1e080a, 0x2c2115, 0x170a08, 0x1f0608, 0x2c1f13, /* Codes 128-135 */ + 0x340c0e, 0x3c0d10, 0x32080a, 0x3d3c37, 0x23100d, 0x3b3526, 0x38070b, 0x2b2014, /* Codes 136-143 */ + 0x3a0c0f, 0x2a1e1c, 0x070001, 0x0d0c0b, 0x19140c, 0x16110b, 0x322a1d, 0x3f3e3e, /* Codes 144-151 */ + 0x3e3b37, 0x37302c, 0x2f2c28, 0x39352d, 0x201e1c, 0x2a261f, 0x3c3d37, 0x2b080a, /* Codes 152-159 */ + 0x1d0608, 0x260a0c, 0x2b110e, 0x381f14 /* Codes 160-163 */ +}; + +/* RGB16 (565) Colors (four of the colors in this map are duplicates) */ + +#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 16 + +static const nxgl_mxpixel_t g_lut[IMAGE_NLUTCODES] = +{ + 0x0000, 0x1105, 0x5cdc, 0x399c, 0x41bc, 0x0845, 0x397c, 0x39bc, 0x41bd, 0x39ba, /* Codes 0-9 */ + 0x28ee, 0x3132, 0x31f2, 0x5d1d, 0x42ba, 0x3152, 0x399a, 0x6b8f, 0xd73e, 0x315c, /* Codes 10-19 */ + 0x2945, 0x8c7d, 0xe7be, 0xdf7e, 0x313c, 0xadd9, 0xb63e, 0x5abd, 0xdf9e, 0xdf9f, /* Codes 20-29 */ + 0x4a52, 0x2950, 0x292f, 0x3176, 0xcf1e, 0xdf5f, 0xadf9, 0x5bf3, 0x5cd8, 0x326c, /* Codes 30-39 */ + 0xe7df, 0x18af, 0x3153, 0xdf5e, 0xffff, 0x5497, 0x10e4, 0xdf7f, 0x5cb8, 0x8c9d, /* Codes 40-49 */ + 0x8437, 0x9e1b, 0xef9f, 0x9dfb, 0xb5fe, 0xffdf, 0x41be, 0x53d6, 0x5436, 0x2910, /* Codes 50-59 */ + 0x3156, 0x7539, 0x39bb, 0x7c16, 0x95fb, 0x28ef, 0x653d, 0xe7bf, 0x188f, 0x397a, /* Codes 60-69 */ + 0x3977, 0x20d1, 0x8c7e, 0xe79f, 0x9e3b, 0x186e, 0x5416, 0x2930, 0x0801, 0x41de, /* Codes 70-79 */ + 0x313d, 0x3173, 0x7c36, 0x08e5, 0x549c, 0xd75f, 0x311c, 0x73d6, 0x3150, 0x315d, /* Codes 80-89 */ + 0x104e, 0x080e, 0x20f0, 0x2912, 0x54da, 0xdf3e, 0x5cfa, 0x3a1c, 0x425c, 0xcefe, /* Codes 90-99 */ + 0x4bd7, 0x843d, 0x2932, 0x3997, 0xf7df, 0x397d, 0x2936, 0x20ef, 0x315a, 0x20f1, /* Codes 100-109 */ + 0x0005, 0xd75e, 0x53fa, 0x290f, 0x214b, 0x20cf, 0x4bf6, 0x2919, 0x3212, 0x9ebd, /* Codes 110-119 */ + 0x28fc, 0x5415, 0x399d, 0x73d5, 0x0804, 0x3187, 0x328d, 0x2a2b, 0x7559, 0xe77f, /* Codes 120-129 */ + 0xb61c, 0x3186, 0xa598, 0xbebd, 0x73d0, 0x84d5, 0x5cb7, 0x2916, 0x20ce, 0x3a35, /* Codes 130-139 */ + 0x53fc /* Codes 140-140 */ +}; + +/* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used + * to lookup an 8-bit value. There is no savings in that! It would be better to just put + * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these + * pointless lookups. But these p;ointless lookups do make the logic compatible with the + * 16- and 24-bit types. + */ + +#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 8 +# ifdef CONFIG_EXAMPLES_NXIMAGE_GREYSCALE + +/* 8-bit Greyscale */ + +static const uint8_t g_lut[IMAGE_NLUTCODES] = +{ + 0x00, 0x19, 0x8b, 0x46, 0x4a, 0x0b, 0x8d, 0x41, 0x44, 0x27, 0x32, 0x92, 0x59, 0x34, 0x6d, 0xdb, /* Codes 0-15 */ + 0x3f, 0x26, 0x91, 0xec, 0xe5, 0x39, 0xb4, 0xc0, 0x62, 0xe6, 0x4c, 0x2f, 0x2e, 0x3c, 0xda, 0xe4, /* Codes 16-31 */ + 0x72, 0x86, 0xed, 0x1d, 0x35, 0xe2, 0xfc, 0xe3, 0x7d, 0x16, 0x97, 0x87, 0xee, 0xb2, 0x42, 0xbc, /* Codes 32-47 */ + 0xf6, 0x4b, 0x1c, 0x70, 0x90, 0x77, 0x2c, 0xdf, 0x96, 0x29, 0x45, 0x7f, 0x81, 0xb1, 0x28, 0xea, /* Codes 48-63 */ + 0x40, 0x3d, 0x23, 0x95, 0xe9, 0xd6, 0xb7, 0x2d, 0x02, 0x3a, 0x85, 0x17, 0x82, 0xe7, 0x7b, 0x33, /* Codes 64-79 */ + 0x0e, 0x25, 0x84, 0xe0, 0x8c, 0x4d, 0x56, 0x1e, 0x3b, 0x6e, 0x31, 0x3e, 0xf3, 0x1a, 0x20, 0x04, /* Codes 80-95 */ + 0xe1, 0x74, 0x2a, 0x79, 0x21, 0x71, 0xc4, 0x76, 0x48, 0x98, 0xf7, 0x94, 0xe8, 0xbe, 0xac, 0xc9, /* Codes 96-111 */ + 0x75, 0x8e, 0x49, 0x7a /* Codes 112-115 */ +}; + +# else /* CONFIG_EXAMPLES_NXIMAGE_GREYSCALE */ + +/* RGB8 (332) Colors */ + +static const nxgl_mxpixel_t g_lut[IMAGE_NLUTCODES] = +{ + 0x00, 0x25, 0x77, 0x4b, 0x01, 0x47, 0x26, 0x4a, 0x4f, 0x72, 0xdf, 0x93, 0xff, 0x27, 0xbb, 0xdb, /* Codes 0-15 */ + 0x6f, 0x29, 0x53, 0x97, 0x73, 0x22, 0x05, 0x02, 0x57, 0xbf, 0x4e /* Codes 16-26 */ +}; + +# endif +#else +# error "Unsupport pixel format" +#endif + +#if CONFIG_EXAMPLES_NXIMAGE_BPP == 24 + +static const struct pix_run_s g_nuttx[] = +{ + { 76, 0}, { 1, 1}, { 1, 2}, { 1, 3}, { 4, 4}, { 1, 5}, { 76, 0}, /* Row 0 */ + { 75, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 2, 7}, { 3, 4}, { 1, 5}, /* Row 1 */ + { 75, 0}, + { 74, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 9}, { 1, 10}, /* Row 2 */ + { 1, 7}, { 3, 4}, { 1, 5}, { 74, 0}, + { 73, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 12}, /* Row 3 */ + { 1, 13}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 73, 0}, + { 72, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 4 */ + { 1, 6}, { 1, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 72, 0}, + { 71, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 5 */ + { 1, 6}, { 3, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 71, 0}, + { 70, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 6 */ + { 1, 6}, { 5, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 70, 0}, + { 69, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 7 */ + { 1, 6}, { 7, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 69, 0}, + { 68, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 8 */ + { 1, 6}, { 9, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 68, 0}, + { 67, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 9 */ + { 1, 6}, { 11, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 67, 0}, + { 66, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 10 */ + { 1, 6}, { 13, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 66, 0}, + { 65, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 11 */ + { 1, 6}, { 15, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 65, 0}, + { 64, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 12 */ + { 1, 6}, { 17, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 64, 0}, + { 63, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 13 */ + { 1, 6}, { 19, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 63, 0}, + { 62, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 14 */ + { 1, 6}, { 21, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 62, 0}, + { 61, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 15 */ + { 1, 6}, { 23, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 61, 0}, + { 60, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 16 */ + { 1, 6}, { 25, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 60, 0}, + { 59, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 17 */ + { 1, 6}, { 27, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 59, 0}, + { 58, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 18 */ + { 1, 6}, { 29, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 26, 0}, + { 1, 17}, { 5, 18}, { 1, 17}, { 25, 0}, + { 57, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 19 */ + { 1, 6}, { 10, 4}, { 5, 19}, { 16, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, + { 1, 5}, { 23, 0}, { 1, 20}, { 1, 18}, { 1, 21}, { 5, 18}, { 1, 21}, { 1, 18}, + { 1, 20}, { 23, 0}, + { 56, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 20 */ + { 1, 6}, { 9, 4}, { 1, 19}, { 1, 22}, { 1, 23}, { 3, 24}, { 1, 23}, { 1, 22}, + { 1, 25}, { 15, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 22, 0}, + { 11, 18}, { 1, 20}, { 22, 0}, + { 23, 0}, { 1, 17}, { 5, 18}, { 1, 26}, { 25, 0}, { 1, 1}, { 1, 2}, { 1, 6}, /* Row 21 */ + { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 9, 4}, { 1, 19}, { 1, 27}, + { 1, 21}, { 5, 18}, { 1, 21}, { 1, 23}, { 1, 28}, { 15, 4}, { 1, 16}, { 1, 14}, + { 1, 7}, { 3, 4}, { 1, 5}, { 20, 0}, { 1, 17}, { 1, 21}, { 11, 18}, { 1, 20}, + { 21, 0}, + { 21, 0}, { 1, 20}, { 1, 18}, { 1, 21}, { 5, 18}, { 1, 21}, { 1, 18}, { 1, 20}, /* Row 22 */ + { 22, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, + { 1, 6}, { 9, 4}, { 1, 19}, { 1, 27}, { 1, 21}, { 8, 18}, { 1, 29}, { 1, 28}, + { 4, 7}, { 11, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 19, 0}, + { 14, 18}, { 21, 0}, + { 21, 0}, { 11, 18}, { 1, 20}, { 20, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, /* Row 23 */ + { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 10, 4}, { 1, 22}, { 1, 21}, { 10, 18}, + { 1, 30}, { 1, 31}, { 1, 32}, { 1, 33}, { 1, 34}, { 1, 35}, { 1, 7}, { 10, 4}, + { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 17, 0}, { 1, 17}, { 1, 21}, + { 4, 18}, { 1, 36}, { 2, 37}, { 1, 36}, { 4, 18}, { 1, 21}, { 1, 17}, { 20, 0}, + { 20, 0}, { 1, 38}, { 1, 21}, { 11, 18}, { 1, 39}, { 4, 40}, { 1, 41}, { 13, 0}, /* Row 24 */ + { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, + { 10, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 3, 36}, { 5, 18}, { 1, 42}, { 1, 43}, + { 3, 44}, { 1, 45}, { 1, 7}, { 10, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, + { 1, 5}, { 16, 0}, { 5, 18}, { 1, 37}, { 4, 46}, { 1, 37}, { 4, 18}, { 1, 47}, + { 1, 48}, { 1, 49}, { 18, 0}, + { 19, 0}, { 1, 17}, { 1, 21}, { 12, 18}, { 1, 50}, { 1, 48}, { 3, 40}, { 1, 51}, /* Row 25 */ + { 1, 40}, { 11, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, + { 1, 15}, { 1, 6}, { 11, 4}, { 1, 52}, { 1, 21}, { 3, 18}, { 1, 37}, { 3, 46}, + { 1, 37}, { 4, 18}, { 1, 21}, { 1, 53}, { 4, 44}, { 1, 45}, { 1, 7}, { 10, 4}, + { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 14, 0}, { 1, 17}, { 1, 21}, + { 3, 18}, { 1, 54}, { 6, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 55}, { 1, 40}, + { 1, 49}, { 17, 0}, + { 19, 0}, { 5, 18}, { 1, 54}, { 2, 56}, { 1, 37}, { 5, 18}, { 1, 21}, { 1, 57}, /* Row 26 */ + { 4, 40}, { 1, 51}, { 1, 41}, { 9, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, + { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 11, 4}, { 1, 58}, { 1, 59}, { 3, 18}, + { 1, 21}, { 1, 60}, { 4, 46}, { 1, 37}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, + { 1, 45}, { 1, 7}, { 10, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, + { 13, 0}, { 5, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 4, 18}, { 1, 57}, { 2, 40}, + { 1, 49}, { 16, 0}, + { 18, 0}, { 1, 17}, { 1, 21}, { 3, 18}, { 1, 37}, { 4, 46}, { 1, 37}, { 5, 18}, /* Row 27 */ + { 1, 50}, { 1, 48}, { 5, 40}, { 8, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, + { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 12, 4}, { 1, 19}, { 1, 24}, { 3, 18}, + { 1, 37}, { 6, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, + { 11, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 11, 0}, { 1, 17}, + { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 57}, { 3, 40}, + { 16, 0}, + { 18, 0}, { 4, 18}, { 1, 54}, { 5, 46}, { 1, 60}, { 1, 36}, { 4, 18}, { 1, 21}, /* Row 28 */ + { 1, 57}, { 4, 40}, { 1, 51}, { 1, 41}, { 6, 0}, { 1, 1}, { 1, 2}, { 1, 6}, + { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 13, 4}, { 1, 19}, { 1, 24}, + { 3, 18}, { 1, 61}, { 6, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, + { 1, 34}, { 1, 62}, { 11, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, + { 10, 0}, { 5, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 55}, + { 2, 40}, { 1, 51}, { 1, 41}, { 15, 0}, + { 18, 0}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, { 1, 50}, { 1, 48}, /* Row 29 */ + { 5, 40}, { 5, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, + { 1, 15}, { 1, 6}, { 14, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, + { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 12, 4}, { 1, 16}, + { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 8, 0}, { 1, 17}, { 1, 21}, { 3, 18}, + { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 4, 40}, { 15, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 57}, /* Row 30 */ + { 4, 40}, { 1, 51}, { 1, 41}, { 3, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, + { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 15, 4}, { 1, 19}, { 1, 24}, { 2, 18}, + { 1, 36}, { 8, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, + { 1, 62}, { 12, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 7, 0}, + { 5, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, + { 1, 63}, { 14, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 56}, { 5, 18}, { 1, 50}, { 1, 48}, /* Row 31 */ + { 5, 40}, { 2, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, + { 1, 15}, { 1, 6}, { 16, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 9, 46}, + { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 13, 4}, { 1, 16}, + { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 5, 0}, { 1, 17}, { 1, 21}, { 3, 18}, + { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 5, 40}, { 1, 41}, + { 14, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 9, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 57}, /* Row 32 */ + { 4, 40}, { 1, 51}, { 1, 41}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, + { 1, 11}, { 1, 15}, { 1, 6}, { 17, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, + { 9, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, + { 13, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 4, 0}, { 5, 18}, + { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, { 6, 40}, { 1, 63}, + { 14, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 9, 46}, { 1, 56}, { 5, 18}, { 1, 50}, { 1, 48}, /* Row 33 */ + { 3, 40}, { 1, 64}, { 1, 65}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, + { 1, 15}, { 1, 6}, { 18, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 10, 46}, + { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 14, 4}, { 1, 16}, + { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 2, 0}, { 1, 17}, { 1, 21}, { 3, 18}, + { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 15, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 10, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 57}, /* Row 34 */ + { 2, 40}, { 1, 64}, { 1, 66}, { 1, 67}, { 1, 68}, { 1, 4}, { 1, 8}, { 1, 11}, + { 1, 15}, { 1, 6}, { 19, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 10, 46}, + { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 14, 4}, + { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 1, 0}, { 5, 18}, { 1, 56}, + { 7, 46}, { 1, 54}, { 3, 18}, { 1, 69}, { 1, 70}, { 5, 40}, { 1, 51}, { 1, 41}, + { 15, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 10, 46}, { 1, 56}, { 5, 18}, { 1, 50}, { 1, 48}, /* Row 35 */ + { 1, 64}, { 1, 66}, { 1, 67}, { 1, 44}, { 1, 34}, { 1, 71}, { 1, 11}, { 1, 15}, + { 1, 6}, { 20, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 11, 46}, { 1, 54}, + { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 15, 4}, { 1, 16}, { 1, 14}, + { 1, 7}, { 3, 4}, { 1, 72}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, + { 4, 18}, { 1, 50}, { 1, 73}, { 6, 40}, { 16, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 11, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 57}, /* Row 36 */ + { 1, 74}, { 1, 67}, { 3, 44}, { 1, 75}, { 1, 76}, { 1, 6}, { 21, 4}, { 1, 19}, + { 1, 24}, { 2, 18}, { 1, 36}, { 11, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, + { 4, 44}, { 1, 34}, { 1, 62}, { 15, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 1, 4}, + { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, + { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 16, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 11, 46}, { 1, 56}, { 5, 18}, { 1, 77}, { 1, 78}, /* Row 37 */ + { 4, 44}, { 1, 79}, { 1, 80}, { 22, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, + { 12, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 16, 4}, + { 1, 16}, { 1, 14}, { 1, 7}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, + { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 17, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 12, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, /* Row 38 */ + { 5, 44}, { 1, 81}, { 22, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 12, 46}, + { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 16, 4}, + { 1, 16}, { 1, 82}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, + { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 17, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 12, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, /* Row 39 */ + { 4, 44}, { 1, 34}, { 1, 62}, { 21, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, + { 13, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 17, 4}, + { 1, 83}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, + { 1, 48}, { 6, 40}, { 18, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 13, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, /* Row 40 */ + { 5, 44}, { 1, 35}, { 21, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 13, 46}, + { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 15, 4}, + { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, + { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 18, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 13, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, /* Row 41 */ + { 4, 44}, { 1, 34}, { 1, 62}, { 20, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, + { 14, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 15, 4}, + { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, + { 1, 48}, { 6, 40}, { 19, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 14, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, /* Row 42 */ + { 5, 44}, { 1, 35}, { 20, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 14, 46}, + { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 13, 4}, + { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, + { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 19, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 14, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, /* Row 43 */ + { 4, 44}, { 1, 34}, { 1, 62}, { 19, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, + { 7, 46}, { 1, 61}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, + { 1, 35}, { 13, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, + { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 20, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 15, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, /* Row 44 */ + { 5, 44}, { 1, 35}, { 19, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, + { 1, 84}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, + { 1, 62}, { 11, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, + { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 20, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 61}, { 6, 46}, { 1, 56}, { 5, 18}, /* Row 45 */ + { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 18, 4}, { 1, 19}, { 1, 24}, + { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, + { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 11, 4}, { 1, 22}, { 1, 21}, { 3, 18}, + { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 21, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 84}, { 7, 46}, { 1, 54}, { 4, 18}, /* Row 46 */ + { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 18, 4}, { 1, 19}, { 1, 24}, { 2, 18}, + { 1, 36}, { 7, 46}, { 1, 36}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, + { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 9, 4}, { 1, 25}, { 1, 23}, { 4, 18}, + { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, + { 1, 41}, { 21, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 1, 56}, { 6, 46}, { 1, 56}, /* Row 47 */ + { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 17, 4}, { 1, 19}, + { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 18}, { 1, 56}, { 7, 46}, + { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 9, 4}, { 1, 22}, + { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, + { 6, 40}, { 22, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 1, 54}, { 7, 46}, { 1, 54}, /* Row 48 */ + { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 17, 4}, { 1, 19}, { 1, 24}, + { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 18}, { 1, 54}, { 7, 46}, { 1, 56}, + { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 7, 4}, { 1, 25}, + { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 85}, + { 1, 51}, { 4, 40}, { 1, 51}, { 1, 41}, { 22, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 1, 18}, { 1, 56}, { 6, 46}, /* Row 49 */ + { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 16, 4}, + { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 56}, + { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 7, 4}, + { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, + { 1, 86}, { 1, 66}, { 1, 64}, { 4, 40}, { 23, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 1, 18}, { 1, 54}, { 7, 46}, /* Row 50 */ + { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 16, 4}, { 1, 19}, + { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 54}, { 7, 46}, + { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 5, 4}, + { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, + { 1, 53}, { 1, 44}, { 1, 67}, { 1, 66}, { 1, 64}, { 1, 40}, { 1, 51}, { 1, 41}, + { 23, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 56}, { 6, 46}, /* Row 51 */ + { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 15, 4}, + { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 3, 18}, { 1, 56}, + { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 5, 4}, + { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, + { 1, 43}, { 2, 44}, { 1, 67}, { 1, 66}, { 1, 64}, { 1, 40}, { 24, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 54}, { 7, 46}, /* Row 52 */ + { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 15, 4}, { 1, 19}, + { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 3, 18}, { 1, 54}, { 7, 46}, + { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 3, 4}, + { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, + { 1, 53}, { 4, 44}, { 1, 67}, { 1, 87}, { 1, 41}, { 24, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 3, 18}, { 1, 56}, { 6, 46}, /* Row 53 */ + { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 14, 4}, + { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 4, 18}, { 1, 56}, + { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 3, 4}, + { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, + { 1, 43}, { 5, 44}, { 1, 88}, { 1, 89}, { 24, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 3, 18}, { 1, 54}, { 7, 46}, /* Row 54 */ + { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 14, 4}, { 1, 19}, + { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 4, 18}, { 1, 54}, { 7, 46}, + { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 1, 4}, + { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, + { 1, 53}, { 6, 44}, { 1, 90}, { 1, 62}, { 1, 5}, { 23, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 4, 18}, { 1, 56}, { 6, 46}, /* Row 55 */ + { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 13, 4}, + { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 5, 18}, { 1, 56}, + { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 1, 4}, + { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, + { 1, 43}, { 5, 44}, { 1, 33}, { 1, 91}, { 2, 4}, { 1, 5}, { 22, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 4, 18}, { 1, 54}, { 7, 46}, /* Row 56 */ + { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 13, 4}, { 1, 19}, + { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 5, 18}, { 1, 54}, { 7, 46}, + { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 92}, { 1, 23}, + { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, + { 1, 93}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 21, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 5, 18}, { 1, 56}, { 6, 46}, /* Row 57 */ + { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 12, 4}, + { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 6, 18}, { 1, 56}, + { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 94}, { 1, 21}, + { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, + { 1, 34}, { 1, 62}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 20, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 5, 18}, { 1, 54}, { 7, 46}, /* Row 58 */ + { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 12, 4}, { 1, 19}, + { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 6, 18}, { 1, 54}, { 7, 46}, + { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 3, 44}, { 1, 43}, { 1, 42}, { 4, 18}, + { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, + { 2, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 19, 0}, + { 17, 0}, { 1, 95}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 6, 18}, { 1, 56}, /* Row 59 */ + { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, + { 11, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 7, 18}, + { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 3, 44}, { 1, 53}, + { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, + { 5, 44}, { 1, 34}, { 1, 62}, { 3, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, + { 1, 5}, { 18, 0}, + { 16, 0}, { 1, 1}, { 1, 96}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, /* Row 60 */ + { 6, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, + { 1, 35}, { 11, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, + { 2, 18}, { 1, 21}, { 1, 47}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, + { 1, 42}, { 1, 43}, { 1, 44}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 7, 46}, + { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 5, 4}, { 1, 16}, + { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 17, 0}, + { 15, 0}, { 1, 1}, { 1, 2}, { 1, 97}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, /* Row 61 */ + { 1, 36}, { 7, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, + { 4, 44}, { 1, 34}, { 1, 62}, { 10, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, + { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 99}, { 1, 21}, { 3, 18}, { 1, 56}, + { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 1, 44}, { 1, 53}, { 1, 21}, + { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, + { 1, 34}, { 1, 62}, { 6, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, + { 16, 0}, + { 14, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, /* Row 62 */ + { 8, 46}, { 1, 36}, { 7, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, + { 1, 53}, { 5, 44}, { 1, 35}, { 10, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, + { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 100}, { 1, 42}, { 3, 18}, { 1, 54}, + { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 101}, { 1, 42}, { 4, 18}, { 1, 56}, + { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 8, 4}, + { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 15, 0}, + { 13, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 102}, { 1, 98}, { 2, 18}, /* Row 63 */ + { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 21}, { 1, 47}, { 4, 18}, { 1, 56}, + { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, + { 9, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, + { 1, 98}, { 1, 103}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, + { 3, 18}, { 1, 21}, { 1, 98}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, + { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, { 1, 62}, { 9, 4}, { 1, 16}, + { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 14, 0}, + { 12, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 105}, { 1, 106}, /* Row 64 */ + { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 99}, { 1, 21}, + { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, + { 1, 35}, { 9, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, + { 2, 18}, { 1, 98}, { 1, 103}, { 1, 43}, { 1, 42}, { 3, 18}, { 1, 54}, { 7, 46}, + { 1, 56}, { 9, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, + { 6, 44}, { 1, 35}, { 11, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, + { 13, 0}, + { 11, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 108}, /* Row 65 */ + { 1, 29}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 100}, + { 1, 42}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, + { 4, 44}, { 1, 34}, { 1, 62}, { 8, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, + { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 1, 44}, { 1, 53}, { 1, 21}, + { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 7, 18}, { 1, 54}, { 7, 46}, { 1, 56}, + { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, { 1, 62}, { 12, 4}, { 1, 16}, + { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 12, 0}, + { 10, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 66 */ + { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, + { 1, 103}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18}, + { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 8, 4}, { 1, 19}, { 1, 24}, { 2, 18}, + { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 1, 44}, { 1, 43}, + { 1, 42}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 7, 18}, { 1, 56}, { 7, 46}, + { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 14, 4}, { 1, 16}, + { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 11, 0}, + { 9, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 67 */ + { 1, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, + { 1, 98}, { 1, 103}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, + { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 7, 4}, { 1, 19}, + { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, + { 2, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 5, 18}, + { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, + { 1, 62}, { 15, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 10, 0}, + { 8, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 68 */ + { 2, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, + { 1, 98}, { 1, 103}, { 1, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, + { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 7, 4}, { 1, 19}, + { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, + { 2, 44}, { 1, 43}, { 1, 42}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 5, 18}, + { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, + { 17, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 9, 0}, + { 7, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 69 */ + { 3, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, + { 1, 98}, { 1, 103}, { 1, 44}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 6, 46}, + { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 6, 4}, + { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, + { 1, 103}, { 3, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, + { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, + { 1, 34}, { 1, 62}, { 18, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, + { 8, 0}, + { 6, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 70 */ + { 4, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, + { 1, 98}, { 1, 103}, { 2, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, + { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 6, 4}, { 1, 19}, + { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, + { 3, 44}, { 1, 43}, { 1, 42}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 3, 18}, + { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, + { 20, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 7, 0}, + { 5, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 71 */ + { 5, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, + { 1, 98}, { 1, 103}, { 2, 44}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 6, 46}, + { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 5, 4}, + { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, + { 1, 103}, { 4, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, + { 1, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, + { 1, 34}, { 1, 62}, { 21, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, + { 6, 0}, + { 4, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 72 */ + { 6, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, + { 1, 98}, { 1, 103}, { 3, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, + { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 5, 4}, { 1, 19}, + { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, + { 4, 44}, { 1, 43}, { 1, 42}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 1, 18}, + { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, + { 23, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 5, 0}, + { 3, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 73 */ + { 7, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, + { 1, 98}, { 1, 103}, { 3, 44}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 6, 46}, + { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 4, 4}, + { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, + { 1, 103}, { 5, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 110}, + { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, { 1, 62}, + { 24, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 4, 0}, + { 2, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 74 */ + { 8, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, + { 1, 98}, { 1, 103}, { 4, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, + { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 4, 4}, { 1, 19}, + { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, + { 5, 44}, { 1, 43}, { 1, 111}, { 3, 18}, { 1, 54}, { 15, 46}, { 1, 54}, { 3, 18}, + { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 26, 4}, { 1, 16}, { 1, 14}, { 1, 7}, + { 2, 4}, { 1, 5}, { 3, 0}, + { 1, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 75 */ + { 9, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, + { 1, 98}, { 1, 103}, { 4, 44}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 6, 46}, + { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 3, 4}, + { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, + { 1, 103}, { 5, 44}, { 1, 32}, { 1, 83}, { 1, 21}, { 3, 18}, { 1, 56}, { 13, 46}, + { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, { 1, 62}, { 27, 4}, + { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 2, 0}, + { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, { 10, 4}, /* Row 76 */ + { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, + { 1, 103}, { 5, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, + { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 3, 4}, { 1, 19}, { 1, 24}, + { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, + { 1, 33}, { 1, 112}, { 1, 23}, { 3, 18}, { 1, 54}, { 13, 46}, { 1, 54}, { 3, 18}, + { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 29, 4}, { 1, 16}, { 1, 14}, { 1, 7}, + { 2, 4}, { 1, 5}, { 1, 0}, + { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, { 11, 4}, { 1, 19}, /* Row 77 */ + { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, + { 5, 44}, { 1, 43}, { 1, 111}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, + { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 2, 4}, { 1, 19}, { 1, 24}, + { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, + { 1, 33}, { 1, 7}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 56}, { 11, 46}, { 1, 56}, + { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, { 1, 62}, { 30, 4}, { 1, 16}, + { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, + { 1, 3}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, { 12, 4}, { 1, 19}, { 1, 24}, /* Row 78 */ + { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, + { 1, 32}, { 1, 83}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18}, + { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 2, 4}, { 1, 19}, { 1, 24}, { 2, 18}, + { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, + { 1, 7}, { 1, 25}, { 1, 23}, { 3, 18}, { 1, 54}, { 11, 46}, { 1, 54}, { 3, 18}, + { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 32, 4}, { 1, 16}, { 1, 14}, { 1, 7}, + { 2, 4}, + { 1, 4}, { 1, 113}, { 1, 114}, { 1, 115}, { 13, 4}, { 1, 19}, { 1, 24}, { 2, 18}, /* Row 79 */ + { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, + { 1, 112}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, + { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 1, 4}, { 1, 19}, { 1, 24}, { 2, 18}, + { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, + { 1, 7}, { 1, 4}, { 1, 116}, { 4, 18}, { 1, 56}, { 9, 46}, { 1, 61}, { 4, 18}, + { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, { 1, 62}, { 33, 4}, { 1, 16}, { 1, 14}, + { 1, 62}, { 1, 4}, + { 1, 4}, { 1, 7}, { 1, 117}, { 1, 8}, { 13, 4}, { 1, 19}, { 1, 24}, { 2, 18}, /* Row 80 */ + { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, + { 1, 7}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18}, + { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 1, 4}, { 1, 19}, { 1, 24}, { 2, 18}, + { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, + { 1, 7}, { 1, 4}, { 1, 116}, { 4, 18}, { 1, 54}, { 9, 46}, { 1, 37}, { 3, 18}, + { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 35, 4}, { 1, 118}, { 1, 119}, { 1, 7}, + { 2, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 12, 4}, { 1, 19}, { 1, 24}, { 2, 18}, /* Row 81 */ + { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, + { 1, 7}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, + { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 1, 19}, { 1, 24}, { 2, 18}, + { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, + { 1, 7}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 8, 46}, { 1, 60}, { 1, 21}, + { 3, 18}, { 1, 98}, { 1, 120}, { 5, 44}, { 1, 33}, { 1, 62}, { 34, 4}, { 1, 8}, + { 1, 11}, { 1, 76}, { 1, 3}, + { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 11, 4}, { 1, 19}, { 1, 24}, { 2, 18}, /* Row 82 */ + { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, + { 1, 7}, { 1, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, + { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 1, 121}, { 1, 24}, { 2, 18}, + { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, + { 1, 7}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 10, 46}, { 1, 54}, { 3, 18}, + { 1, 21}, { 1, 53}, { 5, 44}, { 1, 33}, { 1, 62}, { 33, 4}, { 1, 8}, { 1, 11}, + { 1, 15}, { 1, 6}, { 1, 4}, + { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 10, 4}, { 1, 19}, { 1, 24}, /* Row 83 */ + { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, + { 1, 33}, { 1, 7}, { 1, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, + { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 122}, { 1, 24}, + { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, + { 1, 33}, { 1, 112}, { 1, 23}, { 4, 18}, { 1, 56}, { 10, 46}, { 1, 56}, { 4, 18}, + { 1, 42}, { 1, 43}, { 5, 44}, { 1, 35}, { 32, 4}, { 1, 8}, { 1, 11}, { 1, 15}, + { 1, 6}, { 1, 4}, { 1, 5}, + { 1, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 9, 4}, { 1, 19}, /* Row 84 */ + { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, + { 5, 44}, { 1, 33}, { 1, 7}, { 2, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, + { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 123}, { 1, 24}, + { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, + { 1, 32}, { 1, 83}, { 1, 21}, { 3, 18}, { 1, 54}, { 12, 46}, { 1, 54}, { 3, 18}, + { 1, 21}, { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, { 30, 4}, { 1, 8}, { 1, 11}, + { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 1, 0}, + { 2, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 8, 4}, { 1, 19}, /* Row 85 */ + { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, + { 5, 44}, { 1, 33}, { 1, 7}, { 2, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, + { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 124}, { 1, 98}, + { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, + { 1, 43}, { 1, 111}, { 4, 18}, { 1, 56}, { 12, 46}, { 1, 56}, { 4, 18}, { 1, 42}, + { 1, 43}, { 5, 44}, { 1, 35}, { 29, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, + { 1, 4}, { 1, 5}, { 2, 0}, + { 3, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 7, 4}, { 1, 19}, /* Row 86 */ + { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, + { 5, 44}, { 1, 33}, { 1, 7}, { 3, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, + { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 4, 44}, { 1, 103}, { 1, 98}, + { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, + { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 14, 46}, { 1, 54}, { 3, 18}, { 1, 21}, + { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, { 27, 4}, { 1, 8}, { 1, 11}, { 1, 15}, + { 1, 6}, { 1, 4}, { 1, 5}, { 3, 0}, + { 4, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 6, 4}, { 1, 19}, /* Row 87 */ + { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, + { 5, 44}, { 1, 33}, { 1, 7}, { 3, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, + { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 3, 44}, { 1, 103}, { 1, 98}, + { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 4, 44}, + { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 14, 46}, { 1, 56}, { 4, 18}, { 1, 42}, + { 1, 43}, { 5, 44}, { 1, 35}, { 26, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, + { 1, 4}, { 1, 5}, { 4, 0}, + { 5, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 5, 4}, { 1, 19}, /* Row 88 */ + { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, + { 5, 44}, { 1, 33}, { 1, 7}, { 4, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, + { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 3, 44}, { 1, 103}, { 1, 98}, + { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 4, 44}, + { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 16, 46}, { 1, 54}, { 3, 18}, { 1, 21}, + { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, { 24, 4}, { 1, 8}, { 1, 11}, { 1, 15}, + { 1, 6}, { 1, 4}, { 1, 5}, { 5, 0}, + { 6, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 4, 4}, { 1, 19}, /* Row 89 */ + { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, + { 5, 44}, { 1, 33}, { 1, 7}, { 4, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, + { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 2, 44}, { 1, 103}, { 1, 98}, + { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 3, 44}, + { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 56}, { 1, 54}, { 7, 46}, + { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 35}, { 23, 4}, { 1, 8}, + { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 6, 0}, + { 7, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 3, 4}, { 1, 19}, /* Row 90 */ + { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, + { 5, 44}, { 1, 33}, { 1, 7}, { 5, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, + { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 2, 44}, { 1, 103}, { 1, 98}, + { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 3, 44}, + { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 8, 46}, { 1, 54}, { 1, 18}, { 1, 56}, + { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, + { 21, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 7, 0}, + { 8, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 2, 4}, { 1, 19}, /* Row 91 */ + { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, + { 5, 44}, { 1, 33}, { 1, 7}, { 5, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, + { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 1, 44}, { 1, 103}, { 1, 98}, + { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 2, 44}, + { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 56}, { 2, 18}, { 1, 54}, + { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 35}, { 20, 4}, + { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 8, 0}, + { 9, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 1, 4}, { 1, 19}, /* Row 92 */ + { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, + { 5, 44}, { 1, 33}, { 1, 7}, { 6, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, + { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 1, 44}, { 1, 103}, { 1, 98}, + { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 2, 44}, + { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 8, 46}, { 1, 54}, { 3, 18}, { 1, 56}, + { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, + { 18, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 9, 0}, + { 10, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 1, 121}, { 1, 24}, /* Row 93 */ + { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, + { 1, 33}, { 1, 7}, { 6, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, + { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 1, 103}, { 1, 98}, { 2, 18}, { 1, 36}, + { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 1, 44}, { 1, 43}, { 1, 42}, + { 4, 18}, { 1, 56}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 54}, { 7, 46}, { 1, 56}, + { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 35}, { 17, 4}, { 1, 8}, { 1, 11}, + { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 10, 0}, + { 11, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 125}, { 1, 24}, { 2, 18}, /* Row 94 */ + { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, + { 1, 7}, { 7, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, + { 4, 18}, { 1, 21}, { 1, 53}, { 1, 103}, { 1, 98}, { 2, 18}, { 1, 36}, { 7, 46}, + { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 1, 44}, { 1, 53}, { 1, 21}, { 3, 18}, + { 1, 54}, { 8, 46}, { 1, 54}, { 5, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, + { 1, 21}, { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, { 15, 4}, { 1, 8}, { 1, 11}, + { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 11, 0}, + { 12, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 126}, { 1, 98}, { 2, 18}, { 1, 36}, /* Row 95 */ + { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, { 1, 7}, + { 7, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, + { 1, 42}, { 1, 100}, { 1, 98}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, + { 1, 98}, { 1, 103}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 56}, + { 6, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, + { 1, 35}, { 14, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, + { 12, 0}, + { 13, 0}, { 1, 5}, { 3, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, /* Row 96 */ + { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, { 1, 7}, { 8, 4}, + { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, + { 1, 99}, { 1, 98}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, + { 1, 103}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 8, 46}, { 1, 54}, { 7, 18}, + { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 34}, + { 1, 62}, { 12, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, + { 13, 0}, + { 14, 0}, { 1, 5}, { 2, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, /* Row 97 */ + { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, { 1, 7}, { 8, 4}, + { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, { 1, 47}, + { 1, 21}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 100}, + { 1, 42}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 47}, { 1, 21}, + { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, + { 1, 35}, { 11, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, + { 14, 0}, + { 15, 0}, { 1, 5}, { 1, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, /* Row 98 */ + { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, { 1, 7}, { 9, 4}, + { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 8, 18}, { 1, 36}, + { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 99}, { 1, 21}, { 3, 18}, { 1, 54}, + { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 127}, { 1, 42}, { 3, 18}, { 1, 56}, + { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, + { 9, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 15, 0}, + { 16, 0}, { 1, 5}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, /* Row 99 */ + { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, { 1, 7}, { 9, 4}, { 1, 25}, + { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 8, 18}, { 1, 36}, { 7, 46}, + { 1, 36}, { 2, 18}, { 1, 21}, { 1, 47}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 56}, + { 4, 18}, { 1, 42}, { 1, 43}, { 1, 53}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, + { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 35}, { 8, 4}, { 1, 8}, + { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 16, 0}, + { 17, 0}, { 1, 128}, { 1, 129}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, /* Row 100 */ + { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, { 1, 7}, { 10, 4}, { 1, 22}, { 1, 21}, + { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 7, 18}, { 1, 36}, { 7, 46}, { 1, 36}, + { 7, 18}, { 1, 54}, { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 1, 44}, + { 1, 43}, { 1, 42}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, + { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, { 6, 4}, { 1, 8}, { 1, 11}, { 1, 15}, + { 1, 6}, { 1, 4}, { 1, 5}, { 17, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 101 */ + { 5, 44}, { 1, 33}, { 1, 7}, { 10, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, + { 6, 46}, { 1, 56}, { 7, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 7, 18}, { 1, 56}, + { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 2, 44}, { 1, 53}, { 1, 21}, + { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, + { 1, 35}, { 5, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, + { 18, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 102 */ + { 5, 44}, { 1, 33}, { 1, 7}, { 11, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, + { 7, 46}, { 1, 54}, { 6, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 6, 18}, { 1, 54}, + { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 3, 44}, { 1, 43}, { 1, 42}, + { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, + { 1, 34}, { 1, 62}, { 3, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, + { 1, 5}, { 19, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 103 */ + { 5, 44}, { 1, 33}, { 1, 7}, { 11, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, + { 6, 46}, { 1, 56}, { 6, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 6, 18}, { 1, 56}, + { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 53}, { 1, 21}, + { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, + { 1, 35}, { 2, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, + { 20, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 104 */ + { 5, 44}, { 1, 33}, { 1, 7}, { 12, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, + { 7, 46}, { 1, 54}, { 5, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 5, 18}, { 1, 54}, + { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 43}, { 1, 42}, + { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, + { 1, 34}, { 1, 62}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, + { 21, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 105 */ + { 5, 44}, { 1, 33}, { 1, 7}, { 12, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, + { 6, 46}, { 1, 56}, { 5, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 5, 18}, { 1, 56}, + { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 94}, { 1, 21}, + { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, + { 1, 93}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 22, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 106 */ + { 5, 44}, { 1, 33}, { 1, 7}, { 13, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, + { 7, 46}, { 1, 54}, { 4, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 4, 18}, { 1, 54}, + { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 92}, + { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, + { 5, 44}, { 1, 88}, { 1, 130}, { 1, 6}, { 1, 4}, { 1, 5}, { 23, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 107 */ + { 5, 44}, { 1, 33}, { 1, 7}, { 13, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, + { 6, 46}, { 1, 56}, { 4, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 4, 18}, { 1, 56}, + { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 1, 4}, + { 1, 22}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, + { 1, 43}, { 5, 44}, { 1, 131}, { 1, 7}, { 1, 5}, { 24, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 108 */ + { 5, 44}, { 1, 33}, { 1, 7}, { 14, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, + { 7, 46}, { 1, 54}, { 3, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 3, 18}, { 1, 54}, + { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, + { 1, 4}, { 1, 25}, { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, + { 1, 21}, { 1, 53}, { 4, 44}, { 1, 67}, { 1, 132}, { 1, 133}, { 25, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 109 */ + { 5, 44}, { 1, 33}, { 1, 7}, { 14, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, + { 6, 46}, { 1, 56}, { 3, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 3, 18}, { 1, 56}, + { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 3, 4}, + { 1, 22}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, + { 1, 43}, { 2, 44}, { 1, 67}, { 1, 66}, { 1, 64}, { 1, 40}, { 25, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 110 */ + { 5, 44}, { 1, 33}, { 1, 7}, { 15, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, + { 7, 46}, { 1, 54}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 54}, + { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, + { 3, 4}, { 1, 25}, { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, + { 1, 21}, { 1, 53}, { 1, 44}, { 1, 67}, { 1, 66}, { 1, 64}, { 1, 40}, { 1, 51}, + { 1, 41}, { 24, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 111 */ + { 5, 44}, { 1, 33}, { 1, 7}, { 15, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, + { 6, 46}, { 1, 56}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 56}, + { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 5, 4}, + { 1, 22}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, + { 1, 86}, { 1, 66}, { 1, 64}, { 4, 40}, { 24, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 112 */ + { 5, 44}, { 1, 33}, { 1, 7}, { 16, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, + { 7, 46}, { 1, 54}, { 1, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 18}, { 1, 54}, + { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, + { 5, 4}, { 1, 25}, { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, + { 1, 21}, { 1, 85}, { 1, 51}, { 4, 40}, { 1, 51}, { 1, 41}, { 23, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 113 */ + { 5, 44}, { 1, 33}, { 1, 7}, { 16, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, + { 6, 46}, { 1, 56}, { 1, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 18}, { 1, 56}, + { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 7, 4}, + { 1, 22}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, + { 1, 48}, { 6, 40}, { 23, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 114 */ + { 5, 44}, { 1, 33}, { 1, 7}, { 17, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, + { 7, 46}, { 1, 54}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 54}, { 8, 46}, { 1, 54}, + { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 7, 4}, { 1, 25}, + { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, + { 5, 40}, { 1, 51}, { 1, 41}, { 22, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 115 */ + { 5, 44}, { 1, 33}, { 1, 7}, { 17, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, + { 6, 46}, { 1, 56}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 56}, { 7, 46}, { 1, 56}, + { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 9, 4}, { 1, 22}, { 1, 21}, + { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, + { 22, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 134}, /* Row 116 */ + { 5, 44}, { 1, 33}, { 1, 7}, { 18, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, + { 7, 46}, { 1, 84}, { 7, 46}, { 1, 84}, { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, + { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 9, 4}, { 1, 25}, { 1, 23}, { 3, 18}, + { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, + { 1, 41}, { 21, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 135}, /* Row 117 */ + { 1, 67}, { 4, 44}, { 1, 33}, { 1, 7}, { 18, 4}, { 1, 25}, { 1, 23}, { 4, 18}, + { 1, 56}, { 6, 46}, { 1, 61}, { 7, 46}, { 1, 61}, { 7, 46}, { 1, 56}, { 4, 18}, + { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 11, 4}, { 1, 22}, { 1, 21}, { 2, 18}, + { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 21, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 118 */ + { 1, 66}, { 1, 67}, { 3, 44}, { 1, 79}, { 1, 136}, { 19, 4}, { 1, 22}, { 1, 21}, + { 3, 18}, { 1, 54}, { 22, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, + { 1, 34}, { 1, 62}, { 11, 4}, { 1, 25}, { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, + { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 20, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 119 */ + { 1, 64}, { 1, 66}, { 1, 67}, { 2, 44}, { 1, 79}, { 1, 45}, { 1, 16}, { 18, 4}, + { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 20, 46}, { 1, 56}, { 4, 18}, { 1, 42}, + { 1, 43}, { 6, 44}, { 1, 35}, { 13, 4}, { 1, 22}, { 1, 21}, { 2, 18}, { 1, 54}, + { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 20, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 120 */ + { 1, 40}, { 1, 64}, { 1, 66}, { 1, 67}, { 1, 44}, { 1, 33}, { 1, 137}, { 1, 14}, + { 1, 16}, { 18, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 20, 46}, { 1, 54}, + { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 13, 4}, { 1, 138}, + { 1, 139}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, + { 5, 40}, { 1, 51}, { 1, 41}, { 19, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 121 */ + { 2, 40}, { 1, 64}, { 1, 66}, { 1, 67}, { 1, 33}, { 2, 7}, { 1, 14}, { 1, 16}, + { 17, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 18, 46}, { 1, 56}, { 4, 18}, + { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 13, 4}, { 1, 8}, { 1, 140}, { 1, 141}, + { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, + { 6, 40}, { 19, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 122 */ + { 3, 40}, { 1, 64}, { 1, 66}, { 1, 131}, { 1, 7}, { 1, 4}, { 1, 7}, { 1, 14}, + { 1, 16}, { 17, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 18, 46}, { 1, 54}, + { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 12, 4}, { 1, 8}, + { 1, 11}, { 1, 15}, { 1, 142}, { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, + { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 18, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 123 */ + { 4, 40}, { 1, 64}, { 1, 143}, { 1, 144}, { 2, 4}, { 1, 7}, { 1, 14}, { 1, 16}, + { 16, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 16, 46}, { 1, 56}, { 4, 18}, + { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 12, 4}, { 1, 8}, { 1, 11}, { 1, 15}, + { 1, 6}, { 1, 4}, { 1, 145}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, + { 1, 50}, { 1, 48}, { 6, 40}, { 18, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 124 */ + { 5, 40}, { 1, 64}, { 1, 146}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 16, 4}, + { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 16, 46}, { 1, 54}, { 3, 18}, { 1, 21}, + { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 11, 4}, { 1, 8}, { 1, 11}, { 1, 15}, + { 1, 6}, { 1, 4}, { 1, 5}, { 1, 147}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, + { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 17, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 125 */ + { 6, 40}, { 1, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 15, 4}, + { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 14, 46}, { 1, 56}, { 4, 18}, { 1, 42}, + { 1, 43}, { 6, 44}, { 1, 35}, { 11, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, + { 1, 4}, { 1, 5}, { 2, 0}, { 1, 17}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, + { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 17, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 126 */ + { 6, 40}, { 2, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 15, 4}, + { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 14, 46}, { 1, 54}, { 3, 18}, { 1, 21}, + { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 10, 4}, { 1, 8}, { 1, 11}, { 1, 15}, + { 1, 6}, { 1, 4}, { 1, 5}, { 4, 0}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, + { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 16, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 127 */ + { 6, 40}, { 3, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 14, 4}, + { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 12, 46}, { 1, 56}, { 4, 18}, { 1, 42}, + { 1, 43}, { 6, 44}, { 1, 35}, { 10, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, + { 1, 4}, { 1, 5}, { 5, 0}, { 1, 17}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, + { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 16, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 128 */ + { 6, 40}, { 4, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 14, 4}, + { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 12, 46}, { 1, 54}, { 3, 18}, { 1, 21}, + { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 9, 4}, { 1, 8}, { 1, 11}, { 1, 15}, + { 1, 6}, { 1, 4}, { 1, 5}, { 7, 0}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, + { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 15, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 129 */ + { 6, 40}, { 5, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 13, 4}, + { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 10, 46}, { 1, 56}, { 4, 18}, { 1, 42}, + { 1, 43}, { 6, 44}, { 1, 35}, { 9, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, + { 1, 4}, { 1, 5}, { 8, 0}, { 1, 17}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, + { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 15, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 130 */ + { 6, 40}, { 6, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 13, 4}, + { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 10, 46}, { 1, 54}, { 3, 18}, { 1, 21}, + { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 8, 4}, { 1, 8}, { 1, 11}, { 1, 15}, + { 1, 6}, { 1, 4}, { 1, 5}, { 10, 0}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, + { 3, 18}, { 1, 21}, { 1, 55}, { 5, 40}, { 1, 51}, { 1, 148}, { 14, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 131 */ + { 6, 40}, { 7, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 12, 4}, + { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 8, 46}, { 1, 56}, { 4, 18}, { 1, 42}, + { 1, 43}, { 6, 44}, { 1, 35}, { 8, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, + { 1, 4}, { 1, 5}, { 11, 0}, { 1, 17}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, + { 1, 56}, { 4, 18}, { 1, 57}, { 6, 40}, { 1, 149}, { 14, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 132 */ + { 6, 40}, { 8, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 12, 4}, + { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, + { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 7, 4}, { 1, 8}, { 1, 11}, { 1, 15}, + { 1, 6}, { 1, 4}, { 1, 5}, { 13, 0}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, + { 4, 18}, { 1, 57}, { 7, 40}, { 14, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 133 */ + { 6, 40}, { 9, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 11, 4}, + { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 4, 18}, { 1, 42}, + { 1, 43}, { 6, 44}, { 1, 35}, { 7, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, + { 1, 4}, { 1, 5}, { 14, 0}, { 1, 17}, { 1, 21}, { 2, 18}, { 1, 54}, { 6, 46}, + { 1, 56}, { 3, 18}, { 1, 69}, { 1, 150}, { 6, 40}, { 1, 51}, { 1, 148}, { 13, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 134 */ + { 6, 40}, { 10, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 11, 4}, + { 1, 22}, { 1, 21}, { 3, 18}, { 1, 36}, { 1, 151}, { 4, 46}, { 1, 151}, { 1, 36}, + { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 6, 4}, { 1, 8}, + { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 16, 0}, { 4, 18}, { 1, 56}, + { 5, 46}, { 1, 54}, { 3, 18}, { 1, 50}, { 1, 73}, { 7, 40}, { 1, 41}, { 13, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 135 */ + { 6, 40}, { 11, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 10, 4}, + { 1, 25}, { 1, 23}, { 4, 18}, { 1, 36}, { 1, 56}, { 2, 46}, { 1, 56}, { 1, 36}, + { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 6, 4}, { 1, 8}, { 1, 11}, + { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 17, 0}, { 1, 17}, { 1, 21}, { 2, 18}, + { 1, 36}, { 1, 56}, { 2, 46}, { 1, 56}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, + { 8, 40}, { 1, 41}, { 13, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 136 */ + { 6, 40}, { 12, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 10, 4}, + { 1, 22}, { 1, 21}, { 5, 18}, { 2, 36}, { 5, 18}, { 1, 21}, { 1, 53}, { 6, 44}, + { 1, 34}, { 1, 62}, { 5, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, + { 1, 5}, { 19, 0}, { 5, 18}, { 2, 36}, { 5, 18}, { 1, 50}, { 1, 48}, { 8, 40}, + { 1, 63}, { 13, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 137 */ + { 6, 40}, { 13, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 9, 4}, + { 1, 25}, { 1, 23}, { 12, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 5, 4}, + { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 20, 0}, { 1, 17}, + { 1, 21}, { 9, 18}, { 1, 47}, { 1, 70}, { 9, 40}, { 14, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 138 */ + { 6, 40}, { 14, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 9, 4}, + { 1, 22}, { 1, 21}, { 10, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, + { 4, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 22, 0}, + { 9, 18}, { 1, 47}, { 1, 70}, { 8, 40}, { 1, 51}, { 1, 41}, { 14, 0}, + { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 69}, { 2, 47}, { 1, 152}, { 1, 73}, /* Row 139 */ + { 6, 40}, { 15, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 8, 4}, + { 1, 19}, { 1, 27}, { 1, 21}, { 8, 18}, { 1, 21}, { 1, 153}, { 1, 103}, { 6, 44}, + { 1, 35}, { 4, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, + { 23, 0}, { 1, 147}, { 1, 154}, { 1, 18}, { 1, 21}, { 2, 18}, { 1, 21}, { 1, 47}, + { 1, 155}, { 1, 150}, { 10, 40}, { 15, 0}, + { 25, 0}, { 5, 48}, { 4, 73}, { 7, 40}, { 16, 0}, { 1, 5}, { 3, 4}, { 1, 7}, /* Row 140 */ + { 1, 14}, { 1, 16}, { 8, 4}, { 1, 19}, { 1, 22}, { 1, 23}, { 1, 21}, { 4, 18}, + { 1, 21}, { 1, 42}, { 1, 53}, { 1, 103}, { 6, 44}, { 1, 34}, { 1, 62}, { 3, 4}, + { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 27, 0}, { 1, 156}, + { 1, 17}, { 1, 157}, { 1, 55}, { 1, 48}, { 1, 64}, { 9, 40}, { 1, 51}, { 1, 41}, + { 15, 0}, + { 25, 0}, { 16, 40}, { 17, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, /* Row 141 */ + { 9, 4}, { 1, 25}, { 1, 22}, { 1, 158}, { 2, 98}, { 1, 77}, { 1, 53}, { 1, 43}, + { 7, 44}, { 1, 33}, { 1, 136}, { 3, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, + { 1, 4}, { 1, 5}, { 30, 0}, { 1, 63}, { 11, 40}, { 1, 51}, { 1, 40}, { 16, 0}, + { 25, 0}, { 16, 40}, { 18, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, /* Row 142 */ + { 10, 4}, { 1, 19}, { 1, 159}, { 1, 160}, { 1, 103}, { 7, 44}, { 1, 79}, { 1, 161}, + { 1, 136}, { 3, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, + { 32, 0}, { 1, 41}, { 1, 51}, { 8, 40}, { 1, 51}, { 1, 40}, { 17, 0}, + { 25, 0}, { 16, 40}, { 19, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, /* Row 143 */ + { 11, 4}, { 1, 62}, { 1, 35}, { 1, 34}, { 5, 33}, { 1, 161}, { 1, 136}, { 1, 7}, + { 3, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 34, 0}, + { 8, 40}, { 1, 51}, { 1, 40}, { 18, 0}, + { 25, 0}, { 16, 40}, { 20, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, /* Row 144 */ + { 12, 4}, { 7, 7}, { 4, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, + { 1, 5}, { 35, 0}, { 1, 49}, { 7, 40}, { 1, 41}, { 19, 0}, + { 25, 0}, { 16, 40}, { 21, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, /* Row 145 */ + { 21, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 64, 0}, + { 25, 0}, { 16, 40}, { 22, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, /* Row 146 */ + { 19, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 65, 0}, + { 64, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 17, 4}, { 1, 8}, /* Row 147 */ + { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 66, 0}, + { 65, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 15, 4}, { 1, 8}, /* Row 148 */ + { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 67, 0}, + { 66, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 13, 4}, { 1, 8}, /* Row 149 */ + { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 68, 0}, + { 67, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 11, 4}, { 1, 8}, /* Row 150 */ + { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 69, 0}, + { 68, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 9, 4}, { 1, 8}, /* Row 151 */ + { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 70, 0}, + { 69, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 7, 4}, { 1, 8}, /* Row 152 */ + { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 71, 0}, + { 70, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 5, 4}, { 1, 8}, /* Row 153 */ + { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 72, 0}, + { 71, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 3, 4}, { 1, 8}, /* Row 154 */ + { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 73, 0}, + { 72, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 1, 4}, { 1, 8}, /* Row 155 */ + { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 74, 0}, + { 73, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 118}, { 1, 11}, { 1, 15}, /* Row 156 */ + { 1, 6}, { 1, 4}, { 1, 5}, { 75, 0}, + { 74, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 162}, { 1, 15}, { 1, 6}, { 1, 4}, /* Row 157 */ + { 1, 5}, { 76, 0}, + { 75, 0}, { 1, 5}, { 2, 4}, { 1, 3}, { 1, 163}, { 1, 6}, { 1, 4}, { 1, 5}, /* Row 158 */ + { 77, 0}, + { 76, 0}, { 1, 5}, { 4, 4}, { 1, 5}, { 78, 0} /* Row 159 */ + }; + +#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 16 + +static const struct pix_run_s g_nuttx[] = +{ + { 76, 0}, { 1, 1}, { 1, 2}, { 1, 3}, { 4, 4}, { 1, 5}, { 76, 0}, /* Row 0 */ + { 75, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 2, 8}, { 3, 4}, { 1, 5}, /* Row 1 */ + { 75, 0}, + { 74, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 10}, { 1, 11}, /* Row 2 */ + { 1, 8}, { 3, 4}, { 1, 5}, { 74, 0}, + { 73, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 3 */ + { 1, 14}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 73, 0}, + { 72, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 4 */ + { 1, 6}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 72, 0}, + { 71, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 5 */ + { 1, 6}, { 2, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, + { 71, 0}, + { 70, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 6 */ + { 1, 6}, { 4, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, + { 70, 0}, + { 69, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 7 */ + { 1, 6}, { 6, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, + { 69, 0}, + { 68, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 8 */ + { 1, 6}, { 8, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, + { 68, 0}, + { 67, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 9 */ + { 1, 6}, { 10, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, + { 67, 0}, + { 66, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 10 */ + { 1, 6}, { 12, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, + { 66, 0}, + { 65, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 11 */ + { 1, 6}, { 14, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, + { 65, 0}, + { 64, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 12 */ + { 1, 6}, { 16, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, + { 64, 0}, + { 63, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 13 */ + { 1, 6}, { 18, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, + { 63, 0}, + { 62, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 14 */ + { 1, 6}, { 20, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, + { 62, 0}, + { 61, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 15 */ + { 1, 6}, { 22, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, + { 61, 0}, + { 60, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 16 */ + { 1, 6}, { 24, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, + { 60, 0}, + { 59, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 17 */ + { 1, 6}, { 26, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, + { 59, 0}, + { 58, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 18 */ + { 1, 6}, { 28, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, + { 26, 0}, { 1, 17}, { 5, 18}, { 1, 17}, { 25, 0}, + { 57, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 19 */ + { 1, 6}, { 10, 4}, { 5, 19}, { 15, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, + { 3, 4}, { 1, 5}, { 23, 0}, { 1, 20}, { 9, 18}, { 1, 20}, { 23, 0}, + { 56, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 20 */ + { 1, 6}, { 9, 4}, { 1, 19}, { 1, 21}, { 1, 22}, { 3, 23}, { 1, 22}, { 1, 21}, + { 1, 24}, { 14, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, + { 22, 0}, { 11, 18}, { 1, 20}, { 22, 0}, + { 23, 0}, { 1, 17}, { 5, 18}, { 1, 25}, { 25, 0}, { 1, 1}, { 1, 2}, { 1, 6}, /* Row 21 */ + { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 9, 4}, { 1, 19}, { 1, 26}, + { 7, 18}, { 1, 22}, { 1, 27}, { 14, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, + { 3, 4}, { 1, 5}, { 20, 0}, { 1, 17}, { 12, 18}, { 1, 20}, { 21, 0}, + { 21, 0}, { 1, 20}, { 9, 18}, { 1, 20}, { 22, 0}, { 1, 1}, { 1, 2}, { 1, 6}, /* Row 22 */ + { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 9, 4}, { 1, 19}, { 1, 26}, + { 9, 18}, { 1, 28}, { 1, 27}, { 4, 8}, { 1, 7}, { 9, 4}, { 1, 7}, { 1, 16}, + { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 19, 0}, { 14, 18}, { 21, 0}, + { 21, 0}, { 11, 18}, { 1, 20}, { 20, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, /* Row 23 */ + { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 10, 4}, { 1, 21}, { 11, 18}, { 1, 29}, + { 1, 30}, { 2, 31}, { 1, 32}, { 1, 33}, { 1, 8}, { 9, 4}, { 1, 7}, { 1, 16}, + { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 17, 0}, { 1, 17}, { 5, 18}, { 1, 34}, + { 2, 35}, { 1, 34}, { 5, 18}, { 1, 17}, { 20, 0}, + { 20, 0}, { 1, 36}, { 12, 18}, { 1, 37}, { 4, 38}, { 1, 39}, { 13, 0}, { 1, 1}, /* Row 24 */ + { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 10, 4}, + { 1, 24}, { 1, 22}, { 4, 18}, { 3, 34}, { 5, 18}, { 1, 40}, { 1, 41}, { 3, 31}, + { 1, 42}, { 1, 8}, { 9, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, + { 1, 5}, { 16, 0}, { 5, 18}, { 1, 43}, { 4, 44}, { 1, 43}, { 4, 18}, { 1, 35}, + { 1, 45}, { 1, 46}, { 18, 0}, + { 19, 0}, { 1, 17}, { 13, 18}, { 1, 47}, { 1, 45}, { 3, 38}, { 1, 48}, { 1, 38}, /* Row 25 */ + { 11, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, + { 1, 6}, { 11, 4}, { 1, 49}, { 4, 18}, { 1, 35}, { 3, 44}, { 1, 43}, { 5, 18}, + { 1, 50}, { 4, 31}, { 1, 42}, { 1, 8}, { 9, 4}, { 1, 7}, { 1, 16}, { 1, 15}, + { 1, 8}, { 3, 4}, { 1, 5}, { 14, 0}, { 1, 17}, { 4, 18}, { 1, 34}, { 6, 44}, + { 1, 34}, { 4, 18}, { 1, 51}, { 1, 38}, { 1, 46}, { 17, 0}, + { 19, 0}, { 5, 18}, { 1, 34}, { 2, 52}, { 1, 35}, { 6, 18}, { 1, 53}, { 4, 38}, /* Row 26 */ + { 1, 48}, { 1, 39}, { 9, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, + { 1, 12}, { 1, 13}, { 1, 6}, { 11, 4}, { 1, 3}, { 1, 54}, { 4, 18}, { 1, 55}, + { 4, 44}, { 1, 43}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 42}, { 1, 8}, + { 9, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 13, 0}, + { 5, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 4, 18}, { 1, 53}, { 2, 38}, { 1, 46}, + { 16, 0}, + { 18, 0}, { 1, 17}, { 4, 18}, { 1, 43}, { 4, 44}, { 1, 35}, { 5, 18}, { 1, 47}, /* Row 27 */ + { 1, 45}, { 5, 38}, { 8, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, + { 1, 12}, { 1, 13}, { 1, 6}, { 12, 4}, { 1, 19}, { 1, 23}, { 3, 18}, { 1, 35}, + { 6, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 9, 4}, + { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 11, 0}, { 1, 17}, + { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 53}, { 3, 38}, { 16, 0}, + { 18, 0}, { 4, 18}, { 1, 34}, { 5, 44}, { 1, 55}, { 1, 34}, { 5, 18}, { 1, 53}, /* Row 28 */ + { 4, 38}, { 1, 48}, { 1, 39}, { 6, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, + { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 13, 4}, { 1, 19}, { 1, 23}, { 3, 18}, + { 1, 52}, { 6, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, + { 1, 56}, { 10, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, + { 10, 0}, { 5, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 51}, { 2, 38}, + { 1, 48}, { 1, 39}, { 15, 0}, + { 18, 0}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, { 1, 47}, { 1, 45}, /* Row 29 */ + { 5, 38}, { 5, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, + { 1, 13}, { 1, 6}, { 14, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, + { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 10, 4}, { 1, 7}, + { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 8, 0}, { 1, 17}, { 4, 18}, + { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 4, 38}, { 15, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 5, 18}, { 1, 53}, { 4, 38}, /* Row 30 */ + { 1, 48}, { 1, 39}, { 3, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, + { 1, 12}, { 1, 13}, { 1, 6}, { 15, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, + { 8, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, + { 11, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 7, 0}, + { 5, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53}, { 5, 38}, { 1, 1}, + { 14, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 52}, { 5, 18}, { 1, 47}, { 1, 45}, /* Row 31 */ + { 5, 38}, { 2, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, + { 1, 13}, { 1, 6}, { 16, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 9, 44}, + { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 11, 4}, { 1, 7}, + { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 5, 0}, { 1, 17}, { 4, 18}, + { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 5, 38}, { 1, 39}, + { 14, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 9, 44}, { 1, 34}, { 5, 18}, { 1, 53}, { 4, 38}, /* Row 32 */ + { 1, 48}, { 1, 39}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, + { 1, 13}, { 1, 6}, { 17, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 9, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 12, 4}, + { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 4, 0}, { 5, 18}, + { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53}, { 6, 38}, { 1, 1}, { 14, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 9, 44}, { 1, 52}, { 5, 18}, { 1, 47}, { 1, 45}, /* Row 33 */ + { 3, 38}, { 1, 48}, { 1, 57}, { 1, 13}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, + { 1, 13}, { 1, 6}, { 18, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 10, 44}, + { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 12, 4}, { 1, 7}, + { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 2, 0}, { 1, 17}, { 4, 18}, + { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 15, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 10, 44}, { 1, 34}, { 5, 18}, { 1, 53}, { 2, 38}, /* Row 34 */ + { 1, 48}, { 1, 58}, { 1, 59}, { 1, 60}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, + { 1, 6}, { 19, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 10, 44}, { 1, 52}, + { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 13, 4}, { 1, 7}, + { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 1, 0}, { 5, 18}, { 1, 52}, + { 7, 44}, { 1, 34}, { 4, 18}, { 1, 61}, { 5, 38}, { 1, 48}, { 1, 39}, { 15, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 10, 44}, { 1, 52}, { 5, 18}, { 1, 47}, { 1, 45}, /* Row 35 */ + { 1, 48}, { 1, 58}, { 1, 59}, { 1, 31}, { 1, 32}, { 1, 62}, { 1, 12}, { 1, 13}, + { 1, 6}, { 20, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 11, 44}, { 1, 34}, + { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 13, 4}, { 1, 7}, { 1, 16}, + { 1, 15}, { 1, 8}, { 3, 4}, { 1, 63}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, + { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 16, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 11, 44}, { 1, 34}, { 5, 18}, { 1, 64}, { 1, 58}, /* Row 36 */ + { 1, 59}, { 3, 31}, { 1, 65}, { 1, 66}, { 1, 6}, { 21, 4}, { 1, 19}, { 1, 23}, + { 2, 18}, { 1, 34}, { 11, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, + { 1, 32}, { 1, 56}, { 14, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 1, 4}, + { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53}, + { 5, 38}, { 1, 48}, { 1, 39}, { 16, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 11, 44}, { 1, 52}, { 5, 18}, { 1, 67}, { 1, 68}, /* Row 37 */ + { 5, 31}, { 1, 69}, { 22, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 12, 44}, + { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 14, 4}, { 1, 7}, + { 1, 16}, { 1, 15}, { 1, 8}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, + { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 17, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 12, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, /* Row 38 */ + { 1, 70}, { 1, 7}, { 21, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 12, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 15, 4}, + { 1, 7}, { 1, 16}, { 1, 71}, { 1, 67}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, + { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 17, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 12, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, /* Row 39 */ + { 4, 31}, { 1, 32}, { 1, 56}, { 21, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, + { 13, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 16, 4}, + { 1, 72}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, + { 6, 38}, { 18, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 13, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, /* Row 40 */ + { 1, 33}, { 1, 7}, { 20, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 13, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 15, 4}, + { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53}, + { 5, 38}, { 1, 48}, { 1, 39}, { 18, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 13, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, /* Row 41 */ + { 4, 31}, { 1, 32}, { 1, 56}, { 20, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, + { 14, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 14, 4}, + { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, + { 6, 38}, { 19, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 14, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, /* Row 42 */ + { 1, 33}, { 1, 7}, { 19, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 14, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 13, 4}, + { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53}, + { 5, 38}, { 1, 48}, { 1, 39}, { 19, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 14, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, /* Row 43 */ + { 4, 31}, { 1, 32}, { 1, 56}, { 19, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, + { 7, 44}, { 1, 73}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, + { 1, 7}, { 12, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, + { 1, 47}, { 1, 45}, { 6, 38}, { 20, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 15, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, /* Row 44 */ + { 1, 33}, { 1, 7}, { 18, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, + { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, + { 1, 56}, { 11, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, + { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 20, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 73}, { 6, 44}, { 1, 52}, { 5, 18}, /* Row 45 */ + { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 18, 4}, { 1, 19}, { 1, 23}, + { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, + { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 10, 4}, { 1, 21}, { 4, 18}, { 1, 34}, + { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 21, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, /* Row 46 */ + { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 17, 4}, { 1, 19}, { 1, 23}, { 2, 18}, + { 1, 34}, { 7, 44}, { 2, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, + { 4, 31}, { 1, 32}, { 1, 56}, { 9, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, + { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 21, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 1, 52}, { 6, 44}, { 1, 52}, /* Row 47 */ + { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 17, 4}, { 1, 19}, + { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 1, 18}, { 1, 52}, { 7, 44}, + { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 8, 4}, { 1, 21}, + { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, + { 22, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 2, 34}, { 7, 44}, { 1, 34}, { 5, 18}, /* Row 48 */ + { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 16, 4}, { 1, 19}, { 1, 23}, { 2, 18}, + { 1, 34}, { 7, 44}, { 1, 34}, { 1, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, + { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 7, 4}, { 1, 24}, { 1, 22}, + { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 74}, { 1, 48}, { 4, 38}, + { 1, 48}, { 1, 39}, { 22, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 1, 18}, { 1, 52}, { 6, 44}, /* Row 49 */ + { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 16, 4}, + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 52}, + { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 6, 4}, + { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 75}, + { 1, 58}, { 1, 48}, { 4, 38}, { 23, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 1, 18}, { 1, 34}, { 7, 44}, /* Row 50 */ + { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 15, 4}, { 1, 19}, + { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 34}, { 7, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 5, 4}, + { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, + { 1, 31}, { 1, 59}, { 1, 58}, { 1, 48}, { 1, 38}, { 1, 48}, { 1, 39}, { 23, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 52}, { 6, 44}, /* Row 51 */ + { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 15, 4}, + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 3, 18}, { 1, 52}, + { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 4, 4}, + { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, + { 2, 31}, { 1, 59}, { 1, 58}, { 1, 48}, { 1, 38}, { 24, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 34}, { 7, 44}, /* Row 52 */ + { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 14, 4}, { 1, 19}, + { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 3, 18}, { 1, 34}, { 7, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 3, 4}, + { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, + { 4, 31}, { 1, 59}, { 1, 76}, { 1, 39}, { 24, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 3, 18}, { 1, 52}, { 6, 44}, /* Row 53 */ + { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 14, 4}, + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 52}, + { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 2, 4}, + { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, + { 5, 31}, { 1, 77}, { 1, 78}, { 24, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 3, 18}, { 1, 34}, { 7, 44}, /* Row 54 */ + { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 13, 4}, { 1, 19}, + { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 34}, { 7, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 1, 4}, + { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, + { 6, 31}, { 1, 32}, { 1, 56}, { 1, 5}, { 23, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 4, 18}, { 1, 52}, { 6, 44}, /* Row 55 */ + { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 13, 4}, + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 52}, + { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 4}, { 1, 21}, + { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, + { 1, 79}, { 1, 7}, { 1, 4}, { 1, 5}, { 22, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 4, 18}, { 1, 34}, { 7, 44}, /* Row 56 */ + { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 12, 4}, { 1, 19}, + { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 34}, { 7, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 80}, { 1, 22}, + { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 81}, + { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 21, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 5, 18}, { 1, 52}, { 6, 44}, /* Row 57 */ + { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 12, 4}, + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 6, 18}, { 1, 52}, + { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 82}, { 4, 18}, { 1, 34}, + { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56}, + { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 20, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 5, 18}, { 1, 34}, { 7, 44}, /* Row 58 */ + { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 11, 4}, { 1, 19}, + { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 6, 18}, { 1, 34}, { 7, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 3, 31}, { 1, 41}, { 1, 40}, { 4, 18}, + { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 2, 7}, + { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 19, 0}, + { 17, 0}, { 1, 83}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 6, 18}, { 1, 52}, /* Row 59 */ + { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, + { 11, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 7, 18}, + { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 3, 31}, { 1, 50}, { 4, 18}, + { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, + { 1, 56}, { 2, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, + { 18, 0}, + { 16, 0}, { 1, 1}, { 1, 84}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, /* Row 60 */ + { 6, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, + { 1, 7}, { 10, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, + { 3, 18}, { 1, 85}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, + { 1, 41}, { 1, 31}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, + { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 1, 7}, { 3, 4}, { 1, 7}, { 1, 16}, + { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 17, 0}, + { 15, 0}, { 1, 1}, { 1, 2}, { 1, 86}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, /* Row 61 */ + { 1, 34}, { 7, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, + { 4, 31}, { 1, 32}, { 1, 56}, { 10, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, + { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 87}, { 4, 18}, { 1, 52}, { 7, 44}, + { 1, 34}, { 4, 18}, { 1, 50}, { 1, 88}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56}, { 5, 4}, + { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 16, 0}, + { 14, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 89}, { 1, 23}, { 2, 18}, { 1, 34}, /* Row 62 */ + { 8, 44}, { 1, 34}, { 7, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50}, + { 5, 31}, { 1, 33}, { 1, 7}, { 9, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, + { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 90}, { 1, 40}, { 3, 18}, { 1, 34}, + { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 91}, { 1, 40}, { 4, 18}, { 1, 52}, + { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 1, 7}, { 6, 4}, + { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 15, 0}, + { 13, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 71}, { 1, 29}, { 2, 18}, /* Row 63 */ + { 1, 34}, { 8, 44}, { 1, 34}, { 3, 18}, { 1, 85}, { 4, 18}, { 1, 52}, { 6, 44}, + { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 9, 4}, + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, + { 1, 92}, { 1, 50}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 29}, + { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, + { 1, 32}, { 1, 56}, { 8, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, + { 1, 5}, { 14, 0}, + { 12, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 94}, { 1, 95}, /* Row 64 */ + { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 87}, { 4, 18}, + { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, + { 8, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, + { 1, 29}, { 1, 92}, { 1, 41}, { 1, 40}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, + { 9, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, + { 1, 7}, { 9, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, + { 13, 0}, + { 11, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 97}, /* Row 65 */ + { 1, 28}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 90}, + { 1, 40}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, + { 4, 31}, { 1, 32}, { 1, 56}, { 8, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, + { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 1, 31}, { 1, 50}, { 4, 18}, + { 1, 52}, { 7, 44}, { 1, 34}, { 7, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, + { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56}, { 11, 4}, { 1, 7}, { 1, 16}, + { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 12, 0}, + { 10, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 66 */ + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, + { 1, 92}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50}, + { 5, 31}, { 1, 33}, { 1, 7}, { 7, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, + { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 1, 31}, { 1, 41}, { 1, 40}, + { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 7, 18}, { 1, 52}, { 7, 44}, { 1, 34}, + { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 1, 7}, { 12, 4}, { 1, 7}, { 1, 16}, + { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 11, 0}, + { 9, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 67 */ + { 1, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, + { 1, 29}, { 1, 92}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, + { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 7, 4}, { 1, 19}, + { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, + { 2, 31}, { 1, 50}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 34}, + { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56}, + { 14, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 10, 0}, + { 8, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 68 */ + { 2, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, + { 1, 29}, { 1, 92}, { 1, 31}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, + { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 6, 4}, { 1, 19}, { 1, 23}, + { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 2, 31}, + { 1, 41}, { 1, 40}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 5, 18}, { 1, 52}, + { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 1, 7}, { 15, 4}, + { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 9, 0}, + { 7, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 69 */ + { 3, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, + { 1, 29}, { 1, 92}, { 1, 31}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 6, 44}, + { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 6, 4}, + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, + { 1, 92}, { 3, 31}, { 1, 50}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 3, 18}, + { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, + { 1, 56}, { 17, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, + { 8, 0}, + { 6, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 70 */ + { 4, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, + { 1, 29}, { 1, 92}, { 2, 31}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, + { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 5, 4}, { 1, 19}, { 1, 23}, + { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 3, 31}, + { 1, 41}, { 1, 40}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 3, 18}, { 1, 52}, + { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 1, 7}, { 18, 4}, + { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 7, 0}, + { 5, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 71 */ + { 5, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, + { 1, 29}, { 1, 92}, { 2, 31}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 6, 44}, + { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 5, 4}, + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, + { 1, 92}, { 4, 31}, { 1, 50}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 1, 18}, + { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, + { 1, 56}, { 20, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, + { 6, 0}, + { 4, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 72 */ + { 6, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, + { 1, 29}, { 1, 92}, { 3, 31}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, + { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 4, 4}, { 1, 19}, { 1, 23}, + { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 4, 31}, + { 1, 41}, { 1, 40}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 1, 18}, { 1, 52}, + { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 1, 7}, { 21, 4}, + { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 5, 0}, + { 3, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 73 */ + { 7, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, + { 1, 29}, { 1, 92}, { 3, 31}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 6, 44}, + { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 4, 4}, + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, + { 1, 92}, { 5, 31}, { 1, 50}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 99}, { 7, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56}, { 23, 4}, + { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 4, 0}, + { 2, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 74 */ + { 8, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, + { 1, 29}, { 1, 92}, { 4, 31}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, + { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 3, 4}, { 1, 19}, { 1, 23}, + { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 5, 31}, + { 1, 41}, { 1, 67}, { 3, 18}, { 1, 34}, { 15, 44}, { 1, 34}, { 4, 18}, { 1, 50}, + { 6, 31}, { 1, 33}, { 1, 7}, { 24, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, + { 2, 4}, { 1, 5}, { 3, 0}, + { 1, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 75 */ + { 9, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, + { 1, 29}, { 1, 92}, { 4, 31}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 6, 44}, + { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 3, 4}, + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, + { 1, 92}, { 6, 31}, { 1, 72}, { 4, 18}, { 1, 52}, { 13, 44}, { 1, 52}, { 4, 18}, + { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56}, { 26, 4}, { 1, 7}, { 1, 16}, + { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 2, 0}, + { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, { 10, 4}, /* Row 76 */ + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, + { 1, 92}, { 5, 31}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, + { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 2, 4}, { 1, 19}, { 1, 23}, { 2, 18}, + { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 80}, + { 1, 22}, { 3, 18}, { 1, 34}, { 13, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, + { 1, 33}, { 1, 7}, { 27, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, + { 1, 5}, { 1, 0}, + { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, { 11, 4}, { 1, 19}, /* Row 77 */ + { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, + { 5, 31}, { 1, 41}, { 1, 67}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, + { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 2, 4}, { 1, 19}, { 1, 23}, + { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, + { 1, 8}, { 1, 21}, { 4, 18}, { 1, 52}, { 11, 44}, { 1, 52}, { 4, 18}, { 1, 40}, + { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56}, { 29, 4}, { 1, 7}, { 1, 16}, { 1, 15}, + { 1, 8}, { 2, 4}, { 1, 5}, + { 1, 3}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, { 12, 4}, { 1, 19}, { 1, 23}, /* Row 78 */ + { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, + { 1, 72}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, + { 1, 33}, { 1, 7}, { 1, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, + { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 1, 24}, { 1, 22}, + { 3, 18}, { 1, 34}, { 11, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, + { 1, 7}, { 30, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, + { 1, 4}, { 1, 33}, { 1, 100}, { 1, 98}, { 13, 4}, { 1, 19}, { 1, 23}, { 2, 18}, /* Row 79 */ + { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 80}, + { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, + { 4, 31}, { 1, 32}, { 1, 56}, { 1, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, + { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 1, 4}, + { 1, 101}, { 4, 18}, { 1, 52}, { 9, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, + { 5, 31}, { 1, 32}, { 1, 56}, { 32, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 56}, + { 1, 7}, + { 1, 4}, { 1, 8}, { 1, 102}, { 1, 9}, { 1, 7}, { 12, 4}, { 1, 19}, { 1, 23}, /* Row 80 */ + { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, + { 1, 8}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50}, + { 5, 31}, { 1, 33}, { 1, 7}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, + { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 1, 4}, { 1, 101}, + { 4, 18}, { 1, 34}, { 9, 44}, { 1, 35}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, + { 1, 7}, { 33, 4}, { 1, 7}, { 1, 103}, { 1, 10}, { 1, 8}, + { 2, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 11, 4}, { 1, 19}, { 1, 23}, /* Row 81 */ + { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, + { 1, 8}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, + { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 1, 19}, { 1, 23}, { 2, 18}, + { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, + { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 8, 44}, { 1, 104}, { 4, 18}, { 1, 29}, + { 1, 68}, { 6, 31}, { 1, 56}, { 33, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 66}, + { 1, 3}, + { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 10, 4}, { 1, 19}, { 1, 23}, /* Row 82 */ + { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, + { 1, 8}, { 1, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, + { 1, 50}, { 5, 31}, { 1, 33}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, + { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 1, 21}, { 4, 18}, + { 1, 34}, { 10, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 56}, { 32, 4}, + { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, + { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 9, 4}, { 1, 19}, /* Row 83 */ + { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, + { 6, 31}, { 1, 8}, { 1, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, + { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 105}, { 1, 23}, + { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, + { 1, 80}, { 1, 22}, { 4, 18}, { 1, 52}, { 10, 44}, { 1, 52}, { 4, 18}, { 1, 40}, + { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 30, 4}, { 1, 7}, { 1, 9}, { 1, 12}, + { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, + { 1, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 8, 4}, /* Row 84 */ + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, + { 1, 92}, { 6, 31}, { 1, 8}, { 2, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, + { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 106}, { 1, 23}, { 2, 18}, { 1, 34}, + { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 72}, { 4, 18}, + { 1, 34}, { 12, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, + { 29, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, + { 1, 0}, + { 2, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 7, 4}, /* Row 85 */ + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, + { 1, 92}, { 6, 31}, { 1, 8}, { 2, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, + { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 107}, { 1, 29}, + { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 5, 31}, + { 1, 41}, { 1, 67}, { 4, 18}, { 1, 52}, { 12, 44}, { 1, 52}, { 4, 18}, { 1, 40}, + { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 27, 4}, { 1, 7}, { 1, 9}, { 1, 12}, + { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 2, 0}, + { 3, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 6, 4}, /* Row 86 */ + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, + { 1, 92}, { 6, 31}, { 1, 8}, { 3, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, + { 1, 34}, { 5, 18}, { 1, 50}, { 4, 31}, { 1, 92}, { 1, 29}, { 2, 18}, { 1, 34}, + { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 5, 31}, { 1, 50}, { 4, 18}, + { 1, 34}, { 14, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, + { 26, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, + { 3, 0}, + { 4, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 5, 4}, /* Row 87 */ + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, + { 1, 92}, { 6, 31}, { 1, 8}, { 3, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, + { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 3, 31}, { 1, 92}, { 1, 29}, + { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 4, 31}, + { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 14, 44}, { 1, 52}, { 4, 18}, { 1, 40}, + { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 24, 4}, { 1, 7}, { 1, 9}, { 1, 12}, + { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 4, 0}, + { 5, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 4, 4}, /* Row 88 */ + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, + { 1, 92}, { 6, 31}, { 1, 8}, { 4, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, + { 1, 34}, { 5, 18}, { 1, 50}, { 3, 31}, { 1, 92}, { 1, 29}, { 2, 18}, { 1, 34}, + { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 4, 31}, { 1, 50}, { 4, 18}, + { 1, 34}, { 16, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, + { 23, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, + { 5, 0}, + { 6, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 3, 4}, /* Row 89 */ + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, + { 1, 92}, { 6, 31}, { 1, 8}, { 4, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, + { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 2, 31}, { 1, 92}, { 1, 29}, + { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 3, 31}, + { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 52}, { 1, 34}, { 7, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 21, 4}, + { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 6, 0}, + { 7, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 2, 4}, /* Row 90 */ + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, + { 1, 92}, { 6, 31}, { 1, 8}, { 5, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, + { 1, 34}, { 5, 18}, { 1, 50}, { 2, 31}, { 1, 92}, { 1, 29}, { 2, 18}, { 1, 34}, + { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 3, 31}, { 1, 50}, { 4, 18}, + { 1, 34}, { 8, 44}, { 1, 34}, { 1, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, + { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, { 20, 4}, { 1, 7}, { 1, 9}, { 1, 12}, + { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 7, 0}, + { 8, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 1, 4}, /* Row 91 */ + { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, + { 1, 92}, { 6, 31}, { 1, 8}, { 5, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, + { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 1, 31}, { 1, 92}, { 1, 29}, + { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 2, 31}, + { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 52}, { 2, 18}, { 1, 34}, + { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, + { 18, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, + { 8, 0}, + { 9, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 1, 19}, /* Row 92 */ + { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, + { 6, 31}, { 1, 8}, { 6, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, + { 5, 18}, { 1, 50}, { 1, 31}, { 1, 92}, { 1, 29}, { 2, 18}, { 1, 34}, { 7, 44}, + { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 2, 31}, { 1, 50}, { 4, 18}, { 1, 34}, + { 8, 44}, { 1, 34}, { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, + { 5, 31}, { 1, 32}, { 1, 56}, { 17, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, + { 1, 6}, { 1, 4}, { 1, 5}, { 9, 0}, + { 10, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 19}, { 1, 23}, /* Row 93 */ + { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, + { 1, 8}, { 6, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, + { 5, 18}, { 1, 40}, { 1, 41}, { 1, 92}, { 1, 29}, { 2, 18}, { 1, 34}, { 7, 44}, + { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 1, 31}, { 1, 41}, { 1, 40}, { 4, 18}, + { 1, 52}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, + { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 15, 4}, { 1, 7}, { 1, 9}, + { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 10, 0}, + { 11, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 108}, { 1, 23}, { 2, 18}, /* Row 94 */ + { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, + { 7, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50}, + { 1, 92}, { 1, 29}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, + { 1, 92}, { 1, 31}, { 1, 50}, { 4, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 5, 18}, + { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, + { 14, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, + { 11, 0}, + { 12, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 109}, { 1, 29}, { 2, 18}, { 1, 34}, /* Row 95 */ + { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 7, 4}, + { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, + { 1, 90}, { 1, 29}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, + { 1, 92}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 52}, { 6, 18}, + { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, + { 1, 7}, { 12, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, + { 1, 5}, { 12, 0}, + { 13, 0}, { 1, 5}, { 3, 4}, { 1, 89}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, /* Row 96 */ + { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 8, 4}, { 1, 21}, + { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 87}, { 1, 29}, { 2, 18}, + { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 1, 50}, { 4, 18}, + { 1, 34}, { 8, 44}, { 1, 34}, { 7, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, + { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, { 11, 4}, { 1, 7}, { 1, 9}, { 1, 12}, + { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 13, 0}, + { 14, 0}, { 1, 5}, { 2, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, /* Row 97 */ + { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 8, 4}, { 1, 24}, + { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, { 1, 85}, { 3, 18}, + { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 90}, { 1, 40}, { 4, 18}, + { 1, 52}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 85}, { 3, 18}, { 1, 34}, { 7, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 9, 4}, + { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 14, 0}, + { 15, 0}, { 1, 5}, { 1, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, /* Row 98 */ + { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 9, 4}, { 1, 21}, + { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 8, 18}, { 1, 34}, { 7, 44}, { 1, 34}, + { 2, 18}, { 1, 29}, { 1, 87}, { 4, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 4, 18}, + { 1, 87}, { 1, 40}, { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, + { 5, 31}, { 1, 32}, { 1, 56}, { 8, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, + { 1, 6}, { 1, 4}, { 1, 5}, { 15, 0}, + { 16, 0}, { 1, 5}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, /* Row 99 */ + { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 9, 4}, { 1, 24}, { 1, 22}, + { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 8, 18}, { 1, 34}, { 7, 44}, { 1, 34}, + { 3, 18}, { 1, 85}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, + { 1, 41}, { 1, 50}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, + { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 6, 4}, { 1, 7}, { 1, 9}, { 1, 12}, + { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 16, 0}, + { 17, 0}, { 1, 110}, { 1, 111}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, /* Row 100 */ + { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 10, 4}, { 1, 21}, { 4, 18}, { 1, 34}, + { 7, 44}, { 1, 34}, { 7, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 7, 18}, { 1, 34}, + { 8, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 1, 31}, { 1, 41}, { 1, 40}, { 3, 18}, + { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, + { 5, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, + { 17, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 101 */ + { 6, 31}, { 1, 8}, { 10, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, + { 1, 52}, { 7, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 7, 18}, { 1, 52}, { 7, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 2, 31}, { 1, 50}, { 3, 18}, { 1, 34}, + { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, + { 3, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, + { 18, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 102 */ + { 6, 31}, { 1, 8}, { 11, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, + { 6, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 6, 18}, { 1, 34}, { 8, 44}, { 1, 34}, + { 4, 18}, { 1, 50}, { 3, 31}, { 1, 41}, { 1, 40}, { 3, 18}, { 1, 52}, { 7, 44}, + { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, { 2, 4}, { 1, 7}, + { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 19, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 103 */ + { 6, 31}, { 1, 8}, { 11, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, + { 1, 52}, { 6, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 6, 18}, { 1, 52}, { 7, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 50}, { 3, 18}, { 1, 34}, + { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, { 2, 7}, + { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 20, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 104 */ + { 6, 31}, { 1, 8}, { 12, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, + { 5, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 34}, { 8, 44}, { 1, 34}, + { 4, 18}, { 1, 50}, { 5, 31}, { 1, 41}, { 1, 40}, { 3, 18}, { 1, 52}, { 7, 44}, + { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, { 1, 9}, { 1, 12}, + { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 21, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 105 */ + { 6, 31}, { 1, 8}, { 12, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, + { 1, 52}, { 5, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 52}, { 7, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 82}, { 3, 18}, { 1, 34}, + { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 81}, { 1, 12}, + { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 22, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 106 */ + { 6, 31}, { 1, 8}, { 13, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, + { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 34}, { 8, 44}, { 1, 34}, + { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 80}, { 1, 22}, { 3, 18}, { 1, 52}, + { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 77}, { 1, 112}, { 1, 6}, + { 1, 4}, { 1, 5}, { 23, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 107 */ + { 6, 31}, { 1, 8}, { 13, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, + { 1, 52}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 52}, { 7, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 4}, { 1, 21}, + { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, + { 1, 113}, { 1, 8}, { 1, 5}, { 24, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 108 */ + { 6, 31}, { 1, 8}, { 14, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, + { 3, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, + { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 1, 4}, { 1, 24}, { 1, 22}, + { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 4, 31}, { 1, 59}, + { 1, 58}, { 1, 114}, { 25, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 109 */ + { 6, 31}, { 1, 8}, { 14, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, + { 1, 52}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 3, 18}, { 1, 52}, { 7, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 2, 4}, + { 1, 21}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, + { 2, 31}, { 1, 59}, { 1, 58}, { 1, 48}, { 1, 38}, { 25, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 110 */ + { 6, 31}, { 1, 8}, { 15, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, + { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, + { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 3, 4}, { 1, 24}, { 1, 22}, + { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 1, 31}, { 1, 59}, + { 1, 58}, { 1, 48}, { 1, 38}, { 1, 48}, { 1, 39}, { 24, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 111 */ + { 6, 31}, { 1, 8}, { 15, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, + { 1, 52}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 52}, { 7, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 4, 4}, + { 1, 21}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 75}, + { 1, 58}, { 1, 48}, { 4, 38}, { 24, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 112 */ + { 6, 31}, { 1, 8}, { 16, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, + { 1, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 1, 18}, { 1, 34}, { 8, 44}, { 1, 34}, + { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 5, 4}, { 1, 24}, { 1, 22}, + { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 74}, { 1, 48}, { 4, 38}, + { 1, 48}, { 1, 39}, { 23, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 113 */ + { 6, 31}, { 1, 8}, { 16, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, + { 1, 52}, { 1, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 1, 18}, { 1, 52}, { 7, 44}, + { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 6, 4}, + { 1, 21}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, + { 6, 38}, { 23, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 114 */ + { 6, 31}, { 1, 8}, { 17, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 2, 34}, + { 7, 44}, { 2, 34}, { 8, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, + { 1, 56}, { 7, 4}, { 1, 24}, { 1, 22}, { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, + { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 22, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 115 */ + { 6, 31}, { 1, 8}, { 17, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, + { 1, 52}, { 1, 34}, { 7, 44}, { 1, 34}, { 1, 52}, { 7, 44}, { 1, 52}, { 4, 18}, + { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 8, 4}, { 1, 21}, { 3, 18}, + { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 22, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 115}, /* Row 116 */ + { 6, 31}, { 1, 8}, { 18, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, + { 7, 44}, { 1, 34}, { 8, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, + { 1, 56}, { 9, 4}, { 1, 24}, { 1, 22}, { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, + { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 21, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 116}, /* Row 117 */ + { 1, 59}, { 5, 31}, { 1, 8}, { 18, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, + { 6, 44}, { 1, 73}, { 7, 44}, { 1, 73}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, + { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 10, 4}, { 1, 21}, { 3, 18}, { 1, 34}, + { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 21, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 118 */ + { 1, 58}, { 1, 59}, { 4, 31}, { 1, 16}, { 1, 7}, { 18, 4}, { 1, 21}, { 4, 18}, + { 1, 34}, { 22, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, + { 11, 4}, { 1, 24}, { 1, 22}, { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, + { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 20, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 119 */ + { 1, 48}, { 1, 58}, { 1, 59}, { 3, 31}, { 1, 42}, { 1, 16}, { 1, 7}, { 17, 4}, + { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 20, 44}, { 1, 52}, { 4, 18}, { 1, 40}, + { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 12, 4}, { 1, 21}, { 3, 18}, { 1, 34}, + { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 20, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 120 */ + { 1, 38}, { 1, 48}, { 1, 58}, { 1, 59}, { 2, 31}, { 1, 56}, { 1, 15}, { 1, 16}, + { 1, 7}, { 17, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 20, 44}, { 1, 34}, { 4, 18}, + { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 12, 4}, { 1, 7}, { 1, 117}, { 1, 73}, + { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, + { 1, 39}, { 19, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 121 */ + { 2, 38}, { 1, 48}, { 1, 58}, { 1, 59}, { 1, 31}, { 2, 8}, { 1, 15}, { 1, 16}, + { 1, 7}, { 16, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 18, 44}, { 1, 52}, + { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 11, 4}, { 1, 7}, + { 1, 9}, { 1, 118}, { 1, 119}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, + { 1, 47}, { 1, 45}, { 6, 38}, { 19, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 122 */ + { 3, 38}, { 1, 48}, { 1, 58}, { 1, 113}, { 1, 8}, { 1, 4}, { 1, 8}, { 1, 15}, + { 1, 16}, { 1, 7}, { 16, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 18, 44}, { 1, 34}, + { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 11, 4}, { 1, 7}, { 1, 9}, + { 1, 12}, { 1, 13}, { 1, 120}, { 1, 22}, { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, + { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 18, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 123 */ + { 4, 38}, { 1, 48}, { 1, 121}, { 1, 122}, { 2, 4}, { 1, 8}, { 1, 15}, { 1, 16}, + { 1, 7}, { 15, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 16, 44}, { 1, 52}, + { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 10, 4}, { 1, 7}, + { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 123}, { 3, 18}, { 1, 34}, + { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 18, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 124 */ + { 5, 38}, { 1, 48}, { 1, 124}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, + { 15, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 16, 44}, { 1, 34}, { 4, 18}, { 1, 50}, + { 6, 31}, { 1, 32}, { 1, 56}, { 10, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, + { 1, 6}, { 1, 4}, { 1, 5}, { 1, 125}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, + { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 17, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 125 */ + { 6, 38}, { 1, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, + { 14, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 14, 44}, { 1, 52}, { 4, 18}, + { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 9, 4}, { 1, 7}, { 1, 9}, + { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 2, 0}, { 1, 17}, { 3, 18}, + { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 17, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 126 */ + { 6, 38}, { 2, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, + { 14, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 14, 44}, { 1, 34}, { 4, 18}, { 1, 50}, + { 6, 31}, { 1, 32}, { 1, 56}, { 9, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, + { 1, 6}, { 1, 4}, { 1, 5}, { 4, 0}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, + { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 16, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 127 */ + { 6, 38}, { 3, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, + { 13, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 12, 44}, { 1, 52}, { 4, 18}, + { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 8, 4}, { 1, 7}, { 1, 9}, + { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 5, 0}, { 1, 17}, { 3, 18}, + { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 16, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 128 */ + { 6, 38}, { 4, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, + { 13, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 12, 44}, { 1, 34}, { 4, 18}, { 1, 50}, + { 6, 31}, { 1, 32}, { 1, 56}, { 8, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, + { 1, 6}, { 1, 4}, { 1, 5}, { 7, 0}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, + { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 15, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 129 */ + { 6, 38}, { 5, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, + { 12, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 10, 44}, { 1, 52}, { 4, 18}, + { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 7, 4}, { 1, 7}, { 1, 9}, + { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 8, 0}, { 1, 17}, { 3, 18}, + { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 15, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 130 */ + { 6, 38}, { 6, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, + { 12, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 10, 44}, { 1, 34}, { 4, 18}, { 1, 50}, + { 6, 31}, { 1, 32}, { 1, 56}, { 7, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, + { 1, 6}, { 1, 4}, { 1, 5}, { 10, 0}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, + { 4, 18}, { 1, 51}, { 5, 38}, { 1, 48}, { 1, 126}, { 14, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 131 */ + { 6, 38}, { 7, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, + { 11, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 8, 44}, { 1, 52}, { 4, 18}, + { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 6, 4}, { 1, 7}, { 1, 9}, + { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 11, 0}, { 1, 17}, { 3, 18}, + { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 53}, { 6, 38}, { 1, 127}, { 14, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 132 */ + { 6, 38}, { 8, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, + { 11, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 4, 18}, { 1, 50}, + { 6, 31}, { 1, 32}, { 1, 56}, { 6, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, + { 1, 6}, { 1, 4}, { 1, 5}, { 13, 0}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, + { 4, 18}, { 1, 53}, { 7, 38}, { 14, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 133 */ + { 6, 38}, { 9, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, + { 10, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 4, 18}, + { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 5, 4}, { 1, 7}, { 1, 9}, + { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 14, 0}, { 1, 17}, { 3, 18}, + { 1, 34}, { 6, 44}, { 1, 52}, { 4, 18}, { 1, 128}, { 6, 38}, { 1, 48}, { 1, 126}, + { 13, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 134 */ + { 6, 38}, { 10, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, + { 10, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 1, 55}, { 4, 44}, { 1, 55}, { 1, 34}, + { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 5, 4}, { 1, 7}, { 1, 9}, + { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 16, 0}, { 4, 18}, { 1, 52}, + { 5, 44}, { 1, 34}, { 3, 18}, { 1, 47}, { 1, 45}, { 7, 38}, { 1, 39}, { 13, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 135 */ + { 6, 38}, { 11, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, + { 9, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 34}, { 1, 52}, { 2, 44}, { 1, 52}, + { 1, 34}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 4, 4}, + { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 17, 0}, + { 1, 17}, { 3, 18}, { 1, 34}, { 1, 52}, { 2, 44}, { 1, 52}, { 1, 34}, { 4, 18}, + { 1, 53}, { 8, 38}, { 1, 39}, { 13, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 136 */ + { 6, 38}, { 12, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, + { 9, 4}, { 1, 21}, { 6, 18}, { 2, 34}, { 6, 18}, { 1, 50}, { 6, 31}, { 1, 32}, + { 1, 56}, { 4, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, + { 1, 5}, { 19, 0}, { 5, 18}, { 2, 34}, { 5, 18}, { 1, 47}, { 1, 45}, { 8, 38}, + { 1, 1}, { 13, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 137 */ + { 6, 38}, { 13, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, + { 8, 4}, { 1, 24}, { 1, 22}, { 12, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, + { 1, 7}, { 3, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, + { 1, 5}, { 20, 0}, { 1, 17}, { 10, 18}, { 1, 35}, { 1, 61}, { 9, 38}, { 14, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 138 */ + { 6, 38}, { 14, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, + { 8, 4}, { 1, 21}, { 12, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 3, 4}, + { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 22, 0}, + { 9, 18}, { 1, 35}, { 1, 61}, { 8, 38}, { 1, 48}, { 1, 39}, { 14, 0}, + { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 18}, { 2, 35}, { 1, 129}, { 1, 45}, /* Row 139 */ + { 6, 38}, { 15, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, + { 7, 4}, { 1, 19}, { 1, 26}, { 10, 18}, { 1, 130}, { 1, 107}, { 6, 31}, { 1, 33}, + { 1, 7}, { 2, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, + { 1, 5}, { 23, 0}, { 1, 131}, { 1, 132}, { 5, 18}, { 1, 35}, { 1, 133}, { 1, 128}, + { 10, 38}, { 15, 0}, + { 25, 0}, { 9, 45}, { 7, 38}, { 16, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, /* Row 140 */ + { 1, 16}, { 1, 7}, { 7, 4}, { 1, 19}, { 1, 21}, { 1, 22}, { 6, 18}, { 1, 40}, + { 1, 50}, { 1, 107}, { 6, 31}, { 1, 32}, { 1, 56}, { 2, 4}, { 1, 7}, { 1, 9}, + { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 27, 0}, { 1, 134}, { 1, 17}, + { 1, 135}, { 1, 51}, { 1, 45}, { 1, 136}, { 9, 38}, { 1, 48}, { 1, 39}, { 15, 0}, + { 25, 0}, { 16, 38}, { 17, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, /* Row 141 */ + { 1, 7}, { 8, 4}, { 1, 24}, { 1, 21}, { 1, 22}, { 2, 29}, { 1, 67}, { 1, 50}, + { 1, 41}, { 8, 31}, { 1, 16}, { 1, 7}, { 1, 4}, { 1, 7}, { 1, 9}, { 1, 12}, + { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 30, 0}, { 1, 1}, { 11, 38}, { 1, 48}, + { 1, 38}, { 16, 0}, + { 25, 0}, { 16, 38}, { 18, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, /* Row 142 */ + { 1, 7}, { 9, 4}, { 1, 89}, { 1, 137}, { 1, 138}, { 1, 92}, { 8, 31}, { 1, 42}, + { 1, 16}, { 1, 7}, { 1, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, + { 1, 4}, { 1, 5}, { 32, 0}, { 1, 39}, { 1, 48}, { 8, 38}, { 1, 48}, { 1, 38}, + { 17, 0}, + { 25, 0}, { 16, 38}, { 19, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, /* Row 143 */ + { 1, 7}, { 9, 4}, { 1, 7}, { 1, 56}, { 1, 33}, { 1, 32}, { 5, 31}, { 1, 42}, + { 1, 16}, { 1, 8}, { 2, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, + { 1, 4}, { 1, 5}, { 34, 0}, { 8, 38}, { 1, 48}, { 1, 38}, { 18, 0}, + { 25, 0}, { 16, 38}, { 20, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, /* Row 144 */ + { 1, 7}, { 10, 4}, { 1, 7}, { 7, 8}, { 3, 4}, { 1, 7}, { 1, 9}, { 1, 12}, + { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 35, 0}, { 1, 46}, { 7, 38}, { 1, 39}, + { 19, 0}, + { 25, 0}, { 16, 38}, { 21, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, /* Row 145 */ + { 1, 7}, { 19, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, + { 1, 5}, { 64, 0}, + { 25, 0}, { 16, 38}, { 22, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, /* Row 146 */ + { 1, 7}, { 17, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, + { 1, 5}, { 65, 0}, + { 64, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 15, 4}, /* Row 147 */ + { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 66, 0}, + { 65, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 13, 4}, /* Row 148 */ + { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 67, 0}, + { 66, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 11, 4}, /* Row 149 */ + { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 68, 0}, + { 67, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 9, 4}, /* Row 150 */ + { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 69, 0}, + { 68, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 7, 4}, /* Row 151 */ + { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 70, 0}, + { 69, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 5, 4}, /* Row 152 */ + { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 71, 0}, + { 70, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 3, 4}, /* Row 153 */ + { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 72, 0}, + { 71, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 1, 4}, /* Row 154 */ + { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 73, 0}, + { 72, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 1, 9}, /* Row 155 */ + { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 74, 0}, + { 73, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 103}, { 1, 12}, { 1, 13}, /* Row 156 */ + { 1, 6}, { 1, 4}, { 1, 5}, { 75, 0}, + { 74, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 139}, { 1, 13}, { 1, 6}, { 1, 4}, /* Row 157 */ + { 1, 5}, { 76, 0}, + { 75, 0}, { 1, 5}, { 2, 4}, { 1, 3}, { 1, 140}, { 1, 6}, { 1, 4}, { 1, 5}, /* Row 158 */ + { 77, 0}, + { 76, 0}, { 1, 5}, { 4, 4}, { 1, 5}, { 78, 0} /* Row 159 */ +}; + +#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 8 +# ifdef CONFIG_EXAMPLES_NXIMAGE_GREYSCALE + + { 76, 0}, { 1, 1}, { 1, 2}, { 1, 3}, { 4, 4}, { 1, 5}, { 76, 0}, /* Row 0 */ + { 75, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 5, 4}, { 1, 5}, { 75, 0}, /* Row 1 */ + { 74, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 9}, { 1, 10}, /* Row 2 */ + { 4, 4}, { 1, 5}, { 74, 0}, + { 73, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 3 */ + { 1, 12}, { 1, 13}, { 4, 4}, { 1, 5}, { 73, 0}, + { 72, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 4 */ + { 1, 7}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 72, 0}, + { 71, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 5 */ + { 1, 7}, { 2, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 71, 0}, + { 70, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 6 */ + { 1, 7}, { 4, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 70, 0}, + { 69, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 7 */ + { 1, 7}, { 6, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 69, 0}, + { 68, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 8 */ + { 1, 7}, { 8, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 68, 0}, + { 67, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 9 */ + { 1, 7}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 67, 0}, + { 66, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 10 */ + { 1, 7}, { 12, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 66, 0}, + { 65, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 11 */ + { 1, 7}, { 14, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 65, 0}, + { 64, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 12 */ + { 1, 7}, { 16, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 64, 0}, + { 63, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 13 */ + { 1, 7}, { 18, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 63, 0}, + { 62, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 14 */ + { 1, 7}, { 20, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 62, 0}, + { 61, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 15 */ + { 1, 7}, { 22, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 61, 0}, + { 60, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 16 */ + { 1, 7}, { 24, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 60, 0}, + { 59, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 17 */ + { 1, 7}, { 26, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 59, 0}, + { 58, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 18 */ + { 1, 7}, { 28, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 26, 0}, + { 1, 14}, { 5, 15}, { 1, 14}, { 25, 0}, + { 57, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 19 */ + { 1, 7}, { 10, 4}, { 5, 16}, { 15, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, + { 1, 5}, { 23, 0}, { 1, 17}, { 9, 15}, { 1, 17}, { 23, 0}, + { 56, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 20 */ + { 1, 7}, { 9, 4}, { 1, 16}, { 1, 18}, { 1, 19}, { 3, 20}, { 1, 19}, { 1, 18}, + { 1, 21}, { 14, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 22, 0}, + { 11, 15}, { 1, 17}, { 22, 0}, + { 23, 0}, { 1, 14}, { 5, 15}, { 1, 22}, { 25, 0}, { 1, 1}, { 1, 6}, { 1, 7}, /* Row 21 */ + { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 9, 4}, { 1, 16}, { 1, 23}, + { 7, 15}, { 1, 19}, { 1, 24}, { 14, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, + { 1, 5}, { 20, 0}, { 1, 14}, { 12, 15}, { 1, 17}, { 21, 0}, + { 21, 0}, { 1, 17}, { 9, 15}, { 1, 17}, { 22, 0}, { 1, 1}, { 1, 6}, { 1, 7}, /* Row 22 */ + { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 9, 4}, { 1, 16}, { 1, 23}, + { 9, 15}, { 1, 20}, { 1, 24}, { 4, 4}, { 1, 3}, { 9, 4}, { 1, 3}, { 1, 8}, + { 1, 13}, { 4, 4}, { 1, 5}, { 19, 0}, { 14, 15}, { 21, 0}, + { 21, 0}, { 11, 15}, { 1, 17}, { 20, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, /* Row 23 */ + { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 10, 4}, { 1, 18}, { 11, 15}, { 1, 25}, + { 1, 26}, { 2, 27}, { 1, 28}, { 1, 29}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 13}, + { 4, 4}, { 1, 5}, { 17, 0}, { 1, 14}, { 5, 15}, { 1, 30}, { 2, 31}, { 1, 30}, + { 5, 15}, { 1, 14}, { 20, 0}, + { 20, 0}, { 1, 22}, { 12, 15}, { 1, 32}, { 4, 33}, { 1, 7}, { 13, 0}, { 1, 1}, /* Row 24 */ + { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 10, 4}, + { 1, 21}, { 1, 19}, { 4, 15}, { 3, 30}, { 5, 15}, { 1, 34}, { 1, 35}, { 3, 27}, + { 1, 36}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 16, 0}, + { 5, 15}, { 1, 37}, { 4, 38}, { 1, 37}, { 4, 15}, { 1, 39}, { 1, 40}, { 1, 41}, + { 18, 0}, + { 19, 0}, { 1, 14}, { 13, 15}, { 1, 31}, { 1, 40}, { 5, 33}, { 11, 0}, { 1, 1}, /* Row 25 */ + { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 11, 4}, + { 1, 42}, { 4, 15}, { 1, 31}, { 3, 38}, { 1, 37}, { 5, 15}, { 1, 43}, { 4, 27}, + { 1, 36}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 14, 0}, + { 1, 14}, { 4, 15}, { 1, 30}, { 6, 38}, { 1, 30}, { 4, 15}, { 1, 22}, { 1, 33}, + { 1, 41}, { 17, 0}, + { 19, 0}, { 5, 15}, { 1, 30}, { 1, 44}, { 1, 34}, { 1, 31}, { 6, 15}, { 1, 45}, /* Row 26 */ + { 5, 33}, { 1, 7}, { 9, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, + { 1, 7}, { 1, 11}, { 1, 7}, { 11, 4}, { 1, 46}, { 1, 47}, { 4, 15}, { 1, 48}, + { 4, 38}, { 1, 37}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 36}, { 10, 4}, + { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 13, 0}, { 5, 15}, { 1, 34}, + { 6, 38}, { 1, 44}, { 4, 15}, { 1, 45}, { 2, 33}, { 1, 41}, { 16, 0}, + { 18, 0}, { 1, 14}, { 4, 15}, { 1, 37}, { 4, 38}, { 1, 31}, { 5, 15}, { 1, 31}, /* Row 27 */ + { 1, 40}, { 5, 33}, { 8, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, + { 1, 7}, { 1, 11}, { 1, 7}, { 12, 4}, { 1, 16}, { 1, 20}, { 3, 15}, { 1, 31}, + { 6, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 9, 4}, + { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 11, 0}, { 1, 14}, { 4, 15}, + { 1, 30}, { 7, 38}, { 1, 44}, { 4, 15}, { 1, 45}, { 3, 33}, { 16, 0}, + { 18, 0}, { 4, 15}, { 1, 30}, { 5, 38}, { 1, 48}, { 1, 30}, { 5, 15}, { 1, 45}, /* Row 28 */ + { 5, 33}, { 1, 7}, { 6, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, + { 1, 7}, { 1, 11}, { 1, 7}, { 13, 4}, { 1, 16}, { 1, 20}, { 3, 15}, { 1, 19}, + { 6, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, + { 10, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 10, 0}, { 5, 15}, + { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 22}, { 3, 33}, { 1, 7}, { 15, 0}, + { 18, 0}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 31}, { 1, 40}, /* Row 29 */ + { 5, 33}, { 5, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, + { 1, 11}, { 1, 7}, { 14, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, + { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 10, 4}, { 1, 3}, + { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 8, 0}, { 1, 14}, { 4, 15}, { 1, 30}, + { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 4, 33}, { 15, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 5, 15}, { 1, 45}, { 5, 33}, /* Row 30 */ + { 1, 7}, { 3, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, + { 1, 11}, { 1, 7}, { 15, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, + { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 11, 4}, + { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 7, 0}, { 5, 15}, { 1, 34}, + { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, { 5, 33}, { 1, 50}, { 14, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 34}, { 5, 15}, { 1, 31}, { 1, 40}, /* Row 31 */ + { 5, 33}, { 2, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, + { 1, 11}, { 1, 7}, { 16, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 9, 38}, + { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 11, 4}, { 1, 3}, + { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 5, 0}, { 1, 14}, { 4, 15}, { 1, 30}, + { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 5, 33}, { 1, 7}, { 14, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 9, 38}, { 1, 30}, { 5, 15}, { 1, 45}, { 5, 33}, /* Row 32 */ + { 1, 7}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, + { 1, 7}, { 17, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 9, 38}, { 1, 34}, + { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 12, 4}, { 1, 3}, + { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 4, 0}, { 5, 15}, { 1, 34}, { 7, 38}, + { 1, 30}, { 4, 15}, { 1, 45}, { 6, 33}, { 1, 50}, { 14, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 9, 38}, { 1, 34}, { 5, 15}, { 1, 31}, { 1, 40}, /* Row 33 */ + { 4, 33}, { 1, 51}, { 1, 52}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, + { 1, 7}, { 18, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 10, 38}, { 1, 30}, + { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 12, 4}, { 1, 3}, { 1, 8}, + { 1, 13}, { 4, 4}, { 1, 5}, { 2, 0}, { 1, 14}, { 4, 15}, { 1, 30}, { 7, 38}, + { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 15, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 10, 38}, { 1, 30}, { 5, 15}, { 1, 45}, { 3, 33}, /* Row 34 */ + { 1, 53}, { 1, 54}, { 1, 21}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, + { 19, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 10, 38}, { 1, 34}, { 4, 15}, + { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 13, 4}, { 1, 3}, { 1, 8}, + { 1, 13}, { 4, 4}, { 1, 5}, { 1, 0}, { 5, 15}, { 1, 34}, { 7, 38}, { 1, 30}, + { 3, 15}, { 1, 55}, { 1, 56}, { 6, 33}, { 1, 7}, { 15, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 10, 38}, { 1, 34}, { 5, 15}, { 1, 31}, { 1, 40}, /* Row 35 */ + { 1, 33}, { 1, 53}, { 1, 57}, { 1, 27}, { 1, 28}, { 1, 58}, { 1, 7}, { 1, 11}, + { 1, 7}, { 20, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 11, 38}, { 1, 30}, + { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 13, 4}, { 1, 3}, { 1, 8}, + { 1, 13}, { 4, 4}, { 1, 59}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, + { 1, 31}, { 1, 60}, { 6, 33}, { 16, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 11, 38}, { 1, 30}, { 5, 15}, { 1, 61}, { 1, 53}, /* Row 36 */ + { 1, 57}, { 3, 27}, { 1, 62}, { 1, 56}, { 1, 7}, { 21, 4}, { 1, 16}, { 1, 20}, + { 2, 15}, { 1, 30}, { 11, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, + { 1, 28}, { 1, 49}, { 14, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 2, 4}, { 1, 21}, + { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, { 6, 33}, + { 1, 7}, { 16, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 11, 38}, { 1, 34}, { 5, 15}, { 1, 63}, { 1, 35}, /* Row 37 */ + { 5, 27}, { 1, 64}, { 22, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 12, 38}, + { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 14, 4}, { 1, 3}, + { 1, 8}, { 1, 13}, { 1, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, + { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 17, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 12, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, /* Row 38 */ + { 1, 65}, { 1, 3}, { 21, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 12, 38}, + { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 15, 4}, + { 1, 3}, { 1, 8}, { 1, 66}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, + { 4, 15}, { 1, 45}, { 6, 33}, { 1, 7}, { 17, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 12, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, /* Row 39 */ + { 4, 27}, { 1, 28}, { 1, 49}, { 21, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, + { 13, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 16, 4}, + { 1, 67}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, + { 6, 33}, { 18, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 13, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, /* Row 40 */ + { 1, 29}, { 1, 3}, { 20, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 13, 38}, + { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 15, 4}, + { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, + { 6, 33}, { 1, 7}, { 18, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 13, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, /* Row 41 */ + { 4, 27}, { 1, 28}, { 1, 49}, { 20, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, + { 14, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 14, 4}, + { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, + { 6, 33}, { 19, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 14, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, /* Row 42 */ + { 1, 29}, { 1, 3}, { 19, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 14, 38}, + { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 13, 4}, + { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, + { 6, 33}, { 1, 7}, { 19, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 14, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, /* Row 43 */ + { 4, 27}, { 1, 28}, { 1, 49}, { 19, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, + { 7, 38}, { 1, 68}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, + { 1, 3}, { 12, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, + { 1, 31}, { 1, 40}, { 6, 33}, { 20, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 15, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, /* Row 44 */ + { 1, 29}, { 1, 3}, { 18, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, + { 1, 69}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, + { 1, 49}, { 11, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, + { 4, 15}, { 1, 45}, { 6, 33}, { 1, 7}, { 20, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 68}, { 6, 38}, { 1, 34}, { 5, 15}, /* Row 45 */ + { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 18, 4}, { 1, 16}, { 1, 20}, + { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, + { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 10, 4}, { 1, 18}, { 4, 15}, { 1, 30}, + { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 21, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 69}, { 7, 38}, { 1, 30}, { 5, 15}, /* Row 46 */ + { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 17, 4}, { 1, 16}, { 1, 20}, { 2, 15}, + { 1, 30}, { 7, 38}, { 2, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, + { 4, 27}, { 1, 28}, { 1, 49}, { 9, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, + { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, { 6, 33}, { 1, 7}, { 21, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 1, 34}, { 6, 38}, { 1, 34}, /* Row 47 */ + { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 17, 4}, { 1, 16}, + { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 1, 15}, { 1, 34}, { 7, 38}, + { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 8, 4}, { 1, 18}, + { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, + { 22, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 2, 30}, { 7, 38}, { 1, 30}, { 5, 15}, /* Row 48 */ + { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 16, 4}, { 1, 16}, { 1, 20}, { 2, 15}, + { 1, 30}, { 7, 38}, { 1, 30}, { 1, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, + { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 7, 4}, { 1, 21}, { 1, 19}, + { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 70}, { 6, 33}, { 1, 7}, + { 22, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 1, 15}, { 1, 34}, { 6, 38}, /* Row 49 */ + { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 16, 4}, + { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 34}, + { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 6, 4}, + { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 1}, + { 1, 53}, { 5, 33}, { 23, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 1, 15}, { 1, 30}, { 7, 38}, /* Row 50 */ + { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 15, 4}, { 1, 16}, + { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 30}, { 7, 38}, + { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 5, 4}, + { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, + { 1, 27}, { 1, 57}, { 1, 53}, { 3, 33}, { 1, 7}, { 23, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 34}, { 6, 38}, /* Row 51 */ + { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 15, 4}, + { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 3, 15}, { 1, 34}, + { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 4, 4}, + { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, + { 2, 27}, { 1, 57}, { 1, 53}, { 2, 33}, { 24, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 30}, { 7, 38}, /* Row 52 */ + { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 14, 4}, { 1, 16}, + { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 3, 15}, { 1, 30}, { 7, 38}, + { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 3, 4}, + { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, + { 4, 27}, { 1, 57}, { 1, 53}, { 1, 7}, { 24, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 3, 15}, { 1, 34}, { 6, 38}, /* Row 53 */ + { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 14, 4}, + { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 34}, + { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 2, 4}, + { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, + { 5, 27}, { 1, 71}, { 1, 72}, { 24, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 3, 15}, { 1, 30}, { 7, 38}, /* Row 54 */ + { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 13, 4}, { 1, 16}, + { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 30}, { 7, 38}, + { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 1, 4}, + { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, + { 6, 27}, { 1, 28}, { 1, 49}, { 1, 5}, { 23, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, { 1, 34}, { 6, 38}, /* Row 55 */ + { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 13, 4}, + { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 34}, + { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 4}, { 1, 18}, + { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, + { 1, 49}, { 1, 3}, { 1, 4}, { 1, 5}, { 22, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, { 1, 30}, { 7, 38}, /* Row 56 */ + { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 12, 4}, { 1, 16}, + { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 30}, { 7, 38}, + { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 73}, { 1, 19}, + { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 36}, + { 1, 13}, { 3, 4}, { 1, 5}, { 21, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 5, 15}, { 1, 34}, { 6, 38}, /* Row 57 */ + { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 12, 4}, + { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 6, 15}, { 1, 34}, + { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 74}, { 4, 15}, { 1, 30}, + { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49}, + { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 20, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 5, 15}, { 1, 30}, { 7, 38}, /* Row 58 */ + { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 11, 4}, { 1, 16}, + { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 6, 15}, { 1, 30}, { 7, 38}, + { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 3, 27}, { 1, 35}, { 1, 34}, { 4, 15}, + { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 2, 3}, + { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 19, 0}, + { 17, 0}, { 1, 75}, { 1, 55}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 6, 15}, /* Row 59 */ + { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, + { 1, 49}, { 11, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, + { 7, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 3, 27}, { 1, 43}, + { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, + { 1, 28}, { 1, 49}, { 2, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, + { 18, 0}, + { 16, 0}, { 1, 1}, { 1, 76}, { 1, 37}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, /* Row 60 */ + { 6, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, + { 1, 3}, { 10, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, + { 3, 15}, { 1, 37}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, + { 1, 35}, { 1, 27}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, + { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 3, 4}, { 1, 3}, { 1, 8}, + { 1, 13}, { 3, 4}, { 1, 5}, { 17, 0}, + { 15, 0}, { 1, 1}, { 1, 6}, { 1, 73}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, /* Row 61 */ + { 1, 30}, { 7, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, + { 4, 27}, { 1, 28}, { 1, 49}, { 10, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, + { 7, 38}, { 1, 30}, { 2, 15}, { 1, 77}, { 1, 78}, { 4, 15}, { 1, 34}, { 7, 38}, + { 1, 30}, { 4, 15}, { 1, 43}, { 1, 79}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, + { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49}, { 5, 4}, + { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 16, 0}, + { 14, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, /* Row 62 */ + { 8, 38}, { 1, 30}, { 7, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, + { 5, 27}, { 1, 29}, { 1, 3}, { 9, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, + { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 41}, { 1, 34}, { 3, 15}, { 1, 30}, + { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 80}, { 1, 34}, { 4, 15}, { 1, 34}, + { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 6, 4}, + { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 15, 0}, + { 13, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 9}, { 1, 77}, { 2, 15}, /* Row 63 */ + { 1, 30}, { 8, 38}, { 1, 30}, { 3, 15}, { 1, 37}, { 4, 15}, { 1, 34}, { 6, 38}, + { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 9, 4}, + { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, + { 1, 81}, { 1, 43}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 68}, + { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, + { 1, 28}, { 1, 49}, { 8, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, + { 14, 0}, + { 12, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 82}, { 1, 83}, /* Row 64 */ + { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 77}, { 1, 78}, { 4, 15}, + { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, + { 8, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, + { 1, 25}, { 1, 81}, { 1, 35}, { 1, 34}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, + { 9, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, + { 1, 3}, { 9, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 13, 0}, + { 11, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 85}, /* Row 65 */ + { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 41}, + { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, + { 4, 27}, { 1, 28}, { 1, 49}, { 8, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, + { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 1, 27}, { 1, 43}, { 4, 15}, + { 1, 34}, { 7, 38}, { 1, 30}, { 7, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, + { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49}, { 11, 4}, { 1, 3}, { 1, 8}, + { 1, 13}, { 3, 4}, { 1, 5}, { 12, 0}, + { 10, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 66 */ + { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, + { 1, 81}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, + { 5, 27}, { 1, 29}, { 1, 3}, { 7, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, + { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 1, 27}, { 1, 35}, { 1, 34}, + { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 7, 15}, { 1, 34}, { 7, 38}, { 1, 30}, + { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 12, 4}, { 1, 3}, { 1, 8}, + { 1, 13}, { 3, 4}, { 1, 5}, { 11, 0}, + { 9, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 67 */ + { 1, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, + { 1, 25}, { 1, 81}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, + { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 7, 4}, { 1, 16}, + { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, + { 2, 27}, { 1, 43}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 30}, + { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49}, + { 14, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 10, 0}, + { 8, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 68 */ + { 2, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, + { 1, 25}, { 1, 81}, { 1, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, + { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 6, 4}, { 1, 16}, { 1, 20}, + { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 2, 27}, + { 1, 35}, { 1, 34}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 5, 15}, { 1, 34}, + { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 15, 4}, + { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 9, 0}, + { 7, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 69 */ + { 3, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, + { 1, 25}, { 1, 81}, { 1, 27}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38}, + { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 6, 4}, + { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, + { 1, 81}, { 3, 27}, { 1, 43}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 3, 15}, + { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, + { 1, 49}, { 17, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 8, 0}, + { 6, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 70 */ + { 4, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, + { 1, 25}, { 1, 81}, { 2, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, + { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 5, 4}, { 1, 16}, { 1, 20}, + { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 3, 27}, + { 1, 35}, { 1, 34}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 3, 15}, { 1, 34}, + { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 18, 4}, + { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 7, 0}, + { 5, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 71 */ + { 5, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, + { 1, 25}, { 1, 81}, { 2, 27}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38}, + { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 5, 4}, + { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, + { 1, 81}, { 4, 27}, { 1, 43}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 1, 15}, + { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, + { 1, 49}, { 20, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 6, 0}, + { 4, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 72 */ + { 6, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, + { 1, 25}, { 1, 81}, { 3, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, + { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 4, 4}, { 1, 16}, { 1, 20}, + { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 4, 27}, + { 1, 35}, { 1, 34}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 1, 15}, { 1, 34}, + { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 21, 4}, + { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 5, 0}, + { 3, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 73 */ + { 7, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, + { 1, 25}, { 1, 81}, { 3, 27}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38}, + { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 4, 4}, + { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, + { 1, 81}, { 5, 27}, { 1, 43}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 69}, { 7, 38}, + { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49}, { 23, 4}, + { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 4, 0}, + { 2, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 74 */ + { 8, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, + { 1, 25}, { 1, 81}, { 4, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, + { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 3, 4}, { 1, 16}, { 1, 20}, + { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 5, 27}, + { 1, 87}, { 1, 34}, { 3, 15}, { 1, 30}, { 15, 38}, { 1, 30}, { 4, 15}, { 1, 43}, + { 6, 27}, { 1, 29}, { 1, 3}, { 24, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, + { 1, 5}, { 3, 0}, + { 1, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 75 */ + { 9, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, + { 1, 25}, { 1, 81}, { 4, 27}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38}, + { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 3, 4}, + { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, + { 1, 81}, { 6, 27}, { 1, 67}, { 4, 15}, { 1, 34}, { 13, 38}, { 1, 34}, { 4, 15}, + { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49}, { 26, 4}, { 1, 3}, { 1, 8}, + { 1, 13}, { 3, 4}, { 1, 5}, { 2, 0}, + { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, { 10, 4}, /* Row 76 */ + { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, + { 1, 81}, { 5, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, + { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 2, 4}, { 1, 16}, { 1, 20}, { 2, 15}, + { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 21}, + { 1, 19}, { 3, 15}, { 1, 30}, { 13, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, + { 1, 29}, { 1, 3}, { 27, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, + { 1, 0}, + { 1, 2}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, { 11, 4}, { 1, 16}, /* Row 77 */ + { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, + { 5, 27}, { 1, 87}, { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, + { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 2, 4}, { 1, 16}, { 1, 20}, + { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, + { 1, 4}, { 1, 18}, { 4, 15}, { 1, 34}, { 11, 38}, { 1, 34}, { 4, 15}, { 1, 34}, + { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49}, { 29, 4}, { 1, 3}, { 1, 8}, { 1, 13}, + { 3, 4}, { 1, 5}, + { 1, 3}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, { 12, 4}, { 1, 16}, { 1, 20}, /* Row 78 */ + { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, + { 1, 67}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, + { 1, 29}, { 1, 3}, { 1, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, + { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 4}, { 1, 21}, { 1, 19}, + { 3, 15}, { 1, 30}, { 11, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, + { 1, 3}, { 30, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, + { 1, 4}, { 1, 88}, { 1, 89}, { 1, 86}, { 13, 4}, { 1, 16}, { 1, 20}, { 2, 15}, /* Row 79 */ + { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 21}, + { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, + { 4, 27}, { 1, 28}, { 1, 49}, { 1, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, + { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 2, 4}, { 1, 6}, + { 4, 15}, { 1, 34}, { 9, 38}, { 1, 19}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, + { 1, 28}, { 1, 49}, { 32, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 1, 49}, { 1, 3}, + { 2, 4}, { 1, 90}, { 1, 8}, { 1, 3}, { 12, 4}, { 1, 16}, { 1, 20}, { 2, 15}, /* Row 80 */ + { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 4}, + { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, + { 1, 29}, { 1, 3}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, + { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 2, 4}, { 1, 6}, { 4, 15}, { 1, 69}, + { 9, 38}, { 1, 31}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 33, 4}, + { 1, 3}, { 1, 91}, { 1, 81}, { 1, 4}, + { 3, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 11, 4}, { 1, 16}, { 1, 20}, { 2, 15}, /* Row 81 */ + { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 4}, + { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34}, + { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, + { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 4}, { 1, 21}, + { 1, 19}, { 4, 15}, { 1, 34}, { 8, 38}, { 1, 92}, { 4, 15}, { 1, 68}, { 1, 93}, + { 6, 27}, { 1, 49}, { 33, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 56}, { 1, 8}, + { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 10, 4}, { 1, 16}, { 1, 20}, { 2, 15}, /* Row 82 */ + { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 2, 4}, + { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, + { 1, 29}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, + { 1, 25}, { 1, 81}, { 6, 27}, { 1, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 10, 38}, + { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 49}, { 32, 4}, { 1, 3}, { 1, 8}, + { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, + { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 9, 4}, { 1, 16}, { 1, 20}, /* Row 83 */ + { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, + { 2, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, + { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 7}, { 1, 20}, { 2, 15}, { 1, 30}, + { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 21}, { 1, 19}, + { 4, 15}, { 1, 34}, { 10, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, + { 1, 29}, { 1, 3}, { 30, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, + { 1, 4}, { 1, 5}, + { 1, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 8, 4}, { 1, 16}, /* Row 84 */ + { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, + { 6, 27}, { 3, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, + { 1, 43}, { 5, 27}, { 1, 10}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, + { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 67}, { 4, 15}, { 1, 30}, { 12, 38}, + { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 29, 4}, { 1, 3}, + { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 1, 0}, + { 2, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 7, 4}, { 1, 16}, /* Row 85 */ + { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, + { 6, 27}, { 3, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, + { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 81}, { 1, 77}, { 2, 15}, { 1, 30}, + { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 5, 27}, { 1, 87}, { 1, 34}, + { 4, 15}, { 1, 34}, { 12, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, + { 1, 29}, { 1, 3}, { 27, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, + { 1, 4}, { 1, 5}, { 2, 0}, + { 3, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 6, 4}, { 1, 16}, /* Row 86 */ + { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, + { 6, 27}, { 4, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, + { 1, 43}, { 4, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, + { 2, 15}, { 1, 25}, { 1, 81}, { 5, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 14, 38}, + { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 26, 4}, { 1, 3}, + { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 3, 0}, + { 4, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 5, 4}, { 1, 16}, /* Row 87 */ + { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, + { 6, 27}, { 4, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, + { 5, 15}, { 1, 34}, { 1, 35}, { 3, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, + { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 4, 27}, { 1, 35}, { 1, 34}, + { 4, 15}, { 1, 34}, { 14, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, + { 1, 29}, { 1, 3}, { 24, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, + { 1, 4}, { 1, 5}, { 4, 0}, + { 5, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 4, 4}, { 1, 16}, /* Row 88 */ + { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, + { 6, 27}, { 5, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, + { 1, 43}, { 3, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, + { 2, 15}, { 1, 25}, { 1, 81}, { 4, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 16, 38}, + { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 23, 4}, { 1, 3}, + { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 5, 0}, + { 6, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 3, 4}, { 1, 16}, /* Row 89 */ + { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, + { 6, 27}, { 5, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, + { 5, 15}, { 1, 34}, { 1, 35}, { 2, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, + { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 3, 27}, { 1, 35}, { 1, 34}, + { 4, 15}, { 1, 34}, { 7, 38}, { 1, 34}, { 1, 69}, { 7, 38}, { 1, 34}, { 4, 15}, + { 1, 34}, { 1, 35}, { 5, 27}, { 1, 29}, { 1, 3}, { 21, 4}, { 1, 3}, { 1, 8}, + { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 6, 0}, + { 7, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 2, 4}, { 1, 16}, /* Row 90 */ + { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, + { 6, 27}, { 6, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, + { 1, 43}, { 2, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, + { 2, 15}, { 1, 25}, { 1, 81}, { 3, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 8, 38}, + { 1, 30}, { 1, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, + { 1, 28}, { 1, 49}, { 20, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, + { 1, 4}, { 1, 5}, { 7, 0}, + { 8, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 1, 4}, { 1, 16}, /* Row 91 */ + { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, + { 6, 27}, { 6, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, + { 5, 15}, { 1, 34}, { 1, 35}, { 1, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, + { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 2, 27}, { 1, 35}, { 1, 34}, + { 4, 15}, { 1, 34}, { 7, 38}, { 1, 34}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 34}, + { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 29}, { 1, 3}, { 18, 4}, { 1, 3}, + { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 8, 0}, + { 9, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 1, 16}, { 1, 20}, /* Row 92 */ + { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, + { 7, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, + { 1, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, + { 1, 25}, { 1, 81}, { 2, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 8, 38}, { 1, 30}, + { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, + { 1, 49}, { 17, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, + { 1, 5}, { 9, 0}, + { 10, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 16}, { 1, 20}, { 2, 15}, /* Row 93 */ + { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 7, 4}, + { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34}, + { 1, 35}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, + { 1, 25}, { 1, 81}, { 1, 27}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 7, 38}, + { 1, 34}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, + { 5, 27}, { 1, 29}, { 1, 3}, { 15, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, + { 1, 7}, { 1, 4}, { 1, 5}, { 10, 0}, + { 11, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 73}, { 1, 20}, { 2, 15}, { 1, 30}, /* Row 94 */ + { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 8, 4}, { 1, 18}, + { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 1, 81}, { 1, 25}, + { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 1, 27}, + { 1, 43}, { 4, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 5, 15}, { 1, 34}, { 7, 38}, + { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 14, 4}, { 1, 3}, + { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 11, 0}, + { 12, 0}, { 1, 5}, { 4, 4}, { 1, 57}, { 1, 77}, { 2, 15}, { 1, 30}, { 8, 38}, /* Row 95 */ + { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 8, 4}, { 1, 21}, { 1, 19}, + { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 41}, { 1, 25}, + { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 1, 35}, + { 1, 34}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 34}, { 6, 15}, { 1, 30}, { 7, 38}, + { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 29}, { 1, 3}, { 12, 4}, + { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 12, 0}, + { 13, 0}, { 1, 5}, { 3, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, /* Row 96 */ + { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 9, 4}, { 1, 18}, { 4, 15}, + { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 78}, { 1, 77}, { 2, 15}, { 1, 30}, + { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 1, 43}, { 4, 15}, { 1, 30}, + { 8, 38}, { 1, 30}, { 7, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, + { 5, 27}, { 1, 28}, { 1, 49}, { 11, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, + { 1, 7}, { 1, 4}, { 1, 5}, { 13, 0}, + { 14, 0}, { 1, 5}, { 2, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, /* Row 97 */ + { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 9, 4}, { 1, 21}, { 1, 19}, + { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 37}, { 3, 15}, { 1, 30}, + { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 41}, { 1, 34}, { 4, 15}, { 1, 34}, + { 7, 38}, { 1, 34}, { 4, 15}, { 1, 37}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, + { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 29}, { 1, 3}, { 9, 4}, { 1, 3}, + { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 14, 0}, + { 15, 0}, { 1, 5}, { 1, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, /* Row 98 */ + { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 10, 4}, { 1, 18}, { 4, 15}, + { 1, 30}, { 7, 38}, { 1, 30}, { 8, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, + { 1, 77}, { 1, 78}, { 4, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, { 1, 78}, + { 1, 34}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, + { 1, 28}, { 1, 49}, { 8, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, + { 1, 4}, { 1, 5}, { 15, 0}, + { 16, 0}, { 1, 5}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, /* Row 99 */ + { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 10, 4}, { 1, 21}, { 1, 19}, { 4, 15}, + { 1, 34}, { 6, 38}, { 1, 34}, { 8, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 3, 15}, + { 1, 37}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 94}, + { 1, 43}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, + { 5, 27}, { 1, 29}, { 1, 3}, { 6, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, + { 1, 7}, { 1, 4}, { 1, 5}, { 16, 0}, + { 17, 0}, { 1, 95}, { 1, 96}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, /* Row 100 */ + { 1, 25}, { 1, 81}, { 6, 27}, { 11, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, + { 1, 30}, { 7, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 7, 15}, { 1, 30}, { 8, 38}, + { 1, 30}, { 4, 15}, { 1, 43}, { 1, 27}, { 1, 35}, { 1, 34}, { 3, 15}, { 1, 34}, + { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 5, 4}, + { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 17, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 101 */ + { 6, 27}, { 11, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, + { 7, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 7, 15}, { 1, 34}, { 7, 38}, { 1, 34}, + { 4, 15}, { 1, 34}, { 1, 35}, { 2, 27}, { 1, 43}, { 3, 15}, { 1, 30}, { 7, 38}, + { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 29}, { 1, 3}, { 3, 4}, + { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 18, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 102 */ + { 6, 27}, { 12, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 6, 15}, + { 1, 30}, { 7, 38}, { 1, 30}, { 6, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, + { 1, 43}, { 3, 27}, { 1, 35}, { 1, 34}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, + { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 2, 4}, { 1, 3}, { 1, 8}, + { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 19, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 103 */ + { 6, 27}, { 12, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, + { 6, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 6, 15}, { 1, 34}, { 7, 38}, { 1, 34}, + { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 43}, { 3, 15}, { 1, 30}, { 7, 38}, + { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 29}, { 2, 3}, { 1, 8}, + { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 20, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 104 */ + { 6, 27}, { 13, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, + { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, + { 1, 43}, { 5, 27}, { 1, 35}, { 1, 34}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, + { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 1, 8}, { 1, 7}, { 1, 11}, + { 1, 7}, { 1, 4}, { 1, 5}, { 21, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 105 */ + { 6, 27}, { 13, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, + { 5, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 34}, { 7, 38}, { 1, 34}, + { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 74}, { 3, 15}, { 1, 30}, { 7, 38}, + { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 36}, { 1, 7}, { 1, 11}, + { 1, 7}, { 1, 4}, { 1, 5}, { 22, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 106 */ + { 6, 27}, { 14, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 4, 15}, + { 1, 30}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, + { 1, 43}, { 6, 27}, { 1, 28}, { 1, 73}, { 1, 19}, { 3, 15}, { 1, 34}, { 7, 38}, + { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 54}, { 1, 97}, { 1, 7}, { 1, 4}, + { 1, 5}, { 23, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 107 */ + { 6, 27}, { 14, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, + { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 34}, + { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 4}, { 1, 18}, { 3, 15}, + { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 98}, + { 1, 4}, { 1, 5}, { 24, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 108 */ + { 6, 27}, { 15, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 3, 15}, + { 1, 30}, { 7, 38}, { 1, 30}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, + { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, { 1, 4}, { 1, 21}, { 1, 19}, { 3, 15}, + { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 4, 27}, { 1, 57}, { 1, 99}, + { 1, 9}, { 25, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 109 */ + { 6, 27}, { 15, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, + { 3, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 34}, + { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 2, 4}, { 1, 18}, + { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 2, 27}, + { 1, 57}, { 1, 53}, { 2, 33}, { 25, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 110 */ + { 6, 27}, { 16, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, + { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, + { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, { 3, 4}, { 1, 21}, { 1, 19}, { 3, 15}, + { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 1, 27}, { 1, 57}, { 1, 53}, + { 3, 33}, { 1, 7}, { 24, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 111 */ + { 6, 27}, { 16, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, + { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 34}, { 7, 38}, { 1, 34}, + { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 4, 4}, { 1, 18}, + { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 1}, { 1, 53}, + { 5, 33}, { 24, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 112 */ + { 6, 27}, { 17, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 1, 15}, + { 1, 30}, { 7, 38}, { 1, 30}, { 1, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, + { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, { 5, 4}, { 1, 21}, { 1, 19}, { 3, 15}, + { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 70}, { 6, 33}, { 1, 7}, { 23, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 113 */ + { 6, 27}, { 17, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, + { 1, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 1, 15}, { 1, 34}, { 7, 38}, { 1, 34}, + { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 6, 4}, { 1, 18}, + { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, + { 23, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 114 */ + { 6, 27}, { 18, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 2, 30}, { 7, 38}, + { 2, 30}, { 8, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, + { 7, 4}, { 1, 21}, { 1, 19}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, + { 1, 45}, { 6, 33}, { 1, 7}, { 22, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 115 */ + { 6, 27}, { 18, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, + { 1, 30}, { 7, 38}, { 1, 30}, { 1, 34}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, + { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 8, 4}, { 1, 18}, { 3, 15}, { 1, 30}, + { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 22, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 77}, { 1, 100}, /* Row 116 */ + { 6, 27}, { 19, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 69}, { 7, 38}, + { 1, 69}, { 8, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, + { 9, 4}, { 1, 21}, { 1, 19}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, + { 1, 45}, { 6, 33}, { 1, 7}, { 21, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 101}, /* Row 117 */ + { 1, 57}, { 5, 27}, { 19, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, + { 1, 68}, { 7, 38}, { 1, 68}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, + { 6, 27}, { 1, 29}, { 1, 3}, { 10, 4}, { 1, 18}, { 3, 15}, { 1, 30}, { 7, 38}, + { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 21, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 118 */ + { 1, 53}, { 1, 57}, { 4, 27}, { 1, 8}, { 1, 3}, { 18, 4}, { 1, 18}, { 4, 15}, + { 1, 30}, { 22, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, + { 11, 4}, { 1, 21}, { 1, 19}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, + { 1, 45}, { 6, 33}, { 1, 7}, { 20, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 119 */ + { 1, 33}, { 1, 53}, { 1, 57}, { 3, 27}, { 1, 36}, { 1, 8}, { 1, 3}, { 17, 4}, + { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 20, 38}, { 1, 34}, { 4, 15}, { 1, 34}, + { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 12, 4}, { 1, 18}, { 3, 15}, { 1, 30}, + { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 20, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 120 */ + { 2, 33}, { 1, 53}, { 1, 57}, { 2, 27}, { 1, 49}, { 1, 13}, { 1, 8}, { 1, 3}, + { 17, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 20, 38}, { 1, 30}, { 4, 15}, { 1, 43}, + { 6, 27}, { 1, 28}, { 1, 49}, { 12, 4}, { 1, 3}, { 1, 79}, { 1, 63}, { 3, 15}, + { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, { 6, 33}, { 1, 7}, { 19, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 121 */ + { 3, 33}, { 1, 53}, { 1, 57}, { 1, 27}, { 2, 4}, { 1, 13}, { 1, 8}, { 1, 3}, + { 16, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 18, 38}, { 1, 34}, { 4, 15}, + { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 11, 4}, { 1, 3}, { 1, 8}, + { 1, 7}, { 1, 102}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, + { 1, 40}, { 6, 33}, { 19, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 122 */ + { 4, 33}, { 1, 53}, { 1, 62}, { 3, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 16, 4}, + { 1, 18}, { 4, 15}, { 1, 30}, { 18, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, + { 1, 28}, { 1, 49}, { 11, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 79}, + { 1, 19}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, { 6, 33}, + { 1, 7}, { 18, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 123 */ + { 5, 33}, { 1, 103}, { 1, 3}, { 3, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 15, 4}, + { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 16, 38}, { 1, 34}, { 4, 15}, { 1, 34}, + { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 7}, + { 1, 11}, { 1, 7}, { 1, 4}, { 1, 53}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, + { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 18, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 124 */ + { 6, 33}, { 1, 95}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 15, 4}, { 1, 18}, + { 4, 15}, { 1, 30}, { 16, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 28}, + { 1, 49}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, + { 1, 5}, { 1, 27}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, + { 6, 33}, { 1, 7}, { 17, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 125 */ + { 6, 33}, { 1, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 14, 4}, + { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 14, 38}, { 1, 34}, { 4, 15}, { 1, 34}, + { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 9, 4}, { 1, 3}, { 1, 8}, { 1, 7}, + { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 2, 0}, { 1, 14}, { 3, 15}, { 1, 30}, + { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 17, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 126 */ + { 6, 33}, { 2, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 14, 4}, + { 1, 18}, { 4, 15}, { 1, 30}, { 14, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, + { 1, 28}, { 1, 49}, { 9, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, + { 1, 4}, { 1, 5}, { 4, 0}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, + { 1, 45}, { 6, 33}, { 1, 7}, { 16, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 127 */ + { 6, 33}, { 3, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 13, 4}, + { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 12, 38}, { 1, 34}, { 4, 15}, { 1, 34}, + { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 8, 4}, { 1, 3}, { 1, 8}, { 1, 7}, + { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 5, 0}, { 1, 14}, { 3, 15}, { 1, 30}, + { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 16, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 128 */ + { 6, 33}, { 4, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 13, 4}, + { 1, 18}, { 4, 15}, { 1, 30}, { 12, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, + { 1, 28}, { 1, 49}, { 8, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, + { 1, 4}, { 1, 5}, { 7, 0}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, + { 1, 45}, { 6, 33}, { 1, 7}, { 15, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 129 */ + { 6, 33}, { 5, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 12, 4}, + { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 10, 38}, { 1, 34}, { 4, 15}, { 1, 34}, + { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 7, 4}, { 1, 3}, { 1, 8}, { 1, 7}, + { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 8, 0}, { 1, 14}, { 3, 15}, { 1, 30}, + { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 15, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 130 */ + { 6, 33}, { 6, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 12, 4}, + { 1, 18}, { 4, 15}, { 1, 30}, { 10, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, + { 1, 28}, { 1, 49}, { 7, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, + { 1, 4}, { 1, 5}, { 10, 0}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, + { 1, 22}, { 6, 33}, { 1, 104}, { 14, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 131 */ + { 6, 33}, { 7, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 11, 4}, + { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 8, 38}, { 1, 34}, { 4, 15}, { 1, 34}, + { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 6, 4}, { 1, 3}, { 1, 8}, { 1, 7}, + { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 11, 0}, { 1, 14}, { 3, 15}, { 1, 30}, + { 7, 38}, { 1, 44}, { 4, 15}, { 1, 45}, { 6, 33}, { 1, 65}, { 14, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 132 */ + { 6, 33}, { 8, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 11, 4}, + { 1, 18}, { 4, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, + { 1, 28}, { 1, 49}, { 6, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, + { 1, 4}, { 1, 5}, { 13, 0}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 4, 15}, + { 1, 45}, { 7, 33}, { 14, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 133 */ + { 6, 33}, { 9, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 10, 4}, + { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 4, 15}, { 1, 34}, + { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 5, 4}, { 1, 3}, { 1, 8}, { 1, 7}, + { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 14, 0}, { 1, 14}, { 3, 15}, { 1, 30}, + { 6, 38}, { 1, 44}, { 3, 15}, { 1, 55}, { 1, 105}, { 7, 33}, { 1, 104}, { 13, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 134 */ + { 6, 33}, { 10, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 10, 4}, + { 1, 18}, { 4, 15}, { 1, 30}, { 1, 106}, { 4, 38}, { 1, 106}, { 1, 30}, { 4, 15}, + { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, { 5, 4}, { 1, 3}, { 1, 8}, { 1, 7}, + { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 16, 0}, { 4, 15}, { 1, 34}, { 5, 38}, + { 1, 30}, { 3, 15}, { 1, 31}, { 1, 60}, { 7, 33}, { 1, 7}, { 13, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 135 */ + { 6, 33}, { 11, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 9, 4}, + { 1, 21}, { 1, 19}, { 4, 15}, { 1, 30}, { 1, 34}, { 2, 38}, { 1, 34}, { 1, 30}, + { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 4, 4}, { 1, 3}, + { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 17, 0}, { 1, 14}, + { 3, 15}, { 1, 30}, { 1, 34}, { 2, 38}, { 1, 34}, { 1, 30}, { 4, 15}, { 1, 45}, + { 8, 33}, { 1, 7}, { 13, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 136 */ + { 6, 33}, { 12, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 9, 4}, + { 1, 18}, { 6, 15}, { 2, 30}, { 6, 15}, { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, + { 4, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, + { 19, 0}, { 5, 15}, { 2, 30}, { 5, 15}, { 1, 31}, { 1, 40}, { 8, 33}, { 1, 50}, + { 13, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 137 */ + { 6, 33}, { 13, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 8, 4}, + { 1, 21}, { 1, 19}, { 12, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, + { 3, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, + { 20, 0}, { 1, 14}, { 10, 15}, { 1, 39}, { 1, 107}, { 9, 33}, { 14, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 138 */ + { 6, 33}, { 14, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 8, 4}, + { 1, 18}, { 12, 15}, { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, { 3, 4}, { 1, 3}, + { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 22, 0}, { 9, 15}, + { 1, 39}, { 1, 107}, { 9, 33}, { 1, 7}, { 14, 0}, + { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 55}, { 2, 96}, { 1, 108}, { 1, 60}, /* Row 139 */ + { 6, 33}, { 15, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 7, 4}, + { 1, 16}, { 1, 23}, { 10, 15}, { 1, 109}, { 1, 81}, { 6, 27}, { 1, 29}, { 1, 3}, + { 2, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, + { 23, 0}, { 1, 28}, { 1, 110}, { 5, 15}, { 1, 39}, { 1, 111}, { 1, 105}, { 10, 33}, + { 15, 0}, + { 25, 0}, { 1, 59}, { 4, 40}, { 4, 60}, { 7, 33}, { 16, 0}, { 1, 5}, { 4, 4}, /* Row 140 */ + { 1, 13}, { 1, 8}, { 1, 3}, { 7, 4}, { 1, 16}, { 1, 18}, { 1, 19}, { 6, 15}, + { 1, 34}, { 1, 43}, { 1, 81}, { 6, 27}, { 1, 28}, { 1, 49}, { 2, 4}, { 1, 3}, + { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 27, 0}, { 1, 112}, + { 1, 14}, { 1, 113}, { 1, 22}, { 1, 40}, { 1, 76}, { 10, 33}, { 1, 7}, { 15, 0}, + { 25, 0}, { 16, 33}, { 17, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, /* Row 141 */ + { 8, 4}, { 1, 21}, { 1, 18}, { 1, 19}, { 1, 77}, { 1, 25}, { 1, 34}, { 1, 43}, + { 1, 35}, { 8, 27}, { 1, 8}, { 1, 3}, { 1, 4}, { 1, 3}, { 1, 8}, { 1, 7}, + { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 30, 0}, { 1, 50}, { 13, 33}, { 16, 0}, + { 25, 0}, { 16, 33}, { 18, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, /* Row 142 */ + { 9, 4}, { 1, 16}, { 1, 10}, { 1, 66}, { 1, 81}, { 8, 27}, { 1, 36}, { 1, 8}, + { 1, 3}, { 1, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, + { 1, 5}, { 32, 0}, { 1, 7}, { 11, 33}, { 17, 0}, + { 25, 0}, { 16, 33}, { 19, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, /* Row 143 */ + { 9, 4}, { 1, 3}, { 1, 49}, { 1, 29}, { 1, 28}, { 5, 27}, { 1, 36}, { 1, 8}, + { 3, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, + { 34, 0}, { 10, 33}, { 18, 0}, + { 25, 0}, { 16, 33}, { 20, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, /* Row 144 */ + { 10, 4}, { 1, 3}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, + { 1, 4}, { 1, 5}, { 35, 0}, { 1, 41}, { 7, 33}, { 1, 7}, { 19, 0}, + { 25, 0}, { 16, 33}, { 21, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, /* Row 145 */ + { 19, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, + { 64, 0}, + { 25, 0}, { 16, 33}, { 22, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, /* Row 146 */ + { 17, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, + { 65, 0}, + { 64, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 15, 4}, { 1, 3}, /* Row 147 */ + { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 66, 0}, + { 65, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 13, 4}, { 1, 3}, /* Row 148 */ + { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 67, 0}, + { 66, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 11, 4}, { 1, 3}, /* Row 149 */ + { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 68, 0}, + { 67, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 9, 4}, { 1, 3}, /* Row 150 */ + { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 69, 0}, + { 68, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 7, 4}, { 1, 3}, /* Row 151 */ + { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 70, 0}, + { 69, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 5, 4}, { 1, 3}, /* Row 152 */ + { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 71, 0}, + { 70, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 3, 4}, { 1, 3}, /* Row 153 */ + { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 72, 0}, + { 71, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 1, 4}, { 1, 3}, /* Row 154 */ + { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 73, 0}, + { 72, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 1, 8}, { 1, 7}, /* Row 155 */ + { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 74, 0}, + { 73, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 91}, { 1, 7}, { 1, 11}, { 1, 7}, /* Row 156 */ + { 1, 4}, { 1, 5}, { 75, 0}, + { 74, 0}, { 1, 5}, { 4, 4}, { 1, 114}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, /* Row 157 */ + { 76, 0}, + { 75, 0}, { 1, 5}, { 2, 4}, { 1, 8}, { 1, 115}, { 1, 7}, { 1, 4}, { 1, 5}, /* Row 158 */ + { 77, 0}, + { 76, 0}, { 1, 5}, { 4, 4}, { 1, 5}, { 78, 0} /* Row 159 */ + +# else /* CONFIG_EXAMPLES_NXIMAGE_GREYSCALE */ + +static const struct pix_run_s g_nuttx[] = +{ + { 76, 0}, { 1, 1}, { 1, 2}, { 5, 3}, { 1, 4}, { 76, 0}, /* Row 0 */ + { 75, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 6, 3}, { 1, 4}, { 75, 0}, /* Row 1 */ + { 74, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 2, 6}, { 4, 3}, { 1, 4}, /* Row 2 */ + { 74, 0}, + { 73, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 8}, /* Row 3 */ + { 1, 6}, { 4, 3}, { 1, 4}, { 73, 0}, + { 72, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 4 */ + { 2, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 72, 0}, + { 71, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 5 */ + { 4, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 71, 0}, + { 70, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 6 */ + { 6, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 70, 0}, + { 69, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 7 */ + { 8, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 69, 0}, + { 68, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 8 */ + { 10, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 68, 0}, + { 67, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 9 */ + { 12, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 67, 0}, + { 66, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 10 */ + { 14, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 66, 0}, + { 65, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 11 */ + { 16, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 65, 0}, + { 64, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 12 */ + { 18, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 64, 0}, + { 63, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 13 */ + { 20, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 63, 0}, + { 62, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 14 */ + { 22, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 62, 0}, + { 61, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 15 */ + { 24, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 61, 0}, + { 60, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 16 */ + { 26, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 60, 0}, + { 59, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 17 */ + { 28, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 59, 0}, + { 58, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 18 */ + { 30, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 26, 0}, { 1, 9}, { 5, 10}, { 1, 9}, + { 25, 0}, + { 57, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 19 */ + { 10, 3}, { 5, 5}, { 17, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 23, 0}, { 1, 1}, + { 9, 10}, { 1, 1}, { 23, 0}, + { 56, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 20 */ + { 9, 3}, { 1, 5}, { 1, 11}, { 5, 12}, { 1, 11}, { 1, 13}, { 16, 3}, { 1, 6}, + { 4, 3}, { 1, 4}, { 22, 0}, { 11, 10}, { 1, 1}, { 22, 0}, + { 23, 0}, { 1, 9}, { 5, 10}, { 1, 14}, { 25, 0}, { 1, 1}, { 1, 2}, { 1, 5}, /* Row 21 */ + { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 9, 3}, { 1, 5}, { 1, 15}, { 7, 10}, + { 1, 12}, { 1, 16}, { 16, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 20, 0}, { 1, 9}, + { 12, 10}, { 1, 1}, { 21, 0}, + { 21, 0}, { 1, 1}, { 9, 10}, { 1, 1}, { 22, 0}, { 1, 1}, { 1, 2}, { 1, 5}, /* Row 22 */ + { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 9, 3}, { 1, 5}, { 1, 15}, { 9, 10}, + { 1, 12}, { 1, 16}, { 16, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 19, 0}, { 14, 10}, + { 21, 0}, + { 21, 0}, { 11, 10}, { 1, 1}, { 20, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, /* Row 23 */ + { 1, 7}, { 1, 2}, { 1, 5}, { 10, 3}, { 1, 11}, { 11, 10}, { 1, 12}, { 1, 7}, + { 3, 6}, { 1, 5}, { 12, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 17, 0}, { 1, 9}, + { 6, 10}, { 2, 12}, { 6, 10}, { 1, 9}, { 20, 0}, + { 20, 0}, { 1, 14}, { 12, 10}, { 1, 9}, { 4, 2}, { 1, 17}, { 13, 0}, { 1, 1}, /* Row 24 */ + { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 10, 3}, { 1, 13}, + { 1, 12}, { 12, 10}, { 1, 12}, { 5, 6}, { 12, 3}, { 1, 6}, { 4, 3}, { 1, 4}, + { 16, 0}, { 5, 10}, { 6, 12}, { 4, 10}, { 1, 12}, { 1, 18}, { 1, 1}, { 18, 0}, + { 19, 0}, { 1, 9}, { 13, 10}, { 1, 12}, { 1, 18}, { 5, 2}, { 11, 0}, { 1, 1}, /* Row 25 */ + { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 11, 3}, { 1, 19}, + { 4, 10}, { 5, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 12, 3}, { 1, 6}, { 4, 3}, + { 1, 4}, { 14, 0}, { 1, 9}, { 5, 10}, { 6, 12}, { 5, 10}, { 1, 14}, { 1, 2}, + { 1, 1}, { 17, 0}, + { 19, 0}, { 6, 10}, { 3, 12}, { 6, 10}, { 1, 14}, { 5, 2}, { 1, 17}, { 9, 0}, /* Row 26 */ + { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 11, 3}, + { 1, 5}, { 1, 14}, { 4, 10}, { 6, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 12, 3}, + { 1, 6}, { 4, 3}, { 1, 4}, { 13, 0}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 14}, + { 2, 2}, { 1, 1}, { 16, 0}, + { 18, 0}, { 1, 9}, { 4, 10}, { 6, 12}, { 5, 10}, { 1, 12}, { 1, 18}, { 5, 2}, /* Row 27 */ + { 8, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, + { 12, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 5, 10}, { 1, 11}, { 5, 6}, + { 1, 5}, { 12, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 11, 0}, { 1, 9}, { 5, 10}, + { 8, 12}, { 4, 10}, { 1, 14}, { 3, 2}, { 16, 0}, + { 18, 0}, { 5, 10}, { 6, 12}, { 6, 10}, { 1, 14}, { 5, 2}, { 1, 17}, { 6, 0}, /* Row 28 */ + { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 13, 3}, + { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 13, 3}, + { 1, 6}, { 4, 3}, { 1, 4}, { 10, 0}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 14}, + { 3, 2}, { 1, 17}, { 15, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 1, 18}, { 5, 2}, { 5, 0}, /* Row 29 */ + { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 14, 3}, + { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, + { 13, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 8, 0}, { 1, 9}, { 5, 10}, { 8, 12}, + { 4, 10}, { 1, 12}, { 1, 18}, { 4, 2}, { 15, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 6, 10}, { 1, 14}, { 5, 2}, { 1, 17}, { 3, 0}, /* Row 30 */ + { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 15, 3}, + { 1, 5}, { 1, 12}, { 3, 10}, { 9, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 14, 3}, + { 1, 6}, { 4, 3}, { 1, 4}, { 7, 0}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 14}, + { 5, 2}, { 1, 1}, { 14, 0}, + { 18, 0}, { 4, 10}, { 9, 12}, { 5, 10}, { 1, 12}, { 1, 18}, { 5, 2}, { 2, 0}, /* Row 31 */ + { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 16, 3}, + { 1, 5}, { 1, 12}, { 3, 10}, { 9, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, + { 14, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 5, 0}, { 1, 9}, { 5, 10}, { 8, 12}, + { 4, 10}, { 1, 12}, { 1, 18}, { 5, 2}, { 1, 17}, { 14, 0}, + { 18, 0}, { 4, 10}, { 9, 12}, { 6, 10}, { 1, 14}, { 5, 2}, { 1, 17}, { 1, 1}, /* Row 32 */ + { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 17, 3}, { 1, 5}, + { 1, 12}, { 3, 10}, { 10, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 15, 3}, { 1, 6}, + { 4, 3}, { 1, 4}, { 4, 0}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, + { 1, 1}, { 14, 0}, + { 18, 0}, { 4, 10}, { 10, 12}, { 5, 10}, { 1, 12}, { 1, 18}, { 4, 2}, { 1, 18}, /* Row 33 */ + { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 18, 3}, { 1, 5}, + { 1, 12}, { 3, 10}, { 10, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 15, 3}, + { 1, 6}, { 4, 3}, { 1, 4}, { 2, 0}, { 1, 9}, { 5, 10}, { 8, 12}, { 4, 10}, + { 1, 12}, { 1, 18}, { 6, 2}, { 15, 0}, + { 18, 0}, { 4, 10}, { 10, 12}, { 6, 10}, { 1, 14}, { 3, 2}, { 1, 20}, { 1, 6}, /* Row 34 */ + { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 19, 3}, { 1, 5}, { 1, 12}, + { 3, 10}, { 11, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 16, 3}, { 1, 6}, { 4, 3}, + { 1, 4}, { 1, 0}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 2}, { 1, 17}, + { 15, 0}, + { 18, 0}, { 4, 10}, { 11, 12}, { 5, 10}, { 1, 12}, { 1, 18}, { 1, 2}, { 1, 20}, /* Row 35 */ + { 3, 6}, { 1, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 20, 3}, { 1, 5}, { 1, 12}, + { 3, 10}, { 11, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 16, 3}, { 1, 6}, + { 4, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 2}, { 16, 0}, + { 18, 0}, { 4, 10}, { 11, 12}, { 6, 10}, { 1, 14}, { 1, 20}, { 5, 6}, { 1, 2}, /* Row 36 */ + { 1, 5}, { 21, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 12, 12}, { 4, 10}, { 1, 12}, + { 6, 6}, { 17, 3}, { 1, 6}, { 2, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, + { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 16, 0}, + { 18, 0}, { 4, 10}, { 12, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 1, 5}, { 22, 3}, /* Row 37 */ + { 1, 5}, { 1, 12}, { 3, 10}, { 12, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, + { 17, 3}, { 1, 6}, { 1, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, + { 1, 18}, { 6, 2}, { 17, 0}, + { 18, 0}, { 4, 10}, { 12, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 22, 3}, /* Row 38 */ + { 1, 5}, { 1, 12}, { 3, 10}, { 13, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 18, 3}, + { 1, 6}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, + { 17, 0}, + { 18, 0}, { 4, 10}, { 13, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 22, 3}, { 1, 5}, /* Row 39 */ + { 1, 12}, { 3, 10}, { 13, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 17, 3}, + { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, { 6, 2}, { 18, 0}, + { 18, 0}, { 4, 10}, { 13, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 21, 3}, /* Row 40 */ + { 1, 5}, { 1, 12}, { 3, 10}, { 14, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 16, 3}, + { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, + { 18, 0}, + { 18, 0}, { 4, 10}, { 14, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 21, 3}, { 1, 5}, /* Row 41 */ + { 1, 12}, { 3, 10}, { 14, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 15, 3}, + { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, { 6, 2}, { 19, 0}, + { 18, 0}, { 4, 10}, { 14, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 20, 3}, /* Row 42 */ + { 1, 5}, { 1, 12}, { 3, 10}, { 15, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 14, 3}, + { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, + { 19, 0}, + { 18, 0}, { 4, 10}, { 15, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 20, 3}, { 1, 5}, /* Row 43 */ + { 1, 12}, { 3, 10}, { 15, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 13, 3}, + { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, { 6, 2}, { 20, 0}, + { 18, 0}, { 4, 10}, { 15, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 19, 3}, /* Row 44 */ + { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 1, 10}, { 8, 12}, { 4, 10}, { 1, 12}, + { 6, 6}, { 12, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, + { 6, 2}, { 1, 17}, { 20, 0}, + { 18, 0}, { 4, 10}, { 16, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 19, 3}, { 1, 5}, /* Row 45 */ + { 1, 12}, { 3, 10}, { 7, 12}, { 1, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 5, 6}, + { 1, 5}, { 11, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, + { 6, 2}, { 21, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 1, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 46 */ + { 1, 5}, { 18, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 2, 10}, { 8, 12}, + { 4, 10}, { 1, 12}, { 6, 6}, { 10, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, + { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 21, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 1, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, /* Row 47 */ + { 18, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 2, 10}, { 8, 12}, { 5, 10}, + { 1, 11}, { 5, 6}, { 1, 5}, { 9, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, + { 1, 12}, { 1, 18}, { 6, 2}, { 22, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 2, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 48 */ + { 1, 5}, { 17, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 8, 12}, + { 4, 10}, { 1, 12}, { 6, 6}, { 8, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, + { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 22, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 2, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, /* Row 49 */ + { 17, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 8, 12}, { 5, 10}, + { 1, 11}, { 5, 6}, { 1, 5}, { 7, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, + { 1, 12}, { 1, 21}, { 1, 20}, { 5, 2}, { 23, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 50 */ + { 1, 5}, { 16, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 4, 10}, { 8, 12}, + { 4, 10}, { 1, 12}, { 6, 6}, { 6, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, + { 5, 10}, { 1, 11}, { 2, 6}, { 1, 20}, { 3, 2}, { 1, 17}, { 23, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, /* Row 51 */ + { 16, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 4, 10}, { 8, 12}, { 5, 10}, + { 1, 11}, { 5, 6}, { 1, 5}, { 5, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, + { 1, 12}, { 4, 6}, { 1, 20}, { 2, 2}, { 24, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 4, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 52 */ + { 1, 5}, { 15, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 5, 10}, { 8, 12}, + { 4, 10}, { 1, 12}, { 6, 6}, { 4, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, + { 5, 10}, { 1, 11}, { 5, 6}, { 1, 20}, { 1, 17}, { 24, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, /* Row 53 */ + { 15, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 5, 10}, { 8, 12}, { 5, 10}, + { 1, 11}, { 5, 6}, { 1, 5}, { 3, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, + { 1, 12}, { 7, 6}, { 25, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 54 */ + { 1, 5}, { 14, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 6, 10}, { 8, 12}, + { 4, 10}, { 1, 12}, { 6, 6}, { 2, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, + { 5, 10}, { 1, 11}, { 7, 6}, { 1, 3}, { 1, 4}, { 23, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, /* Row 55 */ + { 14, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 6, 10}, { 8, 12}, { 5, 10}, + { 1, 11}, { 5, 6}, { 1, 5}, { 1, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, + { 1, 12}, { 7, 6}, { 3, 3}, { 1, 4}, { 22, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 6, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 56 */ + { 1, 5}, { 13, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 7, 10}, { 8, 12}, + { 4, 10}, { 1, 12}, { 6, 6}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, + { 1, 11}, { 8, 6}, { 3, 3}, { 1, 4}, { 21, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 6, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, /* Row 57 */ + { 13, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 7, 10}, { 8, 12}, { 5, 10}, + { 1, 11}, { 5, 6}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, + { 2, 3}, { 1, 6}, { 3, 3}, { 1, 4}, { 20, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 7, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 58 */ + { 1, 5}, { 12, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 8, 10}, { 8, 12}, + { 4, 10}, { 1, 12}, { 5, 6}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 11}, + { 6, 6}, { 1, 5}, { 3, 3}, { 1, 6}, { 3, 3}, { 1, 4}, { 19, 0}, + { 17, 0}, { 1, 22}, { 1, 12}, { 3, 10}, { 8, 12}, { 7, 10}, { 8, 12}, { 5, 10}, /* Row 59 */ + { 1, 12}, { 6, 6}, { 12, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 8, 10}, + { 8, 12}, { 5, 10}, { 1, 11}, { 3, 6}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, + { 1, 12}, { 7, 6}, { 5, 3}, { 1, 6}, { 3, 3}, { 1, 4}, { 18, 0}, + { 16, 0}, { 1, 1}, { 1, 18}, { 1, 12}, { 3, 10}, { 8, 12}, { 8, 10}, { 7, 12}, /* Row 60 */ + { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 11, 3}, { 1, 5}, { 1, 12}, { 3, 10}, + { 7, 12}, { 4, 10}, { 1, 12}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 3, 6}, + { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 6, 3}, + { 1, 6}, { 3, 3}, { 1, 4}, { 17, 0}, + { 15, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 8, 10}, /* Row 61 */ + { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 11, 3}, { 1, 5}, { 1, 12}, { 3, 10}, + { 7, 12}, { 3, 10}, { 1, 12}, { 1, 11}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 11}, + { 1, 6}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 8, 3}, + { 1, 6}, { 3, 3}, { 1, 4}, { 16, 0}, + { 14, 0}, { 1, 1}, { 1, 2}, { 2, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 9, 10}, /* Row 62 */ + { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 10, 3}, { 1, 5}, { 1, 12}, + { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 1, 21}, { 1, 12}, { 4, 10}, { 8, 12}, + { 4, 10}, { 1, 12}, { 1, 23}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 11}, + { 6, 6}, { 1, 5}, { 9, 3}, { 1, 6}, { 3, 3}, { 1, 4}, { 15, 0}, + { 13, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 12}, { 3, 10}, /* Row 63 */ + { 8, 12}, { 4, 10}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, + { 10, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 1, 6}, + { 1, 11}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 5, 10}, { 8, 12}, { 4, 10}, + { 1, 12}, { 7, 6}, { 11, 3}, { 1, 6}, { 3, 3}, { 1, 4}, { 14, 0}, + { 12, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 24}, { 1, 12}, /* Row 64 */ + { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 1, 11}, { 5, 10}, { 7, 12}, { 6, 10}, + { 1, 11}, { 5, 6}, { 1, 5}, { 9, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, + { 3, 10}, { 1, 12}, { 2, 6}, { 1, 12}, { 4, 10}, { 8, 12}, { 9, 10}, { 8, 12}, + { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 12, 3}, { 1, 6}, { 3, 3}, { 1, 4}, + { 13, 0}, + { 11, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 1, 3}, /* Row 65 */ + { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 1, 21}, { 1, 12}, { 4, 10}, + { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 9, 3}, { 1, 5}, { 1, 12}, { 3, 10}, + { 7, 12}, { 3, 10}, { 1, 12}, { 2, 6}, { 1, 11}, { 4, 10}, { 8, 12}, { 9, 10}, + { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 14, 3}, { 1, 6}, { 3, 3}, { 1, 4}, + { 12, 0}, + { 10, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 1, 3}, /* Row 66 */ + { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 1, 6}, { 1, 11}, + { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 8, 3}, { 1, 5}, + { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 3, 6}, { 1, 12}, { 4, 10}, + { 8, 12}, { 7, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 15, 3}, + { 1, 6}, { 3, 3}, { 1, 4}, { 11, 0}, + { 9, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 2, 3}, /* Row 67 */ + { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 2, 6}, { 1, 12}, + { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 8, 3}, { 1, 5}, { 1, 12}, + { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 3, 6}, { 1, 11}, { 4, 10}, { 8, 12}, + { 7, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 17, 3}, { 1, 6}, { 3, 3}, + { 1, 4}, { 10, 0}, + { 8, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 3, 3}, /* Row 68 */ + { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 2, 6}, { 1, 11}, + { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 7, 3}, { 1, 5}, + { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 4, 6}, { 1, 12}, { 4, 10}, + { 8, 12}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 18, 3}, + { 1, 6}, { 3, 3}, { 1, 4}, { 9, 0}, + { 7, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 4, 3}, /* Row 69 */ + { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 3, 6}, { 1, 12}, + { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 7, 3}, { 1, 5}, { 1, 12}, + { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 4, 6}, { 1, 11}, { 4, 10}, { 8, 12}, + { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 20, 3}, { 1, 6}, { 3, 3}, + { 1, 4}, { 8, 0}, + { 6, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 5, 3}, /* Row 70 */ + { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 3, 6}, { 1, 11}, + { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 6, 3}, { 1, 5}, + { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 5, 6}, { 1, 12}, { 4, 10}, + { 8, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 21, 3}, + { 1, 6}, { 3, 3}, { 1, 4}, { 7, 0}, + { 5, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 6, 3}, /* Row 71 */ + { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 4, 6}, { 1, 12}, + { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 6, 3}, { 1, 5}, { 1, 12}, + { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 5, 6}, { 1, 11}, { 4, 10}, { 8, 12}, + { 3, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 23, 3}, { 1, 6}, { 3, 3}, + { 1, 4}, { 6, 0}, + { 4, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 7, 3}, /* Row 72 */ + { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 4, 6}, { 1, 11}, + { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 5, 3}, { 1, 5}, + { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 6, 6}, { 1, 12}, { 4, 10}, + { 8, 12}, { 1, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 24, 3}, + { 1, 6}, { 3, 3}, { 1, 4}, { 5, 0}, + { 3, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 8, 3}, /* Row 73 */ + { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 5, 6}, { 1, 12}, + { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 5, 3}, { 1, 5}, { 1, 12}, + { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 6, 6}, { 1, 11}, { 4, 10}, { 8, 12}, + { 1, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 26, 3}, { 1, 6}, { 3, 3}, + { 1, 4}, { 4, 0}, + { 2, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 9, 3}, /* Row 74 */ + { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 5, 6}, { 1, 11}, + { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 4, 3}, { 1, 5}, + { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 1, 12}, { 4, 10}, + { 15, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 27, 3}, { 1, 6}, { 3, 3}, + { 1, 4}, { 3, 0}, + { 1, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 10, 3}, /* Row 75 */ + { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 6, 6}, { 1, 12}, + { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 4, 3}, { 1, 5}, { 1, 12}, + { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 1, 11}, { 4, 10}, { 15, 12}, + { 4, 10}, { 1, 12}, { 7, 6}, { 29, 3}, { 1, 6}, { 3, 3}, { 1, 4}, { 2, 0}, + { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 11, 3}, { 1, 5}, /* Row 76 */ + { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 6, 6}, { 1, 11}, { 5, 10}, + { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 3, 3}, { 1, 5}, { 1, 12}, + { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 1, 13}, { 1, 12}, { 4, 10}, + { 13, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 30, 3}, { 1, 6}, { 3, 3}, + { 1, 4}, { 1, 0}, + { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 12, 3}, { 1, 5}, { 1, 12}, /* Row 77 */ + { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 1, 12}, { 4, 10}, { 8, 12}, + { 5, 10}, { 1, 12}, { 6, 6}, { 3, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, + { 3, 10}, { 1, 12}, { 7, 6}, { 1, 3}, { 1, 11}, { 4, 10}, { 13, 12}, { 4, 10}, + { 1, 12}, { 7, 6}, { 32, 3}, { 1, 6}, { 3, 3}, { 1, 4}, + { 2, 3}, { 1, 6}, { 1, 2}, { 13, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, /* Row 78 */ + { 3, 10}, { 1, 12}, { 7, 6}, { 1, 11}, { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, + { 5, 6}, { 1, 5}, { 2, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, + { 1, 12}, { 7, 6}, { 1, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 11, 12}, { 5, 10}, + { 1, 11}, { 6, 6}, { 1, 5}, { 33, 3}, { 1, 6}, { 3, 3}, + { 1, 3}, { 1, 5}, { 1, 18}, { 14, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, /* Row 79 */ + { 3, 10}, { 1, 12}, { 7, 6}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, + { 1, 12}, { 6, 6}, { 2, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, + { 1, 12}, { 7, 6}, { 2, 3}, { 1, 11}, { 4, 10}, { 11, 12}, { 4, 10}, { 1, 12}, + { 7, 6}, { 35, 3}, { 1, 6}, { 2, 3}, + { 2, 3}, { 1, 6}, { 14, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 80 */ + { 1, 12}, { 7, 6}, { 1, 3}, { 1, 11}, { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, + { 5, 6}, { 1, 5}, { 1, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, + { 1, 12}, { 7, 6}, { 2, 3}, { 1, 11}, { 5, 10}, { 10, 12}, { 4, 10}, { 1, 11}, + { 6, 6}, { 1, 5}, { 35, 3}, { 1, 5}, { 1, 6}, { 1, 3}, + { 3, 3}, { 1, 6}, { 13, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 81 */ + { 1, 12}, { 7, 6}, { 1, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, + { 1, 12}, { 6, 6}, { 1, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, + { 1, 12}, { 7, 6}, { 1, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 10, 12}, { 4, 10}, + { 1, 12}, { 1, 21}, { 6, 6}, { 36, 3}, { 1, 7}, { 1, 2}, { 1, 5}, + { 4, 3}, { 1, 6}, { 12, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 82 */ + { 1, 12}, { 7, 6}, { 2, 3}, { 1, 11}, { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, + { 5, 6}, { 2, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 7, 6}, + { 1, 3}, { 1, 11}, { 5, 10}, { 10, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 35, 3}, + { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, + { 1, 4}, { 4, 3}, { 1, 6}, { 11, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, /* Row 83 */ + { 3, 10}, { 1, 12}, { 7, 6}, { 2, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, + { 5, 10}, { 1, 12}, { 6, 6}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, + { 1, 12}, { 7, 6}, { 1, 13}, { 1, 12}, { 4, 10}, { 12, 12}, { 4, 10}, { 1, 12}, + { 6, 6}, { 1, 5}, { 33, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, + { 1, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 10, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 84 */ + { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 3, 3}, { 1, 11}, { 5, 10}, { 7, 12}, + { 6, 10}, { 1, 11}, { 5, 6}, { 1, 13}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, + { 1, 12}, { 7, 6}, { 1, 11}, { 5, 10}, { 12, 12}, { 5, 10}, { 1, 11}, { 6, 6}, + { 32, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 1, 0}, + { 2, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 9, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 85 */ + { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 3, 3}, { 1, 13}, { 1, 12}, { 4, 10}, + { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, + { 1, 12}, { 7, 6}, { 1, 12}, { 4, 10}, { 14, 12}, { 4, 10}, { 1, 12}, { 6, 6}, + { 1, 5}, { 30, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 2, 0}, + { 3, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 8, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 86 */ + { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 4, 3}, { 1, 11}, { 5, 10}, { 7, 12}, + { 6, 10}, { 1, 11}, { 5, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, + { 6, 6}, { 1, 11}, { 5, 10}, { 14, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 29, 3}, + { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 3, 0}, + { 4, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 7, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 87 */ + { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 4, 3}, { 1, 13}, { 1, 12}, { 4, 10}, + { 8, 12}, { 5, 10}, { 1, 12}, { 5, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, + { 1, 12}, { 6, 6}, { 1, 12}, { 4, 10}, { 16, 12}, { 4, 10}, { 1, 12}, { 6, 6}, + { 1, 5}, { 27, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 4, 0}, + { 5, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 6, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 88 */ + { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 5, 3}, { 1, 11}, { 5, 10}, { 7, 12}, + { 6, 10}, { 1, 11}, { 4, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, + { 5, 6}, { 1, 11}, { 5, 10}, { 16, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 26, 3}, + { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 5, 0}, + { 6, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 5, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 89 */ + { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 5, 3}, { 1, 13}, { 1, 12}, { 4, 10}, + { 8, 12}, { 5, 10}, { 1, 12}, { 4, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, + { 1, 12}, { 5, 6}, { 1, 12}, { 4, 10}, { 9, 12}, { 1, 10}, { 8, 12}, { 4, 10}, + { 1, 12}, { 6, 6}, { 1, 5}, { 24, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, + { 1, 4}, { 6, 0}, + { 7, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 4, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 90 */ + { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 6, 3}, { 1, 11}, { 5, 10}, { 7, 12}, + { 6, 10}, { 1, 11}, { 3, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, + { 4, 6}, { 1, 11}, { 5, 10}, { 8, 12}, { 2, 10}, { 8, 12}, { 5, 10}, { 1, 11}, + { 6, 6}, { 23, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 7, 0}, + { 8, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 3, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 91 */ + { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 6, 3}, { 1, 13}, { 1, 12}, { 4, 10}, + { 8, 12}, { 5, 10}, { 1, 12}, { 3, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, + { 1, 12}, { 4, 6}, { 1, 12}, { 4, 10}, { 9, 12}, { 3, 10}, { 8, 12}, { 4, 10}, + { 1, 12}, { 6, 6}, { 1, 5}, { 21, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, + { 1, 4}, { 8, 0}, + { 9, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 2, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 92 */ + { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 7, 3}, { 1, 11}, { 5, 10}, { 7, 12}, + { 6, 10}, { 1, 11}, { 2, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, + { 3, 6}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 11}, + { 6, 6}, { 20, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 9, 0}, + { 10, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 1, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 93 */ + { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 7, 3}, { 1, 13}, { 1, 12}, { 4, 10}, + { 8, 12}, { 5, 10}, { 1, 12}, { 2, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, + { 1, 12}, { 3, 6}, { 1, 12}, { 4, 10}, { 9, 12}, { 5, 10}, { 8, 12}, { 4, 10}, + { 1, 12}, { 6, 6}, { 1, 5}, { 18, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, + { 1, 4}, { 10, 0}, + { 11, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, /* Row 94 */ + { 3, 10}, { 1, 12}, { 7, 6}, { 8, 3}, { 1, 11}, { 5, 10}, { 7, 12}, { 6, 10}, + { 1, 11}, { 1, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 2, 6}, + { 1, 11}, { 5, 10}, { 8, 12}, { 6, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, + { 17, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 11, 0}, + { 12, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 95 */ + { 1, 12}, { 7, 6}, { 8, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, + { 1, 12}, { 1, 21}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 2, 6}, + { 1, 12}, { 4, 10}, { 9, 12}, { 7, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 6, 6}, + { 1, 5}, { 15, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 12, 0}, + { 13, 0}, { 1, 4}, { 3, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 96 */ + { 1, 12}, { 7, 6}, { 9, 3}, { 1, 11}, { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, + { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 1, 6}, { 1, 11}, { 5, 10}, + { 8, 12}, { 8, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 14, 3}, { 1, 7}, + { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 13, 0}, + { 14, 0}, { 1, 4}, { 2, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 97 */ + { 1, 12}, { 7, 6}, { 9, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, + { 1, 12}, { 4, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 1, 21}, { 1, 12}, { 4, 10}, + { 9, 12}, { 4, 10}, { 1, 12}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 6, 6}, + { 1, 5}, { 12, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 14, 0}, + { 15, 0}, { 1, 4}, { 1, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 98 */ + { 1, 12}, { 7, 6}, { 10, 3}, { 1, 11}, { 5, 10}, { 7, 12}, { 10, 10}, { 7, 12}, + { 3, 10}, { 1, 12}, { 1, 11}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 1, 12}, + { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 11, 3}, { 1, 7}, { 1, 2}, + { 1, 5}, { 1, 3}, { 1, 4}, { 15, 0}, + { 16, 0}, { 1, 4}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, /* Row 99 */ + { 7, 6}, { 10, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 9, 10}, { 7, 12}, + { 4, 10}, { 1, 12}, { 4, 10}, { 9, 12}, { 4, 10}, { 1, 12}, { 1, 6}, { 1, 11}, + { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 1, 5}, { 9, 3}, { 1, 7}, + { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 16, 0}, + { 17, 0}, { 1, 4}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, /* Row 100 */ + { 11, 3}, { 1, 11}, { 5, 10}, { 7, 12}, { 9, 10}, { 7, 12}, { 9, 10}, { 8, 12}, + { 5, 10}, { 1, 11}, { 2, 6}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, + { 6, 6}, { 8, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 17, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 11, 3}, { 1, 13}, /* Row 101 */ + { 1, 12}, { 4, 10}, { 8, 12}, { 8, 10}, { 7, 12}, { 8, 10}, { 9, 12}, { 4, 10}, + { 1, 12}, { 3, 6}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 6, 6}, + { 1, 5}, { 6, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 18, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 12, 3}, { 1, 11}, /* Row 102 */ + { 5, 10}, { 7, 12}, { 8, 10}, { 7, 12}, { 8, 10}, { 8, 12}, { 5, 10}, { 1, 11}, + { 4, 6}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 5, 3}, + { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 19, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 12, 3}, { 1, 13}, /* Row 103 */ + { 1, 12}, { 4, 10}, { 8, 12}, { 7, 10}, { 7, 12}, { 7, 10}, { 9, 12}, { 4, 10}, + { 1, 12}, { 5, 6}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 6, 6}, + { 1, 5}, { 3, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 20, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 13, 3}, { 1, 11}, /* Row 104 */ + { 5, 10}, { 7, 12}, { 7, 10}, { 7, 12}, { 7, 10}, { 8, 12}, { 5, 10}, { 1, 11}, + { 6, 6}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 2, 3}, + { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 21, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 13, 3}, { 1, 13}, /* Row 105 */ + { 1, 12}, { 4, 10}, { 8, 12}, { 6, 10}, { 7, 12}, { 6, 10}, { 9, 12}, { 4, 10}, + { 1, 12}, { 7, 6}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, + { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 22, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 14, 3}, { 1, 11}, /* Row 106 */ + { 5, 10}, { 7, 12}, { 6, 10}, { 7, 12}, { 6, 10}, { 8, 12}, { 5, 10}, { 1, 11}, + { 7, 6}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, + { 1, 18}, { 1, 5}, { 1, 3}, { 1, 4}, { 23, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 14, 3}, { 1, 13}, /* Row 107 */ + { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 7, 12}, { 5, 10}, { 9, 12}, { 4, 10}, + { 1, 12}, { 7, 6}, { 1, 5}, { 1, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, + { 1, 12}, { 7, 6}, { 1, 3}, { 1, 4}, { 24, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 15, 3}, { 1, 11}, /* Row 108 */ + { 5, 10}, { 7, 12}, { 5, 10}, { 7, 12}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 11}, + { 7, 6}, { 2, 3}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, + { 5, 6}, { 1, 20}, { 1, 1}, { 25, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 15, 3}, { 1, 13}, /* Row 109 */ + { 1, 12}, { 4, 10}, { 8, 12}, { 4, 10}, { 7, 12}, { 4, 10}, { 9, 12}, { 4, 10}, + { 1, 12}, { 7, 6}, { 1, 5}, { 3, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, + { 1, 12}, { 4, 6}, { 1, 20}, { 2, 2}, { 25, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 16, 3}, { 1, 11}, /* Row 110 */ + { 5, 10}, { 7, 12}, { 4, 10}, { 7, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 11}, + { 7, 6}, { 4, 3}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, + { 2, 6}, { 1, 20}, { 3, 2}, { 1, 17}, { 24, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 16, 3}, { 1, 13}, /* Row 111 */ + { 1, 12}, { 4, 10}, { 8, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 9, 12}, { 4, 10}, + { 1, 12}, { 7, 6}, { 1, 5}, { 5, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, + { 1, 12}, { 1, 21}, { 1, 20}, { 5, 2}, { 24, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 17, 3}, { 1, 11}, /* Row 112 */ + { 5, 10}, { 7, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, + { 7, 6}, { 6, 3}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 14}, + { 6, 2}, { 1, 17}, { 23, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 17, 3}, { 1, 13}, /* Row 113 */ + { 1, 12}, { 4, 10}, { 8, 12}, { 2, 10}, { 7, 12}, { 2, 10}, { 9, 12}, { 4, 10}, + { 1, 12}, { 7, 6}, { 1, 5}, { 7, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, + { 1, 12}, { 1, 18}, { 6, 2}, { 23, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 18, 3}, { 1, 11}, /* Row 114 */ + { 5, 10}, { 7, 12}, { 2, 10}, { 7, 12}, { 2, 10}, { 8, 12}, { 5, 10}, { 1, 11}, + { 7, 6}, { 8, 3}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 14}, + { 6, 2}, { 1, 17}, { 22, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 18, 3}, { 1, 13}, /* Row 115 */ + { 1, 12}, { 4, 10}, { 8, 12}, { 1, 10}, { 7, 12}, { 1, 10}, { 9, 12}, { 4, 10}, + { 1, 12}, { 7, 6}, { 1, 5}, { 9, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, + { 1, 12}, { 1, 18}, { 6, 2}, { 22, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 19, 3}, { 1, 11}, /* Row 116 */ + { 5, 10}, { 7, 12}, { 1, 10}, { 7, 12}, { 1, 10}, { 8, 12}, { 5, 10}, { 1, 11}, + { 7, 6}, { 10, 3}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 14}, + { 6, 2}, { 1, 17}, { 21, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 1, 18}, { 6, 6}, { 19, 3}, /* Row 117 */ + { 1, 13}, { 1, 12}, { 4, 10}, { 24, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 1, 5}, + { 11, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, { 6, 2}, + { 21, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 1, 2}, { 1, 20}, { 5, 6}, /* Row 118 */ + { 20, 3}, { 1, 11}, { 5, 10}, { 22, 12}, { 5, 10}, { 1, 11}, { 7, 6}, { 12, 3}, + { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, + { 20, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 2, 2}, { 1, 20}, { 5, 6}, /* Row 119 */ + { 19, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 22, 12}, { 4, 10}, { 1, 12}, { 7, 6}, + { 1, 5}, { 13, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, + { 6, 2}, { 20, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 3, 2}, { 1, 20}, { 3, 6}, /* Row 120 */ + { 1, 3}, { 1, 6}, { 19, 3}, { 1, 11}, { 5, 10}, { 20, 12}, { 5, 10}, { 1, 11}, + { 7, 6}, { 14, 3}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 14}, + { 6, 2}, { 1, 17}, { 19, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 4, 2}, { 1, 20}, { 2, 6}, /* Row 121 */ + { 2, 3}, { 1, 6}, { 18, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 20, 12}, { 4, 10}, + { 1, 12}, { 7, 6}, { 1, 5}, { 14, 3}, { 1, 7}, { 1, 25}, { 4, 10}, { 8, 12}, + { 4, 10}, { 1, 12}, { 1, 18}, { 6, 2}, { 19, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 5, 2}, { 1, 20}, { 1, 6}, /* Row 122 */ + { 3, 3}, { 1, 6}, { 18, 3}, { 1, 11}, { 5, 10}, { 18, 12}, { 5, 10}, { 1, 11}, + { 7, 6}, { 14, 3}, { 1, 7}, { 1, 2}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, + { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 18, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 6, 2}, { 1, 20}, { 4, 3}, /* Row 123 */ + { 1, 6}, { 17, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 18, 12}, { 4, 10}, { 1, 12}, + { 7, 6}, { 1, 5}, { 13, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 20}, + { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, { 6, 2}, { 18, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 1, 0}, { 4, 3}, /* Row 124 */ + { 1, 6}, { 17, 3}, { 1, 11}, { 5, 10}, { 16, 12}, { 5, 10}, { 1, 11}, { 7, 6}, + { 13, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 1, 17}, { 4, 10}, + { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 17, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 1, 0}, { 1, 4}, /* Row 125 */ + { 4, 3}, { 1, 6}, { 16, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 16, 12}, { 4, 10}, + { 1, 12}, { 7, 6}, { 1, 5}, { 12, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, + { 1, 4}, { 2, 0}, { 1, 9}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, + { 6, 2}, { 17, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 2, 0}, { 1, 4}, /* Row 126 */ + { 4, 3}, { 1, 6}, { 16, 3}, { 1, 11}, { 5, 10}, { 14, 12}, { 5, 10}, { 1, 11}, + { 7, 6}, { 12, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 4, 0}, + { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 16, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 3, 0}, { 1, 4}, /* Row 127 */ + { 4, 3}, { 1, 6}, { 15, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 14, 12}, { 4, 10}, + { 1, 12}, { 7, 6}, { 1, 5}, { 11, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, + { 1, 4}, { 5, 0}, { 1, 9}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, + { 6, 2}, { 16, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 4, 0}, { 1, 4}, /* Row 128 */ + { 4, 3}, { 1, 6}, { 15, 3}, { 1, 11}, { 5, 10}, { 12, 12}, { 5, 10}, { 1, 11}, + { 7, 6}, { 11, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 7, 0}, + { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 15, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 5, 0}, { 1, 4}, /* Row 129 */ + { 4, 3}, { 1, 6}, { 14, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 12, 12}, { 4, 10}, + { 1, 12}, { 7, 6}, { 1, 5}, { 10, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, + { 1, 4}, { 8, 0}, { 1, 9}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, + { 6, 2}, { 15, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 6, 0}, { 1, 4}, /* Row 130 */ + { 4, 3}, { 1, 6}, { 14, 3}, { 1, 11}, { 5, 10}, { 10, 12}, { 5, 10}, { 1, 11}, + { 7, 6}, { 10, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 10, 0}, + { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 26}, { 14, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 7, 0}, { 1, 4}, /* Row 131 */ + { 4, 3}, { 1, 6}, { 13, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 10, 12}, { 4, 10}, + { 1, 12}, { 7, 6}, { 1, 5}, { 9, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, + { 1, 4}, { 11, 0}, { 1, 9}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 14}, { 6, 2}, + { 1, 17}, { 14, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 8, 0}, { 1, 4}, /* Row 132 */ + { 4, 3}, { 1, 6}, { 13, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 11}, + { 7, 6}, { 9, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 13, 0}, + { 4, 10}, { 8, 12}, { 4, 10}, { 1, 14}, { 7, 2}, { 14, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 9, 0}, { 1, 4}, /* Row 133 */ + { 4, 3}, { 1, 6}, { 12, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 4, 10}, + { 1, 12}, { 7, 6}, { 1, 5}, { 8, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, + { 1, 4}, { 14, 0}, { 1, 9}, { 4, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 1, 19}, + { 7, 2}, { 1, 26}, { 13, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 10, 0}, { 1, 4}, /* Row 134 */ + { 4, 3}, { 1, 6}, { 12, 3}, { 1, 11}, { 5, 10}, { 6, 12}, { 5, 10}, { 1, 11}, + { 7, 6}, { 8, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 16, 0}, + { 4, 10}, { 6, 12}, { 4, 10}, { 1, 12}, { 8, 2}, { 1, 17}, { 13, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 11, 0}, { 1, 4}, /* Row 135 */ + { 4, 3}, { 1, 6}, { 11, 3}, { 1, 13}, { 1, 12}, { 5, 10}, { 4, 12}, { 5, 10}, + { 1, 12}, { 7, 6}, { 1, 5}, { 7, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, + { 1, 4}, { 17, 0}, { 1, 9}, { 4, 10}, { 4, 12}, { 5, 10}, { 1, 14}, { 8, 2}, + { 1, 17}, { 13, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 12, 0}, { 1, 4}, /* Row 136 */ + { 4, 3}, { 1, 6}, { 11, 3}, { 1, 11}, { 14, 10}, { 1, 11}, { 7, 6}, { 7, 3}, + { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 19, 0}, { 12, 10}, { 1, 12}, + { 1, 18}, { 8, 2}, { 1, 1}, { 13, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 13, 0}, { 1, 4}, /* Row 137 */ + { 4, 3}, { 1, 6}, { 10, 3}, { 1, 13}, { 1, 12}, { 12, 10}, { 1, 12}, { 7, 6}, + { 1, 5}, { 6, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 20, 0}, + { 1, 9}, { 10, 10}, { 1, 12}, { 10, 2}, { 14, 0}, + { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 14, 0}, { 1, 4}, /* Row 138 */ + { 4, 3}, { 1, 6}, { 10, 3}, { 1, 11}, { 12, 10}, { 1, 11}, { 7, 6}, { 6, 3}, + { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 22, 0}, { 9, 10}, { 1, 12}, + { 10, 2}, { 1, 17}, { 14, 0}, + { 18, 0}, { 4, 10}, { 12, 12}, { 7, 2}, { 15, 0}, { 1, 4}, { 4, 3}, { 1, 6}, /* Row 139 */ + { 9, 3}, { 1, 5}, { 1, 15}, { 10, 10}, { 1, 15}, { 7, 6}, { 1, 5}, { 5, 3}, + { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 23, 0}, { 1, 17}, { 1, 14}, + { 5, 10}, { 1, 12}, { 1, 10}, { 1, 19}, { 10, 2}, { 15, 0}, + { 25, 0}, { 1, 20}, { 4, 18}, { 11, 2}, { 16, 0}, { 1, 4}, { 4, 3}, { 1, 6}, /* Row 140 */ + { 9, 3}, { 1, 5}, { 1, 11}, { 1, 12}, { 6, 10}, { 1, 12}, { 1, 11}, { 8, 6}, + { 5, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 27, 0}, { 2, 9}, + { 1, 19}, { 1, 14}, { 1, 18}, { 11, 2}, { 1, 17}, { 15, 0}, + { 25, 0}, { 16, 2}, { 17, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 10, 3}, { 1, 13}, /* Row 141 */ + { 1, 11}, { 4, 12}, { 1, 11}, { 9, 6}, { 5, 3}, { 1, 7}, { 1, 2}, { 1, 5}, + { 1, 3}, { 1, 4}, { 30, 0}, { 1, 1}, { 13, 2}, { 16, 0}, + { 25, 0}, { 16, 2}, { 18, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 11, 3}, { 1, 5}, /* Row 142 */ + { 1, 13}, { 11, 6}, { 5, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, + { 32, 0}, { 1, 17}, { 11, 2}, { 17, 0}, + { 25, 0}, { 16, 2}, { 19, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 13, 3}, { 1, 5}, /* Row 143 */ + { 7, 6}, { 6, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 34, 0}, + { 10, 2}, { 18, 0}, + { 25, 0}, { 16, 2}, { 20, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 25, 3}, { 1, 7}, /* Row 144 */ + { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 35, 0}, { 1, 1}, { 7, 2}, { 1, 17}, + { 19, 0}, + { 25, 0}, { 16, 2}, { 21, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 23, 3}, { 1, 7}, /* Row 145 */ + { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 64, 0}, + { 25, 0}, { 16, 2}, { 22, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 21, 3}, { 1, 7}, /* Row 146 */ + { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 65, 0}, + { 64, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 19, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 147 */ + { 1, 3}, { 1, 4}, { 66, 0}, + { 65, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 17, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 148 */ + { 1, 3}, { 1, 4}, { 67, 0}, + { 66, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 15, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 149 */ + { 1, 3}, { 1, 4}, { 68, 0}, + { 67, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 13, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 150 */ + { 1, 3}, { 1, 4}, { 69, 0}, + { 68, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 11, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 151 */ + { 1, 3}, { 1, 4}, { 70, 0}, + { 69, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 9, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 152 */ + { 1, 3}, { 1, 4}, { 71, 0}, + { 70, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 7, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 153 */ + { 1, 3}, { 1, 4}, { 72, 0}, + { 71, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 5, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 154 */ + { 1, 3}, { 1, 4}, { 73, 0}, + { 72, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 3, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 155 */ + { 1, 3}, { 1, 4}, { 74, 0}, + { 73, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 1, 5}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 156 */ + { 1, 3}, { 1, 4}, { 75, 0}, + { 74, 0}, { 1, 4}, { 5, 3}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 76, 0}, /* Row 157 */ + { 75, 0}, { 1, 4}, { 2, 3}, { 1, 5}, { 1, 20}, { 1, 5}, { 1, 3}, { 1, 4}, /* Row 158 */ + { 77, 0}, + { 76, 0}, { 1, 4}, { 4, 3}, { 1, 4}, { 78, 0} /* Row 159 */ +}; + +# endif +#else +# error "Unsupport pixel format" +#endif + +/******************************************************************************************** + * Public Data + ********************************************************************************************/ + +/******************************************************************************************** + * Private Functions + ********************************************************************************************/ + +/******************************************************************************************** + * Public Functions + ********************************************************************************************/ + +/******************************************************************************************** + * Name:nximage_bgcolor + * + * Description: + * Return the color of the background. In this case, we know that this is the first + * encoded color in the look-up table. + * + ********************************************************************************************/ + +nxgl_mxpixel_t nximage_bgcolor(void) +{ + return g_lut[0]; +} + +/******************************************************************************************** + * Name:nximage_avgcolor + * + * Description: + * Take the average of two pixel RGB values. + * + ********************************************************************************************/ + +nxgl_mxpixel_t nximage_avgcolor(nxgl_mxpixel_t color1, nxgl_mxpixel_t color2) +{ +#ifdef CONFIG_EXAMPLES_NXIMAGE_GREYSCALE + + return (nxgl_mxpixel_t)(((unsigned int)color1 + (unsigned int)color2) >> 1); + +#else /* CONFIG_EXAMPLES_NXIMAGE_GREYSCALE */ + unsigned int r1; + unsigned int g1; + unsigned int b1; + unsigned int r2; + unsigned int g2; + unsigned int b2; + +#if CONFIG_EXAMPLES_NXIMAGE_BPP == 24 + + /* RGB24 (8-8-8) Colors */ + + /* Demultiplex */ + + r1 = (color1 >> 16) & 0xff; /* 8-bit */ + g1 = (color1 >> 8) & 0xff; /* 8-bit */ + b1 = color1 & 0xff; /* 8-bit */ + + r2 = (color2 >> 16) & 0xff; /* 8-bit */ + g2 = (color2 >> 8) & 0xff; /* 8-bit */ + b2 = color2 & 0xff; /* 8-bit */ + + /* Average */ + + r1 = (r1 + r2 + 1) >> 1; /* 8-bit */ + g1 = (g1 + g2 + 1) >> 1; /* 8-bit */ + b1 = (b1 + b2 + 1) >> 1; /* 8-bit */ + + /* Clip */ + + if (r1 > 0xff) + { + r1 = 0xff; + } + + if (g1 > 0xff) + { + g1 = 0xff; + } + + if (b1 > 0xff) + { + b1 = 0xff; + } + + /* Multiplex */ + + color1 = r1 << 16 | g1 << 8 | b1; + +#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 16 + + /* RGB16 (565) Colors */ + + /* Demultiplex */ + + r1 = (color1 >> 11) & 0x1f; /* 5-bit */ + g1 = (color1 >> 5) & 0x3f; /* 6-bit */ + b1 = color1 & 0x1f; /* 5-bit */ + + r2 = (color2 >> 11) & 0x1f; /* 5-bit */ + g2 = (color2 >> 5) & 0x3f; /* 6-bit */ + b2 = color2 & 0x1f; /* 5-bit */ + + /* Average */ + + r1 = (r1 + r2 + 1) >> 1; /* 5-bit */ + g1 = (g1 + g2 + 1) >> 1; /* 6-bit */ + b1 = (b1 + b2 + 1) >> 1; /* 5-bit */ + + /* Clip */ + + if (r1 > 0x1f) + { + r1 = 0x1f; + } + + if (g1 > 0x3f) + { + g1 = 0x3f; + } + + if (b1 > 0x1f) + { + b1 = 0x1f; + } + + /* Multiplex */ + + color1 = r1 << 11 | g1 << 5 | b1; + +#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 8 + + /* RGB8 (332) Colors */ + + /* Demultiplex */ + + r1 = (color1 >> 5) & 0x07; /* 3-bit */ + g1 = (color1 >> 2) & 0x07; /* 3-bit */ + b1 = color1 & 0x03; /* 2-bit */ + + r2 = (color2 >> 5) & 0x07; /* 3-bit */ + g2 = (color2 >> 2) & 0x07; /* 3-bit */ + b2 = color2 & 0x03; /* 2-bit */ + + /* Average */ + + r1 = (r1 + r2 + 1) >> 1; /* 3-bit */ + g1 = (g1 + g2 + 1) >> 1; /* 3-bit */ + b1 = (b1 + b2 + 1) >> 1; /* 2-bit */ + + /* RGB24 (8-8-8) Colors */ + + /* Clip */ + + if (r1 > 0x07) + { + r1 = 0x07; + } + + if (g1 > 0x07) + { + g1 = 0x07; + } + + if (b1 > 0x03) + { + b1 = 0x03; + } + + /* Multiplex */ + + color1 = r1 << 5 | g1 << 2 | b1; + +#else +# error "Unsupport pixel format" +#endif + + return color1; +#endif /* CONFIG_EXAMPLES_NXIMAGE_GREYSCALE */ +} + +/******************************************************************************************** + * Name: nximage_blitrow + * + * Description: + * Return the next properly scaled row from the image. + * + ********************************************************************************************/ + +void nximage_blitrow(FAR nxgl_mxpixel_t *run, FAR const void **state) +{ + FAR const struct pix_run_s *pos = *(FAR const struct pix_run_s **)state; + unsigned int width; +#if defined(CONFIG_EXAMPLES_NXIMAGE_XSCALEp5) || defined(CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5) + unsigned int nhalfpixels; + nxgl_mxpixel_t last; +#endif + unsigned int nrun; + nxgl_mxpixel_t color; + + /* NULL positional data means to start over */ + + if (!pos) + { + pos = g_nuttx; + } + + /* Process each run-length encoded pixel in the image */ + +#if defined(CONFIG_EXAMPLES_NXIMAGE_XSCALEp5) || defined(CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5) + nhalfpixels = 0; + last = nximage_bgcolor(); +#endif + + for (width = 0; width < SCALED_WIDTH; pos++) + { + nrun = (unsigned int)pos->npix; + color = g_lut[pos->code]; + +#if defined(CONFIG_EXAMPLES_NXIMAGE_XSCALEp5) || defined(CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5) + nhalfpixels += nrun & 1; +#ifdef CONFIG_EXAMPLES_NXIMAGE_XSCALEp5 + nrum >>= 1; +#else + nrun = nrun + (nrun >> 1); +#endif + if (nhalfpixels > 1) + { + *run++ = nximage_avgcolor(color, last); + nhalfpixels -= 2; + width++; + } + last = color; +#elif defined(CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0) + nrun <<= 1; +#endif + width += nrun; + while (nrun-- > 0) + { + *run++ = color; + } + } + ASSERT(width == SCALED_WIDTH); + + /* Save the start of the next row and return success */ + + *state = (FAR const void *)pos; +} diff --git a/apps/examples/nximage/nximage_bkgd.c b/apps/examples/nximage/nximage_bkgd.c new file mode 100755 index 0000000000..e724b3a314 --- /dev/null +++ b/apps/examples/nximage/nximage_bkgd.c @@ -0,0 +1,397 @@ +/**************************************************************************** + * examples/nximage/nximage_bkgd.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "nximage.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Select renderer -- Some additional logic would be required to support + * pixel depths that are not directly addressable (1,2,4, and 24). + */ + +#if CONFIG_EXAMPLES_NXIMAGE_BPP == 1 +# define RENDERER nxf_convert_1bpp +#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 2 +# define RENDERER nxf_convert_2bpp +#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 4 +# define RENDERER nxf_convert_4bpp +#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 8 +# define RENDERER nxf_convert_8bpp +#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 16 +# define RENDERER nxf_convert_16bpp +#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 24 +# define RENDERER nxf_convert_24bpp +#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 32 +# define RENDERER nxf_convert_32bpp +#else +# error "Unsupported CONFIG_EXAMPLES_NXIMAGE_BPP" +#endif + +/* Vertical scaling */ + +#if defined(CONFIG_EXAMPLES_NXIMAGE_YSCALEp5) + +/* Read two rows, output one averaged row */ + +#define NINPUT_ROWS 2 +#define NOUTPUT_ROWS 1 + +#elif defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5) +/* Read two rows, output three rows */ + +#define NINPUT_ROWS 2 +#define NOUTPUT_ROWS 3 + +#elif defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0) +/* Read one row, output two rows */ + +#define NINPUT_ROWS 1 +#define NOUTPUT_ROWS 2 + +#else +/* Read one rows, output one or two rows */ + +#define NINPUT_ROWS 1 +#define NOUTPUT_ROWS 1 +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct nximage_run_t +{ + nxgl_mxpixel_t run[SCALED_WIDTH]; +}; + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static void nximage_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + bool more, FAR void *arg); +static void nximage_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, + FAR const struct nxgl_point_s *pos, + FAR const struct nxgl_rect_s *bounds, + FAR void *arg); +#ifdef CONFIG_NX_MOUSE +static void nximage_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, + uint8_t buttons, FAR void *arg); +#endif + +#ifdef CONFIG_NX_KBD +static void nximage_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, + FAR void *arg); +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const char g_hello[] = "Hello, World!"; + +/* Read one or two rows, output one tow or three rows */ + +static struct nximage_run_t g_runs[NINPUT_ROWS]; + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* Background window call table */ + +const struct nx_callback_s g_bgcb = +{ + nximage_redraw, /* redraw */ + nximage_position /* position */ +#ifdef CONFIG_NX_MOUSE + , nximage_mousein /* mousein */ +#endif +#ifdef CONFIG_NX_KBD + , nximage_kbdin /* my kbdin */ +#endif +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nximage_redraw + * + * Description: + * NX re-draw handler + * + ****************************************************************************/ + +static void nximage_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + bool more, FAR void *arg) +{ + gvdbg("hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n", + hwnd, rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, + more ? "true" : "false"); +} + +/**************************************************************************** + * Name: nximage_position + * + * Description: + * NX position change handler + * + ****************************************************************************/ + +static void nximage_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, + FAR const struct nxgl_point_s *pos, + FAR const struct nxgl_rect_s *bounds, + FAR void *arg) +{ + /* Report the position */ + + gvdbg("hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n", + hwnd, size->w, size->h, pos->x, pos->y, + bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y); + + /* Have we picked off the window bounds yet? */ + + if (!g_nximage.havepos) + { + /* Save the background window handle */ + + g_nximage.hbkgd = hwnd; + + /* Save the window limits */ + + g_nximage.xres = bounds->pt2.x + 1; + g_nximage.yres = bounds->pt2.y + 1; + + g_nximage.havepos = true; + sem_post(&g_nximage.sem); + gvdbg("Have xres=%d yres=%d\n", g_nximage.xres, g_nximage.yres); + } +} + +/**************************************************************************** + * Name: nximage_mousein + * + * Description: + * NX mouse input handler + * + ****************************************************************************/ + +#ifdef CONFIG_NX_MOUSE +static void nximage_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, + uint8_t buttons, FAR void *arg) +{ + message("nximage_mousein: hwnd=%p pos=(%d,%d) button=%02x\n", + hwnd, pos->x, pos->y, buttons); +} +#endif + +/**************************************************************************** + * Name: nximage_kbdin + * + * Description: + * NX keyboard input handler + * + ****************************************************************************/ + +#ifdef CONFIG_NX_KBD +static void nximage_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, + FAR void *arg) +{ + gvdbg("hwnd=%p nch=%d\n", hwnd, nch); + + /* In this example, there is no keyboard so a keyboard event is not + * expected. + */ + + message("nximage_kbdin: Unexpected keyboard callback\n"); +} +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nximage_image + * + * Description: + * Put the NuttX logo in the center of the display. + * + ****************************************************************************/ + +void nximage_image(NXWINDOW hwnd) +{ + FAR const void *state = NULL; + FAR struct nxgl_point_s pos; + FAR struct nxgl_rect_s dest; + FAR const void *src[CONFIG_NX_NPLANES]; + nxgl_coord_t row; + int ret; +#if defined(CONFIG_EXAMPLES_NXIMAGE_YSCALEp5) || defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5) + int i; +#endif + + /* Center the image. Note: these may extend off the display. */ + + pos.x = (g_nximage.xres - SCALED_WIDTH) / 2; + pos.y = (g_nximage.yres - SCALED_HEIGHT) / 2; + + /* Set up the invariant part of the destination bounding box */ + + dest.pt1.x = pos.x; + dest.pt2.x = pos.x + SCALED_WIDTH - 1; + + /* Now output the rows */ + + for (row = 0; row < IMAGE_HEIGHT; row += NINPUT_ROWS) + { + /* Read input row(s) */ + + nximage_blitrow(g_runs[0].run, &state); +#if NINPUT_ROWS > 1 + nximage_blitrow(g_runs[1].run, &state); +#endif + + /* Output rows before averaging */ + +#if defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5) || defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0) + + /* Output row[0] */ + + dest.pt1.y = pos.y; + dest.pt2.y = pos.y; + + src[0] = (FAR const void *)g_runs[0].run; +#if CONFIG_NX_NPLANES > 1 +# warning "More logic is needed for the case where CONFIG_NX_PLANES > 1" +#endif + ret = nx_bitmap((NXWINDOW)hwnd, &dest, src, &pos, SCALED_WIDTH*sizeof(nxgl_mxpixel_t)); + if (ret < 0) + { + message("nximage_image: nx_bitmapwindow failed: %d\n", errno); + } + + /* Increment the vertical position */ + + pos.y++; +#endif + + /* Perform averaging */ + +#if defined(CONFIG_EXAMPLES_NXIMAGE_YSCALEp5) || defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5) + + /* Average row[0] and row[1], output results in row[0] */ + + for (i = 0; i < SCALED_WIDTH; i++) + { + /* Only average if the corresponding pixels in each row differ */ + + nxgl_mxpixel_t pix0 = g_runs[0].run[i]; + nxgl_mxpixel_t pix1 = g_runs[1].run[i]; + if (pix0 != pix1) + { + g_runs[0].run[i] = nximage_avgcolor(pix0, pix1); + } + } + +#endif + + /* Output rows after averaging */ + + /* Output row[0] */ + + dest.pt1.y = pos.y; + dest.pt2.y = pos.y; + + src[0] = (FAR const void *)g_runs[0].run; +#if CONFIG_NX_NPLANES > 1 +# warning "More logic is needed for the case where CONFIG_NX_PLANES > 1" +#endif + ret = nx_bitmap((NXWINDOW)hwnd, &dest, src, &pos, SCALED_WIDTH*sizeof(nxgl_mxpixel_t)); + if (ret < 0) + { + message("nximage_image: nx_bitmapwindow failed: %d\n", errno); + } + + /* Increment the vertical position */ + + pos.y++; + +#if defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5) + + /* Output row[0] and row[1] */ + + dest.pt1.y = pos.y; + dest.pt2.y = pos.y; + + src[0] = (FAR const void *)g_runs[1].run; +#if CONFIG_NX_NPLANES > 1 +# warning "More logic is needed for the case where CONFIG_NX_PLANES > 1" +#endif + ret = nx_bitmap((NXWINDOW)hwnd, &dest, src, &pos, SCALED_WIDTH*sizeof(nxgl_mxpixel_t)); + if (ret < 0) + { + message("nximage_image: nx_bitmapwindow failed: %d\n", errno); + } + + /* Increment the vertical position */ + + pos.y++; +#endif + } +} diff --git a/apps/examples/nximage/nximage_main.c b/apps/examples/nximage/nximage_main.c new file mode 100755 index 0000000000..3ddfb1c027 --- /dev/null +++ b/apps/examples/nximage/nximage_main.c @@ -0,0 +1,289 @@ +/**************************************************************************** + * examples/nximage/nximage_main.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_NX_LCDDRIVER +# include +#else +# include +#endif + +#include +#include +#include +#include + +#include "nximage.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ +/* If not specified, assume that the hardware supports one video plane */ + +#ifndef CONFIG_EXAMPLES_NXIMAGE_VPLANE +# define CONFIG_EXAMPLES_NXIMAGE_VPLANE 0 +#endif + +/* If not specified, assume that the hardware supports one LCD device */ + +#ifndef CONFIG_EXAMPLES_NXIMAGE_DEVNO +# define CONFIG_EXAMPLES_NXIMAGE_DEVNO 0 +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +struct nximage_data_s g_nximage = +{ + NULL, /* hnx */ + NULL, /* hbkgd */ + 0, /* xres */ + 0, /* yres */ + false, /* havpos */ + { 0 }, /* sem */ + NXEXIT_SUCCESS /* exit code */ +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nximage_initialize + * + * Description: + * Initialize the LCD or framebuffer device (single user mode only), then + * open NX. + * + ****************************************************************************/ + +static inline int nximage_initialize(void) +{ + FAR NX_DRIVERTYPE *dev; + +#if defined(CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT) + /* Use external graphics driver initialization */ + + message("nximage_initialize: Initializing external graphics device\n"); + dev = up_nxdrvinit(CONFIG_EXAMPLES_NXIMAGE_DEVNO); + if (!dev) + { + message("nximage_initialize: up_nxdrvinit failed, devno=%d\n", + CONFIG_EXAMPLES_NXIMAGE_DEVNO); + g_nximage.code = NXEXIT_EXTINITIALIZE; + return ERROR; + } + +#elif defined(CONFIG_NX_LCDDRIVER) + int ret; + + /* Initialize the LCD device */ + + message("nximage_initialize: Initializing LCD\n"); + ret = up_lcdinitialize(); + if (ret < 0) + { + message("nximage_initialize: up_lcdinitialize failed: %d\n", -ret); + g_nximage.code = NXEXIT_LCDINITIALIZE; + return ERROR; + } + + /* Get the device instance */ + + dev = up_lcdgetdev(CONFIG_EXAMPLES_NXIMAGE_DEVNO); + if (!dev) + { + message("nximage_initialize: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NXIMAGE_DEVNO); + g_nximage.code = NXEXIT_LCDGETDEV; + return ERROR; + } + + /* Turn the LCD on at 75% power */ + + (void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4)); +#else + int ret; + + /* Initialize the frame buffer device */ + + message("nximage_initialize: Initializing framebuffer\n"); + ret = up_fbinitialize(); + if (ret < 0) + { + message("nximage_initialize: up_fbinitialize failed: %d\n", -ret); + g_nximage.code = NXEXIT_FBINITIALIZE; + return ERROR; + } + + dev = up_fbgetvplane(CONFIG_EXAMPLES_NXIMAGE_VPLANE); + if (!dev) + { + message("nximage_initialize: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXIMAGE_VPLANE); + g_nximage.code = NXEXIT_FBGETVPLANE; + return ERROR; + } +#endif + + /* Then open NX */ + + message("nximage_initialize: Open NX\n"); + g_nximage.hnx = nx_open(dev); + if (!g_nximage.hnx) + { + message("nximage_initialize: nx_open failed: %d\n", errno); + g_nximage.code = NXEXIT_NXOPEN; + return ERROR; + } + return OK; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: user_start/nximage_main + * + * Description: + * Main entry pointer. Configures the basic display resources. + * + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_NXIMAGE_BUILTIN +# define MAIN_NAME nximage_main +# define MAIN_NAME_STRING "nximage_main" +#else +# define MAIN_NAME user_start +# define MAIN_NAME_STRING "user_start" +#endif + +int MAIN_NAME(int argc, char *argv[]) +{ + nxgl_mxpixel_t color; + int ret; + + /* Initialize NX */ + + ret = nximage_initialize(); + message(MAIN_NAME_STRING ": NX handle=%p\n", g_nximage.hnx); + if (!g_nximage.hnx || ret < 0) + { + message(MAIN_NAME_STRING ": Failed to get NX handle: %d\n", errno); + g_nximage.code = NXEXIT_NXOPEN; + goto errout; + } + + /* Set the background to the configured background color */ + + color = nximage_bgcolor(); + message(MAIN_NAME_STRING ": Set background color=%d\n", color); + + ret = nx_setbgcolor(g_nximage.hnx, &color); + if (ret < 0) + { + message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno); + g_nximage.code = NXEXIT_NXSETBGCOLOR; + goto errout_with_nx; + } + + /* Get the background window */ + + ret = nx_requestbkgd(g_nximage.hnx, &g_bgcb, NULL); + if (ret < 0) + { + message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno); + g_nximage.code = NXEXIT_NXREQUESTBKGD; + goto errout_with_nx; + } + + /* Wait until we have the screen resolution. We'll have this immediately + * unless we are dealing with the NX server. + */ + + while (!g_nximage.havepos) + { + (void)sem_wait(&g_nximage.sem); + } + message(MAIN_NAME_STRING ": Screen resolution (%d,%d)\n", g_nximage.xres, g_nximage.yres); + + /* Now, put up the NuttX logo. */ + + nximage_image(g_nximage.hbkgd); + + /* Release background */ + + (void)nx_releasebkgd(g_nximage.hbkgd); + + /* Close NX */ + +errout_with_nx: + message(MAIN_NAME_STRING ": Close NX\n"); + nx_close(g_nximage.hnx); +errout: + return g_nximage.code; +} diff --git a/apps/examples/nxlines/Makefile b/apps/examples/nxlines/Makefile new file mode 100644 index 0000000000..0c865c42d0 --- /dev/null +++ b/apps/examples/nxlines/Makefile @@ -0,0 +1,105 @@ +############################################################################ +# apps/examples/nxlines/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# NuttX NX Graphics Example. + +ASRCS = +CSRCS = nxlines_main.c nxlines_bkgd.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# NXLINES built-in application info + +APPNAME = nxlines +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +# Common build + +VPATH = + +all: .built +.PHONY: context clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +.context: +ifeq ($(CONFIG_EXAMPLES_NXLINES_BUILTIN),y) + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + @touch $@ +endif + +context: .context + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/nxlines/nxlines.h b/apps/examples/nxlines/nxlines.h new file mode 100644 index 0000000000..fb91f23a3c --- /dev/null +++ b/apps/examples/nxlines/nxlines.h @@ -0,0 +1,197 @@ +/**************************************************************************** + * examples/nxlines/nxlines.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_EXAMPLES_NXLINES_NXLINES_H +#define __APPS_EXAMPLES_NXLINES_NXLINES_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ + +#ifndef CONFIG_NX +# error "NX is not enabled (CONFIG_NX)" +#endif + +#ifndef CONFIG_EXAMPLES_NXLINES_VPLANE +# define CONFIG_EXAMPLES_NXLINES_VPLANE 0 +#endif + +#ifndef CONFIG_EXAMPLES_NXLINES_BPP +# define CONFIG_EXAMPLES_NXLINES_BPP 16 +#endif + +#ifndef CONFIG_EXAMPLES_NXLINES_BGCOLOR +# if CONFIG_EXAMPLES_NXLINES_BPP == 24 || CONFIG_EXAMPLES_NXLINES_BPP == 32 +# define CONFIG_EXAMPLES_NXLINES_BGCOLOR RGB24_DARKGREEN +# elif CONFIG_EXAMPLES_NXLINES_BPP == 16 +# define CONFIG_EXAMPLES_NXLINES_BGCOLOR RGB16_DARKGREEN +# else +# define CONFIG_EXAMPLES_NXLINES_BGCOLOR RGB8_DARKGREEN +# endif +#endif + +#ifndef CONFIG_EXAMPLES_NXLINES_LINEWIDTH +# define CONFIG_EXAMPLES_NXLINES_LINEWIDTH 16 +#endif + +#ifndef CONFIG_EXAMPLES_NXLINES_LINECOLOR +# if CONFIG_EXAMPLES_NXLINES_BPP == 24 || CONFIG_EXAMPLES_NXLINES_BPP == 32 +# define CONFIG_EXAMPLES_NXLINES_LINECOLOR RGB24_YELLOW +# elif CONFIG_EXAMPLES_NXLINES_BPP == 16 +# define CONFIG_EXAMPLES_NXLINES_LINECOLOR RGB16_YELLOW +# else +# define CONFIG_EXAMPLES_NXLINES_LINECOLOR RGB8_YELLOW +# endif +#endif + +#ifndef CONFIG_EXAMPLES_NXLINES_BORDERWIDTH +# define CONFIG_EXAMPLES_NXLINES_BORDERWIDTH 16 +#endif + +#ifndef CONFIG_EXAMPLES_NXLINES_BORDERCOLOR +# if CONFIG_EXAMPLES_NXLINES_BPP == 24 || CONFIG_EXAMPLES_NXLINES_BPP == 32 +# define CONFIG_EXAMPLES_NXLINES_BORDERCOLOR RGB24_YELLOW +# elif CONFIG_EXAMPLES_NXLINES_BPP == 16 +# define CONFIG_EXAMPLES_NXLINES_BORDERCOLOR RGB16_YELLOW +# else +# define CONFIG_EXAMPLES_NXLINES_BORDERCOLOR RGB8_YELLOW +# endif +#endif + +#ifndef CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR +# if CONFIG_EXAMPLES_NXLINES_BPP == 24 || CONFIG_EXAMPLES_NXLINES_BPP == 32 +# define CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR RGB24_BEIGE +# elif CONFIG_EXAMPLES_NXLINES_BPP == 16 +# define CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR RGB16_BEIGE +# else +# define CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR RGB8_YELLOW +# endif +#endif + +/* Debug ********************************************************************/ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_DEBUG +# define message(...) lib_lowprintf(__VA_ARGS__) +# define msgflush() +# else +# define message(...) printf(__VA_ARGS__) +# define msgflush() fflush(stdout) +# endif +#else +# ifdef CONFIG_DEBUG +# define message lib_lowprintf +# define msgflush() +# else +# define message printf +# define msgflush() fflush(stdout) +# endif +#endif + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +enum exitcode_e +{ + NXEXIT_SUCCESS = 0, + NXEXIT_EXTINITIALIZE, + NXEXIT_FBINITIALIZE, + NXEXIT_FBGETVPLANE, + NXEXIT_LCDINITIALIZE, + NXEXIT_LCDGETDEV, + NXEXIT_NXOPEN, + NXEXIT_NXREQUESTBKGD, + NXEXIT_NXSETBGCOLOR +}; + +struct nxlines_data_s +{ + /* The NX handles */ + + NXHANDLE hnx; + NXHANDLE hbkgd; + + /* The screen resolution */ + + nxgl_coord_t xres; + nxgl_coord_t yres; + + volatile bool havepos; + sem_t sem; + volatile int code; +}; + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/* NXLINES state data */ + +extern struct nxlines_data_s g_nxlines; + +/* NX callback vtables */ + +extern const struct nx_callback_s g_bgcb; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_NXLINES_EXTERNINIT +extern FAR NX_DRIVERTYPE *up_nxdrvinit(unsigned int devno); +#endif + +/* Background window interfaces */ + +extern void nxlines_test(NXWINDOW hwnd); + +#endif /* __APPS_EXAMPLES_NXLINES_NXLINES_H */ diff --git a/apps/examples/nxlines/nxlines_bkgd.c b/apps/examples/nxlines/nxlines_bkgd.c new file mode 100644 index 0000000000..c9cbc921d2 --- /dev/null +++ b/apps/examples/nxlines/nxlines_bkgd.c @@ -0,0 +1,335 @@ +/**************************************************************************** + * examples/nxlines/nxlines_bkgd.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "nxlines.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#ifndef MIN +# define MIN(a,b) (a < b ? a : b) +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static void nxlines_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + bool morem, FAR void *arg); +static void nxlines_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, + FAR const struct nxgl_point_s *pos, + FAR const struct nxgl_rect_s *bounds, + FAR void *arg); +#ifdef CONFIG_NX_MOUSE +static void nxlines_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, + uint8_t buttons, FAR void *arg); +#endif + +#ifdef CONFIG_NX_KBD +static void nxlines_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, + FAR void *arg); +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* Background window call table */ + +const struct nx_callback_s g_bgcb = +{ + nxlines_redraw, /* redraw */ + nxlines_position /* position */ +#ifdef CONFIG_NX_MOUSE + , nxlines_mousein /* mousein */ +#endif +#ifdef CONFIG_NX_KBD + , nxlines_kbdin /* my kbdin */ +#endif +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxlines_redraw + ****************************************************************************/ + +static void nxlines_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + bool more, FAR void *arg) +{ + gvdbg("hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n", + hwnd, rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, + more ? "true" : "false"); +} + +/**************************************************************************** + * Name: nxlines_position + ****************************************************************************/ + +static void nxlines_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, + FAR const struct nxgl_point_s *pos, + FAR const struct nxgl_rect_s *bounds, + FAR void *arg) +{ + /* Report the position */ + + gvdbg("hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n", + hwnd, size->w, size->h, pos->x, pos->y, + bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y); + + /* Have we picked off the window bounds yet? */ + + if (!g_nxlines.havepos) + { + /* Save the background window handle */ + + g_nxlines.hbkgd = hwnd; + + /* Save the window limits */ + + g_nxlines.xres = bounds->pt2.x + 1; + g_nxlines.yres = bounds->pt2.y + 1; + + g_nxlines.havepos = true; + sem_post(&g_nxlines.sem); + gvdbg("Have xres=%d yres=%d\n", g_nxlines.xres, g_nxlines.yres); + } +} + +/**************************************************************************** + * Name: nxlines_mousein + ****************************************************************************/ + +#ifdef CONFIG_NX_MOUSE +static void nxlines_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, + uint8_t buttons, FAR void *arg) +{ + message("nxlines_mousein: hwnd=%p pos=(%d,%d) button=%02x\n", + hwnd, pos->x, pos->y, buttons); +} +#endif + +/**************************************************************************** + * Name: nxlines_kbdin + ****************************************************************************/ + +#ifdef CONFIG_NX_KBD +static void nxlines_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, + FAR void *arg) +{ + gvdbg("hwnd=%p nch=%d\n", hwnd, nch); + + /* In this example, there is no keyboard so a keyboard event is not + * expected. + */ + + message("nxlines_kbdin: Unexpected keyboard callback\n"); +} +#endif + + /**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxlines_test + * + * Description: + * Print "Hello, World!" in the center of the display. + * + ****************************************************************************/ + +void nxlines_test(NXWINDOW hwnd) +{ + struct nxgl_point_s center; + struct nxgl_vector_s vector; + struct nxgl_vector_s previous; + nxgl_mxpixel_t color[CONFIG_NX_NPLANES]; + nxgl_coord_t maxradius; + nxgl_coord_t radius; + nxgl_coord_t halfx; + nxgl_coord_t halfy; + b16_t angle; + int ret; + + /* Get the maximum radius and center of the circle */ + + maxradius = MIN(g_nxlines.yres, g_nxlines.xres) >> 1; + center.x = g_nxlines.xres >> 1; + center.y = g_nxlines.yres >> 1; + + /* Draw a circular background */ + + radius = maxradius - ((CONFIG_EXAMPLES_NXLINES_BORDERWIDTH+1)/2); + color[0] = CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR; + ret = nx_fillcircle((NXWINDOW)hwnd, ¢er, radius, color); + if (ret < 0) + { + message("nxlines_test: nx_fillcircle failed: %d\n", ret); + } + + /* Draw the circular border */ + + color[0] = CONFIG_EXAMPLES_NXLINES_BORDERCOLOR; + ret = nx_drawcircle((NXWINDOW)hwnd, ¢er, radius, + CONFIG_EXAMPLES_NXLINES_BORDERWIDTH, color); + if (ret < 0) + { + message("nxlines_test: nx_fillcircle failed: %d\n", ret); + } + + /* Back off the radius to account for the thickness of border line + * and with a big fudge factor that will (hopefully) prevent the corners + * of the lines from overwriting the border. This is overly complicated + * here because we don't assume anything about the screen resolution or + * the borderwidth or the line thickness (and there are certainly some + * smarter ways to do this). + */ + + if (maxradius > (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 80)) + { + radius = maxradius - (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 40); + } + else if (maxradius > (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 60)) + { + radius = maxradius - (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 30); + } + else if (maxradius > (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 40)) + { + radius = maxradius - (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 20); + } + else if (maxradius > (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 20)) + { + radius = maxradius - (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 10); + } + else + { + radius = maxradius - CONFIG_EXAMPLES_NXLINES_BORDERWIDTH; + } + + /* The loop, showing the line in various orientations */ + + angle = 0; + previous.pt1.x = center.x; + previous.pt1.y = center.y; + previous.pt2.x = center.x; + previous.pt2.y = center.y; + + for (;;) + { + /* Determine the position of the line on this pass */ + + halfx = b16toi(b16muli(b16sin(angle), radius)); + halfy = b16toi(b16muli(b16cos(angle), radius)); + + vector.pt1.x = center.x + halfx; + vector.pt1.y = center.y + halfy; + vector.pt2.x = center.x - halfx; + vector.pt2.y = center.y - halfy; + + message("Angle: %08x vector: (%d,%d)->(%d,%d)\n", + angle, vector.pt1.x, vector.pt1.y, vector.pt2.x, vector.pt2.y); + + /* Clear the previous line by overwriting it with the circle color */ + + color[0] = CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR; + ret = nx_drawline((NXWINDOW)hwnd, &previous, CONFIG_EXAMPLES_NXLINES_LINEWIDTH, color); + if (ret < 0) + { + message("nxlines_test: nx_drawline failed clearing: %d\n", ret); + } + + /* Draw the new line */ + + color[0] = CONFIG_EXAMPLES_NXLINES_LINECOLOR; + ret = nx_drawline((NXWINDOW)hwnd, &vector, CONFIG_EXAMPLES_NXLINES_LINEWIDTH, color); + if (ret < 0) + { + message("nxlines_test: nx_drawline failed clearing: %d\n", ret); + } + + /* Set up for the next time through the loop then sleep for a bit. */ + + angle += b16PI / 16; /* 32 angular positions in full circle */ + + /* Check if we have gone all the way around */ + + if (angle > (31 * (2 * b16PI) / 32)) + { +#ifdef CONFIG_EXAMPLES_NXLINES_BUILTIN + /* If this example was built as an NSH add-on, then exit after we + * have gone all the way around once. + */ + + return; +#else + /* Wrap back to zero and continue with the test */ + + angle = 0; +#endif + } + + memcpy(&previous, &vector, sizeof(struct nxgl_vector_s)); + usleep(500*1000); + } +} diff --git a/apps/examples/nxlines/nxlines_main.c b/apps/examples/nxlines/nxlines_main.c new file mode 100644 index 0000000000..c1485e0ef8 --- /dev/null +++ b/apps/examples/nxlines/nxlines_main.c @@ -0,0 +1,280 @@ +/**************************************************************************** + * examples/nxlines/nxlines_main.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_NX_LCDDRIVER +# include +#else +# include +#endif + +#include +#include +#include + +#include "nxlines.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ +/* If not specified, assume that the hardware supports one video plane */ + +#ifndef CONFIG_EXAMPLES_NXLINES_VPLANE +# define CONFIG_EXAMPLES_NXLINES_VPLANE 0 +#endif + +/* If not specified, assume that the hardware supports one LCD device */ + +#ifndef CONFIG_EXAMPLES_NXLINES_DEVNO +# define CONFIG_EXAMPLES_NXLINES_DEVNO 0 +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +struct nxlines_data_s g_nxlines = +{ + NULL, /* hnx */ + NULL, /* hbkgd */ + 0, /* xres */ + 0, /* yres */ + false, /* havpos */ + { 0 }, /* sem */ + NXEXIT_SUCCESS /* exit code */ +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxlines_initialize + ****************************************************************************/ + +static inline int nxlines_initialize(void) +{ + FAR NX_DRIVERTYPE *dev; + +#if defined(CONFIG_EXAMPLES_NXLINES_EXTERNINIT) + /* Use external graphics driver initialization */ + + message("nxlines_initialize: Initializing external graphics device\n"); + dev = up_nxdrvinit(CONFIG_EXAMPLES_NXLINES_DEVNO); + if (!dev) + { + message("nxlines_initialize: up_nxdrvinit failed, devno=%d\n", + CONFIG_EXAMPLES_NXLINES_DEVNO); + g_nxlines.code = NXEXIT_EXTINITIALIZE; + return ERROR; + } + +#elif defined(CONFIG_NX_LCDDRIVER) + int ret; + + /* Initialize the LCD device */ + + message("nxlines_initialize: Initializing LCD\n"); + ret = up_lcdinitialize(); + if (ret < 0) + { + message("nxlines_initialize: up_lcdinitialize failed: %d\n", -ret); + g_nxlines.code = NXEXIT_LCDINITIALIZE; + return ERROR; + } + + /* Get the device instance */ + + dev = up_lcdgetdev(CONFIG_EXAMPLES_NXLINES_DEVNO); + if (!dev) + { + message("nxlines_initialize: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NXLINES_DEVNO); + g_nxlines.code = NXEXIT_LCDGETDEV; + return ERROR; + } + + /* Turn the LCD on at 75% power */ + + (void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4)); +#else + int ret; + + /* Initialize the frame buffer device */ + + message("nxlines_initialize: Initializing framebuffer\n"); + ret = up_fbinitialize(); + if (ret < 0) + { + message("nxlines_initialize: up_fbinitialize failed: %d\n", -ret); + g_nxlines.code = NXEXIT_FBINITIALIZE; + return ERROR; + } + + dev = up_fbgetvplane(CONFIG_EXAMPLES_NXLINES_VPLANE); + if (!dev) + { + message("nxlines_initialize: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXLINES_VPLANE); + g_nxlines.code = NXEXIT_FBGETVPLANE; + return ERROR; + } +#endif + + /* Then open NX */ + + message("nxlines_initialize: Open NX\n"); + g_nxlines.hnx = nx_open(dev); + if (!g_nxlines.hnx) + { + message("nxlines_initialize: nx_open failed: %d\n", errno); + g_nxlines.code = NXEXIT_NXOPEN; + return ERROR; + } + return OK; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: user_start/nxlines_main + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_NXLINES_BUILTIN +# define MAIN_NAME nxlines_main +# define MAIN_NAME_STRING "nxlines_main" +#else +# define MAIN_NAME user_start +# define MAIN_NAME_STRING "user_start" +#endif + +int MAIN_NAME(int argc, char *argv[]) +{ + nxgl_mxpixel_t color; + int ret; + + /* Initialize NX */ + + ret = nxlines_initialize(); + message(MAIN_NAME_STRING ": NX handle=%p\n", g_nxlines.hnx); + if (!g_nxlines.hnx || ret < 0) + { + message(MAIN_NAME_STRING ": Failed to get NX handle: %d\n", errno); + g_nxlines.code = NXEXIT_NXOPEN; + goto errout; + } + + /* Set the background to the configured background color */ + + message(MAIN_NAME_STRING ": Set background color=%d\n", + CONFIG_EXAMPLES_NXLINES_BGCOLOR); + + color = CONFIG_EXAMPLES_NXLINES_BGCOLOR; + ret = nx_setbgcolor(g_nxlines.hnx, &color); + if (ret < 0) + { + message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno); + g_nxlines.code = NXEXIT_NXSETBGCOLOR; + goto errout_with_nx; + } + + /* Get the background window */ + + ret = nx_requestbkgd(g_nxlines.hnx, &g_bgcb, NULL); + if (ret < 0) + { + message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno); + g_nxlines.code = NXEXIT_NXREQUESTBKGD; + goto errout_with_nx; + } + + /* Wait until we have the screen resolution. We'll have this immediately + * unless we are dealing with the NX server. + */ + + while (!g_nxlines.havepos) + { + (void)sem_wait(&g_nxlines.sem); + } + message(MAIN_NAME_STRING ": Screen resolution (%d,%d)\n", g_nxlines.xres, g_nxlines.yres); + + /* Now, say perform the lines (these test does not return so the remaining + * logic is cosmetic). + */ + + nxlines_test(g_nxlines.hbkgd); + + /* Release background */ + + (void)nx_releasebkgd(g_nxlines.hbkgd); + + /* Close NX */ + +errout_with_nx: + message(MAIN_NAME_STRING ": Close NX\n"); + nx_close(g_nxlines.hnx); +errout: + return g_nxlines.code; +} diff --git a/apps/examples/nxtext/Makefile b/apps/examples/nxtext/Makefile new file mode 100644 index 0000000000..75e4899438 --- /dev/null +++ b/apps/examples/nxtext/Makefile @@ -0,0 +1,109 @@ +############################################################################ +# apps/examples/nxtext/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# NuttX NX Graphics Example. + +ASRCS = +CSRCS = nxtext_main.c nxtext_bkgd.c nxtext_popup.c nxtext_putc.c + +ifeq ($(CONFIG_NX_MULTIUSER),y) +CSRCS += nxtext_server.c +endif + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# NXTEXT built-in application info + +APPNAME = nxtext +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +# Common build + +VPATH = + +all: .built +.PHONY: context clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +.context: +ifeq ($(CONFIG_EXAMPLES_NXTEXT_BUILTIN),y) + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + @touch $@ +endif + +context: .context + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/nxtext/nxtext_bkgd.c b/apps/examples/nxtext/nxtext_bkgd.c new file mode 100644 index 0000000000..90cc19165e --- /dev/null +++ b/apps/examples/nxtext/nxtext_bkgd.c @@ -0,0 +1,467 @@ +/**************************************************************************** + * examples/nxtext/nxtext_bkgd.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "nxtext_internal.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static void nxbg_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + bool morem, FAR void *arg); +static void nxbg_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, + FAR const struct nxgl_point_s *pos, + FAR const struct nxgl_rect_s *bounds, + FAR void *arg); +#ifdef CONFIG_NX_MOUSE +static void nxbg_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, + uint8_t buttons, FAR void *arg); +#endif + +#ifdef CONFIG_NX_KBD +static void nxbg_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, + FAR void *arg); +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static struct nxtext_state_s g_bgstate; +static struct nxtext_bitmap_s g_bgbm[CONFIG_EXAMPLES_NXTEXT_BMCACHE]; +static struct nxtext_glyph_s g_bgglyph[CONFIG_EXAMPLES_NXTEXT_GLCACHE]; + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* Background window call table */ + +const struct nx_callback_s g_bgcb = +{ + nxbg_redraw, /* redraw */ + nxbg_position /* position */ +#ifdef CONFIG_NX_MOUSE + , nxbg_mousein /* mousein */ +#endif +#ifdef CONFIG_NX_KBD + , nxbg_kbdin /* my kbdin */ +#endif +}; + +/* Background window handle */ + +NXHANDLE g_bgwnd; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxbg_redrawrect + ****************************************************************************/ + +static void nxbg_redrawrect(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect) +{ + int ret; + int i; + + ret = nx_fill(hwnd, rect, g_bgstate.wcolor); + if (ret < 0) + { + message("nxbg_redrawrect: nx_fill failed: %d\n", errno); + } + + /* Fill each character on the display (Only the characters within rect + * will actually be redrawn). + */ + + for (i = 0; i < g_bgstate.nchars; i++) + { + nxtext_fillchar(hwnd, rect, &g_bgstate, g_bghfont, &g_bgstate.bm[i]); + } +} + +/**************************************************************************** + * Name: nxbg_redraw + ****************************************************************************/ + +static void nxbg_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + bool more, FAR void *arg) +{ + gvdbg("hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n", + hwnd, rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, + more ? "true" : "false"); + + nxbg_redrawrect(hwnd, rect); +} + +/**************************************************************************** + * Name: nxbg_position + ****************************************************************************/ + +static void nxbg_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, + FAR const struct nxgl_point_s *pos, + FAR const struct nxgl_rect_s *bounds, + FAR void *arg) +{ + FAR struct nxtext_state_s *st = (FAR struct nxtext_state_s *)arg; + + /* Report the position */ + + gvdbg("hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n", + hwnd, size->w, size->h, pos->x, pos->y, + bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y); + + /* Have we picked off the window bounds yet? */ + + if (!b_haveresolution) + { + /* Save the background window handle */ + + g_bgwnd = hwnd; + + /* Save the background window size */ + + st->wsize.w = size->w; + st->wsize.h = size->h; + + /* Save the window limits (these should be the same for all places and all windows */ + + g_xres = bounds->pt2.x + 1; + g_yres = bounds->pt2.y + 1; + + b_haveresolution = true; + sem_post(&g_semevent); + gvdbg("Have xres=%d yres=%d\n", g_xres, g_yres); + } +} + +/**************************************************************************** + * Name: nxbg_mousein + ****************************************************************************/ + +#ifdef CONFIG_NX_MOUSE +static void nxbg_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, + uint8_t buttons, FAR void *arg) +{ + message("nxbg_mousein: hwnd=%p pos=(%d,%d) button=%02x\n", + hwnd, pos->x, pos->y, buttons); +} +#endif + +/**************************************************************************** + * Name: nxbg_kbdin + ****************************************************************************/ + +#ifdef CONFIG_NX_KBD +static void nxbg_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, + FAR void *arg) +{ + gvdbg("hwnd=%p nch=%d\n", hwnd, nch); + nxbg_write(hwnd, ch, nch); +} +#endif + +/**************************************************************************** + * Name: nxbg_movedisplay + * + * Description: + * This function implements the data movement for the scroll operation. If + * we can read the displays framebuffer memory, then the job is pretty + * easy. However, many displays (such as SPI-based LCDs) are often read- + * only. + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_NXTEXT_NOGETRUN +static inline void nxbg_movedisplay(NXWINDOW hwnd, int bottom, int lineheight) +{ + FAR struct nxtext_bitmap_s *bm; + struct nxgl_rect_s rect; + nxgl_coord_t row; + int ret; + int i; + + /* Move each row, one at a time. They could all be moved at once (by calling + * nxbg_redrawrect), but the since the region is cleared, then re-written, the + * effect would not be good. Below the region is also cleared and re-written, + * however, in much smaller chunks. + */ + + rect.pt1.x = 0; + rect.pt2.x = g_bgstate.wsize.w - 1; + + for (row = LINE_SEPARATION; row < bottom; row += lineheight) + { + /* Create a bounding box the size of one row of characters */ + + rect.pt1.y = row; + rect.pt2.y = row + lineheight - 1; + + /* Clear the region */ + + ret = nx_fill(hwnd, &rect, g_bgstate.wcolor); + if (ret < 0) + { + message("nxbg_movedisplay: nx_fill failed: %d\n", errno); + } + + /* Fill each character that might lie within in the bounding box */ + + for (i = 0; i < g_bgstate.nchars; i++) + { + bm = &g_bgstate.bm[i]; + if (bm->pos.y <= rect.pt2.y && bm->pos.y + g_bgstate.fheight >= rect.pt1.y) + { + nxtext_fillchar(hwnd, &rect, &g_bgstate, g_bghfont, bm); + } + } + } + + /* Finally, clear the bottom part of the display */ + + rect.pt1.y = bottom; + rect.pt2.y = g_bgstate.wsize.h- 1; + + ret = nx_fill(hwnd, &rect, g_bgstate.wcolor); + if (ret < 0) + { + message("nxbg_movedisplay: nx_fill failed: %d\n", errno); + } +} +#else +static inline void nxbg_movedisplay(NXWINDOW hwnd, int bottom, int lineheight) +{ + struct nxgl_rect_s rect; + struct nxgl_point_s offset; + int ret; + + /* Move the display in the range of 0-height up one lineheight. The + * line at the bottom will be reset to the background color automatically. + * + * The source rectangle to be moved. + */ + + rect.pt1.x = 0; + rect.pt1.y = lineheight + LINE_SEPARATION; + rect.pt2.x = g_bgstate.wsize.w - 1; + rect.pt2.y = g_bgstate.wsize.h - 1; + + /* The offset that determines how far to move the source rectangle */ + + offset.x = 0; + offset.y = -lineheight; + + /* Move the source rectangle */ + + ret = nx_move(hwnd, &rect, &offset); + if (ret < 0) + { + message("nxbg_movedisplay: nx_move failed: %d\n", errno); + } +} +#endif + +/**************************************************************************** + * Name: nxbg_scroll + ****************************************************************************/ + +static inline void nxbg_scroll(NXWINDOW hwnd, int lineheight) +{ + int i; + int j; + + /* Adjust the vertical position of each character */ + + for (i = 0; i < g_bgstate.nchars; ) + { + FAR struct nxtext_bitmap_s *bm = &g_bgstate.bm[i]; + + /* Has any part of this character scrolled off the screen? */ + + if (bm->pos.y < lineheight + LINE_SEPARATION) + { + /* Yes... Delete the character by moving all of the data */ + + for (j = i; j < g_bgstate.nchars-1; j++) + { + memcpy(&g_bgstate.bm[j], &g_bgstate.bm[j+1], sizeof(struct nxtext_bitmap_s)); + } + + /* Decrement the number of cached characters ('i' is not incremented + * in this case because it already points to the next character) + */ + + g_bgstate.nchars--; + } + + /* No.. just decrement its vertical position (moving it "up" the + * display by one line). + */ + + else + { + bm->pos.y -= lineheight; + + /* We are keeping this one so increment to the next character */ + + i++; + } + } + + /* And move the next display position up by one line as well */ + + g_bgstate.fpos.y -= lineheight; + + /* Move the display in the range of 0-height up one lineheight. */ + + nxbg_movedisplay(hwnd, g_bgstate.fpos.y, lineheight); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxbg_getstate + * + * Description: + * Initialize the background window state structure. + * + ****************************************************************************/ + +FAR struct nxtext_state_s *nxbg_getstate(void) +{ + FAR const struct nx_font_s *fontset; + + /* Initialize the color (used for redrawing the window) */ + + memset(&g_bgstate, 0, sizeof(struct nxtext_state_s)); + g_bgstate.wcolor[0] = CONFIG_EXAMPLES_NXTEXT_BGCOLOR; + g_bgstate.fcolor[0] = CONFIG_EXAMPLES_NXTEXT_BGFONTCOLOR; + + /* Get information about the font set being used and save this in the + * state structure + */ + + fontset = nxf_getfontset(g_bghfont); + g_bgstate.fheight = fontset->mxheight; + g_bgstate.fwidth = fontset->mxwidth; + g_bgstate.spwidth = fontset->spwidth; + + /* Set up the text caches */ + + g_bgstate.maxchars = CONFIG_EXAMPLES_NXTEXT_BMCACHE; + g_bgstate.maxglyphs = CONFIG_EXAMPLES_NXTEXT_GLCACHE; + g_bgstate.bm = g_bgbm; + g_bgstate.glyph = g_bgglyph; + + /* Set the first display position */ + + nxtext_home(&g_bgstate); + return &g_bgstate; +} + +/**************************************************************************** + * Name: nxbg_write + * + * Description: + * Put a sequence of bytes in the window. + * + ****************************************************************************/ + +void nxbg_write(NXWINDOW hwnd, FAR const uint8_t *buffer, size_t buflen) +{ + int lineheight = (g_bgstate.fheight + LINE_SEPARATION); + + while (buflen-- > 0) + { + /* Will another character fit on this line? */ + + if (g_bgstate.fpos.x + g_bgstate.fwidth > g_bgstate.wsize.w) + { + /* No.. move to the next line */ + + nxtext_newline(&g_bgstate); + + /* If we were about to output a newline character, then don't */ + + if (*buffer == '\n') + { + buffer++; + continue; + } + } + + /* Check if we need to scroll up (handling a corner case where + * there may be more than one newline). + */ + + while (g_bgstate.fpos.y >= g_bgstate.wsize.h - lineheight) + { + nxbg_scroll(hwnd, lineheight); + } + + /* Finally, we can output the character */ + + nxtext_putc(hwnd, &g_bgstate, g_bghfont, (uint8_t)*buffer++); + } +} diff --git a/apps/examples/nxtext/nxtext_internal.h b/apps/examples/nxtext/nxtext_internal.h new file mode 100644 index 0000000000..caf8cd9fca --- /dev/null +++ b/apps/examples/nxtext/nxtext_internal.h @@ -0,0 +1,330 @@ +/**************************************************************************** + * examples/nxtext/nxtext_internal.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __EXAMPLES_NXTEXT_NXTEXT_INTERNAL_H +#define __EXAMPLES_NXTEXT_NXTEXT_INTERNAL_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ + +#ifndef CONFIG_NX +# error "NX is not enabled (CONFIG_NX)" +#endif + +#ifndef CONFIG_EXAMPLES_NXTEXT_VPLANE +# define CONFIG_EXAMPLES_NXTEXT_VPLANE 0 +#endif + +#ifndef CONFIG_EXAMPLES_NXTEXT_BPP +# define CONFIG_EXAMPLES_NXTEXT_BPP 32 +#endif + +#ifndef CONFIG_EXAMPLES_NXTEXT_BGCOLOR +# if CONFIG_EXAMPLES_NXTEXT_BPP == 24 || CONFIG_EXAMPLES_NXTEXT_BPP == 32 +# define CONFIG_EXAMPLES_NXTEXT_BGCOLOR 0x007b68ee +# elif CONFIG_EXAMPLES_NXTEXT_BPP == 16 +# define CONFIG_EXAMPLES_NXTEXT_BGCOLOR 0x7b5d +# else +# define CONFIG_EXAMPLES_NXTEXT_BGCOLOR ' ' +# endif +#endif + +#ifndef CONFIG_EXAMPLES_NXTEXT_PUFONTID +# define CONFIG_EXAMPLES_NXTEXT_PUFONTID NXFONT_DEFAULT +#endif + +#ifndef CONFIG_EXAMPLES_NXTEXT_PUCOLOR +# if CONFIG_EXAMPLES_NXTEXT_BPP == 24 || CONFIG_EXAMPLES_NXTEXT_BPP == 32 +# define CONFIG_EXAMPLES_NXTEXT_PUCOLOR 0x00dcdcdc +# elif CONFIG_EXAMPLES_NXTEXT_BPP == 16 +# define CONFIG_EXAMPLES_NXTEXT_PUCOLOR 0xdefb +# else +# define CONFIG_EXAMPLES_NXTEXT_PUCOLOR '2' +# endif +#endif + +#ifndef CONFIG_EXAMPLES_NXTEXT_BGFONTID +# define CONFIG_EXAMPLES_NXTEXT_BGFONTID NXFONT_DEFAULT +#endif + +#ifndef CONFIG_EXAMPLES_NXTEXT_BGFONTCOLOR +# if CONFIG_EXAMPLES_NXTEXT_BPP == 24 || CONFIG_EXAMPLES_NXTEXT_BPP == 32 +# define CONFIG_EXAMPLES_NXTEXT_BGFONTCOLOR 0x00000000 +# elif CONFIG_EXAMPLES_NXTEXT_BPP == 16 +# define CONFIG_EXAMPLES_NXTEXT_BGFONTCOLOR 0x0000 +# else +# define CONFIG_EXAMPLES_NXTEXT_BGFONTCOLOR 'F' +# endif +#endif + +#ifndef CONFIG_EXAMPLES_NXTEXT_PUFONTCOLOR +# if CONFIG_EXAMPLES_NXTEXT_BPP == 24 || CONFIG_EXAMPLES_NXTEXT_BPP == 32 +# define CONFIG_EXAMPLES_NXTEXT_PUFONTCOLOR 0x00000000 +# elif CONFIG_EXAMPLES_NXTEXT_BPP == 16 +# define CONFIG_EXAMPLES_NXTEXT_PUFONTCOLOR 0x0000 +# else +# define CONFIG_EXAMPLES_NXTEXT_PUFONTCOLOR 'F' +# endif +#endif + +#ifndef CONFIG_EXAMPLES_NXTEXT_BMCACHE +# define CONFIG_EXAMPLES_NXTEXT_BMCACHE 128 +#endif + +#ifndef CONFIG_EXAMPLES_NXTEXT_GLCACHE +# define CONFIG_EXAMPLES_NXTEXT_BMCACHE 16 +#endif + +#ifdef CONFIG_NX_MULTIUSER +# ifdef CONFIG_DISABLE_MQUEUE +# error "The multi-threaded example requires MQ support (CONFIG_DISABLE_MQUEUE=n)" +# endif +# ifdef CONFIG_DISABLE_SIGNALS +# error "This example requires signal support (CONFIG_DISABLE_SIGNALS=n)" +# endif +# ifdef CONFIG_DISABLE_PTHREAD +# error "This example requires pthread support (CONFIG_DISABLE_PTHREAD=n)" +# endif +# ifndef CONFIG_NX_BLOCKING +# error "This example depends on CONFIG_NX_BLOCKING" +# endif +# ifndef CONFIG_EXAMPLES_NXTEXT_STACKSIZE +# define CONFIG_EXAMPLES_NXTEXT_STACKSIZE 2048 +# endif +# ifndef CONFIG_EXAMPLES_NXTEXT_LISTENERPRIO +# define CONFIG_EXAMPLES_NXTEXT_LISTENERPRIO 100 +# endif +# ifndef CONFIG_EXAMPLES_NXTEXT_CLIENTPRIO +# define CONFIG_EXAMPLES_NXTEXT_CLIENTPRIO 100 +# endif +# ifndef CONFIG_EXAMPLES_NXTEXT_SERVERPRIO +# define CONFIG_EXAMPLES_NXTEXT_SERVERPRIO 120 +# endif +# ifndef CONFIG_EXAMPLES_NXTEXT_NOTIFYSIGNO +# define CONFIG_EXAMPLES_NXTEXT_NOTIFYSIGNO 4 +# endif +#endif + +/* Debug ********************************************************************/ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_DEBUG +# define message(...) lib_lowprintf(__VA_ARGS__) +# define msgflush() +# else +# define message(...) printf(__VA_ARGS__) +# define msgflush() fflush(stdout) +# endif +#else +# ifdef CONFIG_DEBUG +# define message lib_lowprintf +# define msgflush() +# else +# define message printf +# define msgflush() fflush(stdout) +# endif +#endif + +/* Bitmap flags */ + +#define BMFLAGS_NOGLYPH (1 << 0) /* No glyph available, use space */ + +#define BM_ISSPACE(bm) (((bm)->flags & BMFLAGS_NOGLYPH) != 0) + +/* Sizes and maximums */ + +#define MAX_USECNT 255 /* Limit to range of a uint8_t */ +#define LINE_SEPARATION 2 /* Space (in rows) between lines */ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +enum exitcode_e +{ + NXEXIT_SUCCESS = 0, + NXEXIT_SCHEDSETPARAM, + NXEXIT_TASKCREATE, + NXEXIT_PTHREADCREATE, + NXEXIT_EXTINITIALIZE, + NXEXIT_FBINITIALIZE, + NXEXIT_FBGETVPLANE, + NXEXIT_LCDINITIALIZE, + NXEXIT_LCDGETDEV, + NXEXIT_NXOPEN, + NXEXIT_FONTOPEN, + NXEXIT_NXREQUESTBKGD, + NXEXIT_NXCONNECT, + NXEXIT_NXSETBGCOLOR, + NXEXIT_NXOPENWINDOW, + NXEXIT_NXSETSIZE, + NXEXIT_NXSETPOSITION, + NXEXIT_NXCLOSEWINDOW, + NXEXIT_LOSTSERVERCONN +}; + +/* Describes one cached glyph bitmap */ + +struct nxtext_glyph_s +{ + uint8_t code; /* Character code */ + uint8_t height; /* Height of this glyph (in rows) */ + uint8_t width; /* Width of this glyph (in pixels) */ + uint8_t stride; /* Width of the glyph row (in bytes) */ + uint8_t usecnt; /* Use count */ + FAR uint8_t *bitmap; /* Allocated bitmap memory */ +}; + +/* Describes on character on the display */ + +struct nxtext_bitmap_s +{ + uint8_t code; /* Character code */ + uint8_t flags; /* See BMFLAGS_* */ + struct nxgl_point_s pos; /* Character position */ +}; + +/* Describes the state of one text display */ + +struct nxtext_state_s +{ + /* The following describe the window */ + + nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]; /* Window color */ + struct nxgl_size_s wsize; /* Window size */ + struct nxgl_point_s wpos; /* Window position */ + + /* These characterize the font in use */ + + nxgl_mxpixel_t fcolor[CONFIG_NX_NPLANES]; /* Font color */ + uint8_t fheight; /* Max height of a font in pixels */ + uint8_t fwidth; /* Max width of a font in pixels */ + uint8_t spwidth; /* The width of a space */ + struct nxgl_point_s fpos; /* Next display position */ + + /* These describe all text already added to the display */ + + uint8_t maxglyphs; /* Size of the glyph[] array */ + uint16_t maxchars; /* Size of the bm[] array */ + uint16_t nchars; /* Number of chars in the bm[] array */ + + FAR struct nxtext_bitmap_s *bm; /* List of characters on the display */ + FAR struct nxtext_glyph_s *glyph; /* Cache of rendered fonts in use */ +}; + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/* The connecton handler */ + +extern NXHANDLE g_hnx; + +/* Background window handle */ + +extern NXHANDLE g_bgwnd; + +/* The font handlse */ + +extern NXHANDLE g_bghfont; +extern NXHANDLE g_puhfont; + +/* NX callback vtables */ + +extern const struct nx_callback_s g_bgcb; + +/* The screen resolution */ + +extern nxgl_coord_t g_xres; +extern nxgl_coord_t g_yres; + +extern bool b_haveresolution; +#ifdef CONFIG_NX_MULTIUSER +extern bool g_connected; +#endif +extern sem_t g_semevent; + +extern int g_exitcode; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_NXTEXT_EXTERNINIT +extern FAR NX_DRIVERTYPE *up_nxdrvinit(unsigned int devno); +#endif +#if defined(CONFIG_NX) && defined(CONFIG_NX_MULTIUSER) +extern int nxtext_server(int argc, char *argv[]); +extern FAR void *nxtext_listener(FAR void *arg); +#endif + +/* Background window interfaces */ + +extern FAR struct nxtext_state_s *nxbg_getstate(void); +extern void nxbg_write(NXWINDOW hwnd, FAR const uint8_t *buffer, size_t buflen); + +/* Pop-up window interfaces */ + +extern NXWINDOW nxpu_open(void); +extern int nxpu_close(NXWINDOW hwnd); + +/* Generic text helpers */ + +extern void nxtext_home(FAR struct nxtext_state_s *st); +extern void nxtext_newline(FAR struct nxtext_state_s *st); +extern void nxtext_putc(NXWINDOW hwnd, FAR struct nxtext_state_s *st, + NXHANDLE hfont, uint8_t ch); +extern void nxtext_fillchar(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + FAR struct nxtext_state_s *st, NXHANDLE hfont, + FAR const struct nxtext_bitmap_s *bm); + +#endif /* __EXAMPLES_NXTEXT_NXTEXT_INTERNAL_H */ diff --git a/apps/examples/nxtext/nxtext_main.c b/apps/examples/nxtext/nxtext_main.c new file mode 100644 index 0000000000..b7e2a33563 --- /dev/null +++ b/apps/examples/nxtext/nxtext_main.c @@ -0,0 +1,512 @@ +/**************************************************************************** + * examples/nxtext/nxtext_main.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_NX_LCDDRIVER +# include +#else +# include +#endif + +#include +#include +#include +#include + +#include "nxtext_internal.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ +/* If not specified, assume that the hardware supports one video plane */ + +#ifndef CONFIG_EXAMPLES_NXTEXT_VPLANE +# define CONFIG_EXAMPLES_NXTEXT_VPLANE 0 +#endif + +/* If not specified, assume that the hardware supports one LCD device */ + +#ifndef CONFIG_EXAMPLES_NXTEXT_DEVNO +# define CONFIG_EXAMPLES_NXTEXT_DEVNO 0 +#endif + +#define BGMSG_LINES 24 + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +#ifdef CONFIG_NX_KBD +static const uint8_t g_pumsg[] = "Pop-Up!"; +static const char *g_bgmsg[BGMSG_LINES] = +{ + "\nJULIET\n", /* Line 1 */ + "Wilt thou be gone?\n", /* Line 2 */ + " It is not yet near day:\n", /* Line 3 */ + "It was the nightingale,\n", /* Line 4 */ + " and not the lark,\n", /* Line 5 */ + "That pierced the fearful hollow\n", /* Line 6 */ + " of thine ear;\n", /* Line 7 */ + "Nightly she sings\n", /* Line 8 */ + " on yon pomegranate-tree:\n", /* Line 9 */ + "Believe me, love,\n", /* Line 10 */ + " it was the nightingale.\n", /* Line 11 */ + "\nROMEO\n", /* Line 12 */ + "It was the lark,\n", /* Line 13 */ + " the herald of the morn,\n", /* Line 14 */ + "No nightingale:\n", /* Line 15 */ + " look, love, what envious streaks\n", /* Line 16 */ + "Do lace the severing clouds\n", /* Line 17 */ + " in yonder east:\n", /* Line 18 */ + "Night's candles are burnt out,\n", /* Line 19 */ + " and jocund day\n", /* Line 20 */ + "Stands tiptoe\n", /* Line 21 */ + " on the misty mountain tops.\n", /* Line 22 */ + "I must be gone and live,\n", /* Line 23 */ + " or stay and die.\n" /* Line 24 */ +}; +#endif + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* The connecton handler */ + +NXHANDLE g_hnx = NULL; + +/* The font handles */ + +NXHANDLE g_bghfont = NULL; +NXHANDLE g_puhfont = NULL; + +/* The screen resolution */ + +nxgl_coord_t g_xres; +nxgl_coord_t g_yres; + +bool b_haveresolution = false; +#ifdef CONFIG_NX_MULTIUSER +bool g_connected = false; +#endif +sem_t g_semevent = {0}; + +int g_exitcode = NXEXIT_SUCCESS; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxtext_suinitialize + ****************************************************************************/ + +#ifndef CONFIG_NX_MULTIUSER +static inline int nxtext_suinitialize(void) +{ + FAR NX_DRIVERTYPE *dev; + +#if defined(CONFIG_EXAMPLES_NXTEXT_EXTERNINIT) + /* Use external graphics driver initialization */ + + message("nxtext_initialize: Initializing external graphics device\n"); + dev = up_nxdrvinit(CONFIG_EXAMPLES_NXTEXT_DEVNO); + if (!dev) + { + message("nxtext_initialize: up_nxdrvinit failed, devno=%d\n", CONFIG_EXAMPLES_NXTEXT_DEVNO); + g_exitcode = NXEXIT_EXTINITIALIZE; + return ERROR; + } + +#elif defined(CONFIG_NX_LCDDRIVER) + int ret; + + /* Initialize the LCD device */ + + message("nxtext_initialize: Initializing LCD\n"); + ret = up_lcdinitialize(); + if (ret < 0) + { + message("nxtext_initialize: up_lcdinitialize failed: %d\n", -ret); + g_exitcode = NXEXIT_LCDINITIALIZE; + return ERROR; + } + + /* Get the device instance */ + + dev = up_lcdgetdev(CONFIG_EXAMPLES_NXTEXT_DEVNO); + if (!dev) + { + message("nxtext_initialize: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NXTEXT_DEVNO); + g_exitcode = NXEXIT_LCDGETDEV; + return ERROR; + } + + /* Turn the LCD on at 75% power */ + + (void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4)); +#else + int ret; + + /* Initialize the frame buffer device */ + + message("nxtext_initialize: Initializing framebuffer\n"); + ret = up_fbinitialize(); + if (ret < 0) + { + message("nxtext_initialize: up_fbinitialize failed: %d\n", -ret); + g_exitcode = NXEXIT_FBINITIALIZE; + return ERROR; + } + + dev = up_fbgetvplane(CONFIG_EXAMPLES_NXTEXT_VPLANE); + if (!dev) + { + message("nxtext_initialize: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXTEXT_VPLANE); + g_exitcode = NXEXIT_FBGETVPLANE; + return ERROR; + } +#endif + + /* Then open NX */ + + message("nxtext_initialize: Open NX\n"); + g_hnx = nx_open(dev); + if (!g_hnx) + { + message("nxtext_initialize: nx_open failed: %d\n", errno); + g_exitcode = NXEXIT_NXOPEN; + return ERROR; + } + return OK; +} +#endif + +/**************************************************************************** + * Name: nxtext_initialize + ****************************************************************************/ + +#ifdef CONFIG_NX_MULTIUSER +static inline int nxtext_muinitialize(void) +{ + struct sched_param param; + pthread_t thread; + pid_t servrid; + int ret; + + /* Set the client task priority */ + + param.sched_priority = CONFIG_EXAMPLES_NXTEXT_CLIENTPRIO; + ret = sched_setparam(0, ¶m); + if (ret < 0) + { + message("nxtext_initialize: sched_setparam failed: %d\n" , ret); + g_exitcode = NXEXIT_SCHEDSETPARAM; + return ERROR; + } + + /* Start the server task */ + + message("nxtext_initialize: Starting nxtext_server task\n"); + servrid = task_create("NX Server", CONFIG_EXAMPLES_NXTEXT_SERVERPRIO, + CONFIG_EXAMPLES_NXTEXT_STACKSIZE, nxtext_server, NULL); + if (servrid < 0) + { + message("nxtext_initialize: Failed to create nxtext_server task: %d\n", errno); + g_exitcode = NXEXIT_TASKCREATE; + return ERROR; + } + + /* Wait a bit to let the server get started */ + + sleep(1); + + /* Connect to the server */ + + g_hnx = nx_connect(); + if (g_hnx) + { + pthread_attr_t attr; + + /* Start a separate thread to listen for server events. This is probably + * the least efficient way to do this, but it makes this example flow more + * smoothly. + */ + + (void)pthread_attr_init(&attr); + param.sched_priority = CONFIG_EXAMPLES_NXTEXT_LISTENERPRIO; + (void)pthread_attr_setschedparam(&attr, ¶m); + (void)pthread_attr_setstacksize(&attr, CONFIG_EXAMPLES_NXTEXT_STACKSIZE); + + ret = pthread_create(&thread, &attr, nxtext_listener, NULL); + if (ret != 0) + { + printf("nxtext_initialize: pthread_create failed: %d\n", ret); + g_exitcode = NXEXIT_PTHREADCREATE; + return ERROR; + } + + /* Don't return until we are connected to the server */ + + while (!g_connected) + { + /* Wait for the listener thread to wake us up when we really + * are connected. + */ + + (void)sem_wait(&g_semevent); + } + } + else + { + message("nxtext_initialize: nx_connect failed: %d\n", errno); + g_exitcode = NXEXIT_NXCONNECT; + return ERROR; + } + return OK; +} +#endif + +/**************************************************************************** + * Name: nxtext_initialize + ****************************************************************************/ + +static int nxtext_initialize(void) +{ +#ifdef CONFIG_NX_MULTIUSER + return nxtext_muinitialize(); +#else + return nxtext_suinitialize(); +#endif +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: user_start/nxtext_main + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_NXTEXT_BUILTIN +# define MAIN_NAME nxtext_main +# define MAIN_NAME_STRING "nxtext_main" +#else +# define MAIN_NAME user_start +# define MAIN_NAME_STRING "user_start" +#endif + +int MAIN_NAME(int argc, char **argv) +{ + FAR struct nxtext_state_s *bgstate; + NXWINDOW hwnd = NULL; + nxgl_mxpixel_t color; + int popcnt; + int bkgndx; + int ret; + + /* Initialize NX */ + + ret = nxtext_initialize(); + message(MAIN_NAME_STRING ": NX handle=%p\n", g_hnx); + if (!g_hnx || ret < 0) + { + message(MAIN_NAME_STRING ": Failed to get NX handle: %d\n", errno); + g_exitcode = NXEXIT_NXOPEN; + goto errout; + } + + /* Get the configured font handles */ + + g_bghfont = nxf_getfonthandle(CONFIG_EXAMPLES_NXTEXT_BGFONTID); + if (!g_bghfont) + { + message(MAIN_NAME_STRING ": Failed to get background font handle: %d\n", errno); + g_exitcode = NXEXIT_FONTOPEN; + goto errout; + } + + g_puhfont = nxf_getfonthandle(CONFIG_EXAMPLES_NXTEXT_PUFONTID); + if (!g_puhfont) + { + message(MAIN_NAME_STRING ": Failed to get pop-up font handle: %d\n", errno); + g_exitcode = NXEXIT_FONTOPEN; + goto errout; + } + + /* Set the background to the configured background color */ + + message(MAIN_NAME_STRING ": Set background color=%d\n", CONFIG_EXAMPLES_NXTEXT_BGCOLOR); + color = CONFIG_EXAMPLES_NXTEXT_BGCOLOR; + ret = nx_setbgcolor(g_hnx, &color); + if (ret < 0) + { + message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno); + g_exitcode = NXEXIT_NXSETBGCOLOR; + goto errout_with_nx; + } + + /* Get the background window */ + + bgstate = nxbg_getstate(); + ret = nx_requestbkgd(g_hnx, &g_bgcb, bgstate); + if (ret < 0) + { + message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno); + g_exitcode = NXEXIT_NXREQUESTBKGD; + goto errout_with_nx; + } + + /* Wait until we have the screen resolution. We'll have this immediately + * unless we are dealing with the NX server. + */ + + while (!b_haveresolution) + { + (void)sem_wait(&g_semevent); + } + message(MAIN_NAME_STRING ": Screen resolution (%d,%d)\n", g_xres, g_yres); + + /* Now loop, adding text to the background and periodically presenting + * a pop-up window. + */ + + popcnt = 0; + bkgndx = 0; + for (;;) + { + /* Sleep for one second */ + + sleep(1); + popcnt++; + + /* Each three seconds, create a pop-up window. Destroy the pop-up + * window after two more seconds. + */ + + if (popcnt == 3) + { + /* Create a pop-up window */ + + hwnd = nxpu_open(); + + /* Give keyboard input to the top window (which should be the pop-up) */ + +#ifdef CONFIG_NX_KBD + message(MAIN_NAME_STRING ": Send keyboard input: %s\n", g_pumsg); + ret = nx_kbdin(g_hnx, strlen((FAR const char *)g_pumsg), g_pumsg); + if (ret < 0) + { + message(MAIN_NAME_STRING ": nx_kbdin failed: %d\n", errno); + goto errout_with_hwnd; + } +#endif + } + else if (popcnt == 5) + { + /* Destroy the pop-up window and restart the sequence */ + + message(MAIN_NAME_STRING ": Close pop-up\n"); + (void)nxpu_close(hwnd); + popcnt = 0; + } + + /* Give another line of text to the background window. Force this + * text to go the background by calling the background window interfaces + * directly. + */ + + nxbg_write(g_bgwnd, (FAR const uint8_t *)g_bgmsg[bkgndx], strlen(g_bgmsg[bkgndx])); + if (++bkgndx >= BGMSG_LINES) + { + bkgndx = 0; + } + } + + /* Close the pop-up window */ + +errout_with_hwnd: + if (popcnt >= 3) + { + message(MAIN_NAME_STRING ": Close pop-up\n"); + (void)nxpu_close(hwnd); + } + +//errout_with_bkgd: + (void)nx_releasebkgd(g_bgwnd); + +errout_with_nx: +#ifdef CONFIG_NX_MULTIUSER + /* Disconnect from the server */ + + message(MAIN_NAME_STRING ": Disconnect from the server\n"); + nx_disconnect(g_hnx); +#else + /* Close the server */ + + message(MAIN_NAME_STRING ": Close NX\n"); + nx_close(g_hnx); +#endif +errout: + return g_exitcode; +} diff --git a/apps/examples/nxtext/nxtext_popup.c b/apps/examples/nxtext/nxtext_popup.c new file mode 100644 index 0000000000..f00f6a0409 --- /dev/null +++ b/apps/examples/nxtext/nxtext_popup.c @@ -0,0 +1,408 @@ +/**************************************************************************** + * examples/nxtext/nxtext_popup.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "nxtext_internal.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#define NBM_CACHE 8 +#define NGLYPH_CACHE 8 + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static void nxpu_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + bool morem, FAR void *arg); +static void nxpu_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, + FAR const struct nxgl_point_s *pos, + FAR const struct nxgl_rect_s *bounds, + FAR void *arg); +#ifdef CONFIG_NX_MOUSE +static void nxpu_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, + uint8_t buttons, FAR void *arg); +#endif + +#ifdef CONFIG_NX_KBD +static void nxpu_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, + FAR void *arg); +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* Pop-up NX callbacks */ + +static const struct nx_callback_s g_pucb = +{ + nxpu_redraw, /* redraw */ + nxpu_position /* position */ +#ifdef CONFIG_NX_MOUSE + , nxpu_mousein /* mousein */ +#endif +#ifdef CONFIG_NX_KBD + , nxpu_kbdin /* my kbdin */ +#endif +}; + +/* Pop-up state information */ + +static struct nxtext_state_s g_pustate; +#ifdef CONFIG_NX_KBD +static struct nxtext_bitmap_s g_pubm[NBM_CACHE]; +static struct nxtext_glyph_s g_puglyph[NGLYPH_CACHE]; +#endif + +/* Some random numbers */ + +static const uint8_t g_rand8[9] = +{ + 0x18, 0x8d, 0x60, 0x42, 0xb7, 0xc2, 0x2d, 0xea, 0x6b +}; + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxpu_randpos + ****************************************************************************/ + +static fb_coord_t nxpu_randpos(fb_coord_t value) +{ + static uint8_t ndx = 0; + uint8_t rand8 = g_rand8[ndx]; + + if (++ndx >= 9) + { + ndx = 0; + } + + return (fb_coord_t)(((uint32_t)value * (uint32_t)rand8) >> 8); +} + +/**************************************************************************** + * Name: nxpu_setsize + ****************************************************************************/ + +static inline int nxpu_setsize(NXWINDOW hwnd, FAR struct nxgl_size_s *size) +{ + int ret = nx_setsize(hwnd, size); + if (ret < 0) + { + message("nxpu_setsize: nx_setsize failed: %d\n", errno); + g_exitcode = NXEXIT_NXSETSIZE; + } + return ret; +} + +/**************************************************************************** + * Name: nxpu_setposition + ****************************************************************************/ + +static inline int nxpu_setposition(NXWINDOW hwnd, FAR struct nxgl_point_s *pos) +{ + int ret = nx_setposition(hwnd, pos); + if (ret < 0) + { + message("nxpu_setposition: nx_setposition failed: %d\n", errno); + g_exitcode = NXEXIT_NXSETPOSITION; + } + return ret; +} + +/**************************************************************************** + * Name: nxpu_fillwindow + ****************************************************************************/ + +static inline void nxpu_fillwindow(NXWINDOW hwnd, + FAR const struct nxgl_rect_s *rect, + FAR struct nxtext_state_s *st) +{ + int ret; + int i; + + ret = nx_fill(hwnd, rect, st->wcolor); + if (ret < 0) + { + message("nxpu_fillwindow: nx_fill failed: %d\n", errno); + } + + /* Fill each character on the display (Only the characters within rect + * will actually be redrawn). + */ + +#ifdef CONFIG_NX_KBD + nxtext_home(st); + for (i = 0; i < st->nchars; i++) + { + nxtext_fillchar(hwnd, rect, st, g_puhfont, &st->bm[i]); + } +#endif +} + +/**************************************************************************** + * Name: nxpu_redraw + ****************************************************************************/ + +static void nxpu_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + bool more, FAR void *arg) +{ + FAR struct nxtext_state_s *st = (FAR struct nxtext_state_s *)arg; + gvdbg("hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n", + hwnd, rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, + more ? "true" : "false"); + + nxpu_fillwindow(hwnd, rect, st); +} + +/**************************************************************************** + * Name: nxpu_position + ****************************************************************************/ + +static void nxpu_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, + FAR const struct nxgl_point_s *pos, + FAR const struct nxgl_rect_s *bounds, + FAR void *arg) +{ + FAR struct nxtext_state_s *st = (FAR struct nxtext_state_s *)arg; + + /* Report the position */ + + gvdbg("hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n", + hwnd, size->w, size->h, pos->x, pos->y, + bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y); + + /* Save the window position and size */ + + st->wpos.x = pos->x; + st->wpos.y = pos->y; + + st->wsize.w = size->w; + st->wsize.h = size->h; +} + +/**************************************************************************** + * Name: nxpu_mousein + ****************************************************************************/ + +#ifdef CONFIG_NX_MOUSE +static void nxpu_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, + uint8_t buttons, FAR void *arg) +{ + message("nxpu_mousein: hwnd=%p pos=(%d,%d) button=%02x\n", + hwnd, pos->x, pos->y, buttons); +} +#endif + +/**************************************************************************** + * Name: nxpu_puts + ****************************************************************************/ + +static inline void nxpu_puts(NXWINDOW hwnd, FAR struct nxtext_state_s *st, + uint8_t nch, FAR const uint8_t *ch) +{ + nxtext_home(st); + while (nch--) + { + nxtext_putc(hwnd, st, g_puhfont, *ch++); + } +} + +/**************************************************************************** + * Name: nxpu_kbdin + ****************************************************************************/ + +#ifdef CONFIG_NX_KBD +static void nxpu_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, + FAR void *arg) +{ + FAR struct nxtext_state_s *st = (FAR struct nxtext_state_s *)arg; + gvdbg("hwnd=%p nch=%d\n", hwnd, nch); + nxpu_puts(hwnd, st, nch, ch); +} +#endif + +/**************************************************************************** + * Name: nxpu_initstate + ****************************************************************************/ + +static inline void nxpu_initstate(void) +{ +#ifdef CONFIG_NX_KBD + FAR const struct nx_font_s *fontset; +#endif + + /* Initialize the color (used for redrawing the window) */ + + memset(&g_pustate, 0, sizeof(struct nxtext_state_s)); + g_pustate.wcolor[0] = CONFIG_EXAMPLES_NXTEXT_PUCOLOR; + g_pustate.fcolor[0] = CONFIG_EXAMPLES_NXTEXT_PUFONTCOLOR; + + /* Get information about the font set being used and save this in the + * state structure + */ + +#ifdef CONFIG_NX_KBD + fontset = nxf_getfontset(g_puhfont); + g_pustate.fheight = fontset->mxheight; + g_pustate.fwidth = fontset->mxwidth; + g_pustate.spwidth = fontset->spwidth; + + /* Set up the text caches */ + + g_pustate.maxchars = NBM_CACHE; + g_pustate.maxglyphs = NGLYPH_CACHE; + g_pustate.bm = g_pubm; + g_pustate.glyph = g_puglyph; + + /* Set the first display position */ + + nxtext_home(&g_pustate); +#endif +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxpu_open + ****************************************************************************/ + +NXWINDOW nxpu_open(void) +{ + NXWINDOW hwnd; + struct nxgl_size_s size; + struct nxgl_point_s pt; + int ret; + + /* Create a pop-up window */ + + message("nxpu_open: Create pop-up\n"); + nxpu_initstate(); + + hwnd = nx_openwindow(g_hnx, &g_pucb, (FAR void *)&g_pustate); + gvdbg("hwnd=%p\n", hwnd); + + if (!hwnd) + { + message("nxpu_open: nx_openwindow failed: %d\n", errno); + g_exitcode = NXEXIT_NXOPENWINDOW; + goto errout_with_state; + } + + /* Select the size of the pop-up window */ + + size.w = g_xres / 4; + size.h = g_yres / 4; + + /* Select a random position for pop-up window */ + + pt.x = nxpu_randpos(g_xres - size.w); + pt.y = nxpu_randpos(g_yres - size.h); + + /* Set the position for the pop-up window */ + + message("nxpu_open: Set pop-up postion to (%d,%d)\n", pt.x, pt.y); + ret = nxpu_setposition(hwnd, &pt); + if (ret < 0) + { + goto errout_with_hwnd; + } + + /* Set the size of the pop-up window */ + + gvdbg("Set pop-up size to (%d,%d)\n", size.w, size.h); + ret = nxpu_setsize(hwnd, &size); + if (ret < 0) + { + goto errout_with_hwnd; + } + + return hwnd; + +errout_with_hwnd: + (void)nx_closewindow(hwnd); + +errout_with_state: + return NULL; +} + +/**************************************************************************** + * Name: nxpu_close + ****************************************************************************/ + +int nxpu_close(NXWINDOW hwnd) +{ + int ret; + + ret = nx_closewindow(hwnd); + if (ret < 0) + { + message("nxpu_close: nx_closewindow failed: %d\n", errno); + g_exitcode = NXEXIT_NXCLOSEWINDOW; + return ret; + } + return OK; +} diff --git a/apps/examples/nxtext/nxtext_putc.c b/apps/examples/nxtext/nxtext_putc.c new file mode 100644 index 0000000000..dfecfe33fe --- /dev/null +++ b/apps/examples/nxtext/nxtext_putc.c @@ -0,0 +1,598 @@ +/**************************************************************************** + * examples/nxtext/nxtext_putc.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "nxtext_internal.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Select renderer -- Some additional logic would be required to support + * pixel depths that are not directly addressable (1,2,4, and 24). + */ + +#if CONFIG_EXAMPLES_NXTEXT_BPP == 1 +# define RENDERER nxf_convert_1bpp +#elif CONFIG_EXAMPLES_NXTEXT_BPP == 2 +# define RENDERER nxf_convert_2bpp +#elif CONFIG_EXAMPLES_NXTEXT_BPP == 4 +# define RENDERER nxf_convert_4bpp +#elif CONFIG_EXAMPLES_NXTEXT_BPP == 8 +# define RENDERER nxf_convert_8bpp +#elif CONFIG_EXAMPLES_NXTEXT_BPP == 16 +# define RENDERER nxf_convert_16bpp +#elif CONFIG_EXAMPLES_NXTEXT_BPP == 24 +# define RENDERER nxf_convert_24bpp +#elif CONFIG_EXAMPLES_NXTEXT_BPP == 32 +# define RENDERER nxf_convert_32bpp +#else +# error "Unsupported CONFIG_EXAMPLES_NXTEXT_BPP" +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxtext_freeglyph + ****************************************************************************/ + +static void nxtext_freeglyph(FAR struct nxtext_glyph_s *glyph) +{ + if (glyph->bitmap) + { + free(glyph->bitmap); + } + memset(glyph, 0, sizeof(struct nxtext_glyph_s)); +} + +/**************************************************************************** + * Name: nxtext_allocglyph + ****************************************************************************/ + +static inline FAR struct nxtext_glyph_s * +nxtext_allocglyph(FAR struct nxtext_state_s *st) +{ + FAR struct nxtext_glyph_s *glyph = NULL; + FAR struct nxtext_glyph_s *luglyph = NULL; + uint8_t luusecnt; + int i; + + /* Search through the glyph cache looking for an unused glyph. Also, keep + * track of the least used glyph as well. We need that if we have to replace + * a glyph in the cache. + */ + + for (i = 0; i < st->maxglyphs; i++) + { + /* Is this glyph in use? */ + + glyph = &st->glyph[i]; + if (!glyph->usecnt) + { + /* No.. return this glyph with a use count of one */ + + glyph->usecnt = 1; + return glyph; + } + + /* Yes.. check for the least recently used */ + + if (!luglyph || glyph->usecnt < luglyph->usecnt) + { + luglyph = glyph; + } + } + + /* If we get here, the glyph cache is full. We replace the least used + * glyph with the one we need now. (luglyph can't be NULL). + */ + + luusecnt = luglyph->usecnt; + nxtext_freeglyph(luglyph); + + /* But lets decrement all of the usecnts so that the new one one be so + * far behind in the counts as the older ones. + */ + + if (luusecnt > 1) + { + uint8_t decr = luusecnt - 1; + + for (i = 0; i < st->maxglyphs; i++) + { + /* Is this glyph in use? */ + + glyph = &st->glyph[i]; + if (glyph->usecnt > decr) + { + glyph->usecnt -= decr; + } + } + } + + /* Then return the least used glyph */ + + luglyph->usecnt = 1; + return luglyph; +} + +/**************************************************************************** + * Name: nxtext_findglyph + ****************************************************************************/ + +static FAR struct nxtext_glyph_s * +nxtext_findglyph(FAR struct nxtext_state_s *st, uint8_t ch) +{ + int i; + + /* First, try to find the glyph in the cache of pre-rendered glyphs */ + + for (i = 0; i < st->maxglyphs; i++) + { + FAR struct nxtext_glyph_s *glyph = &st->glyph[i]; + if (glyph->usecnt > 0 && glyph->code == ch) + { + /* Increment the use count (unless it is already at the max) */ + + if (glyph->usecnt < MAX_USECNT) + { + glyph->usecnt++; + } + + /* And return the glyph that we found */ + + return glyph; + } + } + return NULL; +} + +/**************************************************************************** + * Name: nxtext_renderglyph + ****************************************************************************/ + +static inline FAR struct nxtext_glyph_s * +nxtext_renderglyph(FAR struct nxtext_state_s *st, + FAR const struct nx_fontbitmap_s *fbm, uint8_t ch) +{ + FAR struct nxtext_glyph_s *glyph = NULL; + FAR nxgl_mxpixel_t *ptr; +#if CONFIG_EXAMPLES_NXTEXT_BPP < 8 + nxgl_mxpixel_t pixel; +#endif + int bmsize; + int row; + int col; + int ret; + + /* Make sure that there is room for another glyph */ + + gvdbg("ch=%c [%02x]\n", isprint(ch) ? ch : '.', ch); + + /* Allocate the glyph (always succeeds) */ + + glyph = nxtext_allocglyph(st); + glyph->code = ch; + + /* Get the dimensions of the glyph */ + + glyph->width = fbm->metric.width + fbm->metric.xoffset; + glyph->height = fbm->metric.height + fbm->metric.yoffset; + + /* Allocate memory to hold the glyph with its offsets */ + + glyph->stride = (glyph->width * CONFIG_EXAMPLES_NXTEXT_BPP + 7) / 8; + bmsize = glyph->stride * glyph->height; + glyph->bitmap = (FAR uint8_t *)malloc(bmsize); + + if (glyph->bitmap) + { + /* Initialize the glyph memory to the background color */ + +#if CONFIG_EXAMPLES_NXTEXT_BPP < 8 + pixel = st->wcolor[0]; +# if CONFIG_EXAMPLES_NXTEXT_BPP == 1 + /* Pack 1-bit pixels into a 2-bits */ + + pixel &= 0x01; + pixel = (pixel) << 1 |pixel; +# endif +# if CONFIG_EXAMPLES_NXTEXT_BPP < 4 + /* Pack 2-bit pixels into a nibble */ + + pixel &= 0x03; + pixel = (pixel) << 2 |pixel; +# endif + + /* Pack 4-bit nibbles into a byte */ + + pixel &= 0x0f; + pixel = (pixel) << 4 | pixel; + + ptr = (FAR nxgl_mxpixel_t *)glyph->bitmap; + for (row = 0; row < glyph->height; row++) + { + for (col = 0; col < glyph->stride; col++) + { + /* Transfer the packed bytes into the buffer */ + + *ptr++ = pixel; + } + } + +#elif CONFIG_EXAMPLES_NXTEXT_BPP == 24 +# error "Additional logic is needed here for 24bpp support" + +#else /* CONFIG_EXAMPLES_NXTEXT_BPP = {8,16,32} */ + + ptr = (FAR nxgl_mxpixel_t *)glyph->bitmap; + for (row = 0; row < glyph->height; row++) + { + /* Just copy the color value into the glyph memory */ + + for (col = 0; col < glyph->width; col++) + { + *ptr++ = st->wcolor[0]; + } + } +#endif + + /* Then render the glyph into the allocated memory */ + + ret = RENDERER((FAR nxgl_mxpixel_t*)glyph->bitmap, + glyph->height, glyph->width, glyph->stride, + fbm, st->fcolor[0]); + if (ret < 0) + { + /* Actually, the RENDERER never returns a failure */ + + message("nxtext_renderglyph: RENDERER failed\n"); + nxtext_freeglyph(glyph); + glyph = NULL; + } + } + + return glyph; +} + +/**************************************************************************** + * Name: nxtext_fontsize + ****************************************************************************/ + +static int nxtext_fontsize(NXHANDLE hfont, uint8_t ch, FAR struct nxgl_size_s *size) +{ + FAR const struct nx_fontbitmap_s *fbm; + + /* No, it is not cached... Does the code map to a font? */ + + fbm = nxf_getbitmap(hfont, ch); + if (fbm) + { + /* Yes.. return the font size */ + + size->w = fbm->metric.width + fbm->metric.xoffset; + size->h = fbm->metric.height + fbm->metric.yoffset; + return OK; + } + + return ERROR; +} + +/**************************************************************************** + * Name: nxtext_getglyph + ****************************************************************************/ + +static FAR struct nxtext_glyph_s * +nxtext_getglyph(NXHANDLE hfont, FAR struct nxtext_state_s *st, uint8_t ch) +{ + FAR struct nxtext_glyph_s *glyph; + FAR const struct nx_fontbitmap_s *fbm; + + /* First, try to find the glyph in the cache of pre-rendered glyphs */ + + glyph = nxtext_findglyph(st, ch); + if (!glyph) + { + /* No, it is not cached... Does the code map to a font? */ + + fbm = nxf_getbitmap(hfont, ch); + if (fbm) + { + /* Yes.. render the glyph */ + + glyph = nxtext_renderglyph(st, fbm, ch); + } + } + + return glyph; +} + +/**************************************************************************** + * Name: nxtext_addchar + * + * Description: + * This is part of the nxtext_putc logic. It creates and positions a + * the character and renders (or re-uses) a glyph for font. + * + ****************************************************************************/ + +static FAR const struct nxtext_bitmap_s * +nxtext_addchar(NXHANDLE hfont, FAR struct nxtext_state_s *st, uint8_t ch) +{ + FAR struct nxtext_bitmap_s *bm = NULL; + FAR struct nxtext_glyph_s *glyph; + + /* Is there space for another character on the display? */ + + if (st->nchars < st->maxchars) + { + /* Yes, setup the bitmap information */ + + bm = &st->bm[st->nchars]; + bm->code = ch; + bm->flags = 0; + bm->pos.x = st->fpos.x; + bm->pos.y = st->fpos.y; + + /* Find (or create) the matching glyph */ + + glyph = nxtext_getglyph(hfont, st, ch); + if (!glyph) + { + /* No, there is no font for this code. Just mark this as a space. */ + + bm->flags |= BMFLAGS_NOGLYPH; + + /* Set up the next character position */ + + st->fpos.x += st->spwidth; + } + else + { + /* Set up the next character position */ + + st->fpos.x += glyph->width; + } + + /* Success.. increment nchars to retain this character */ + + st->nchars++; + } + + return bm; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxtext_home + * + * Description: + * Set the next character position to the top-left corner of the display. + * + ****************************************************************************/ + +void nxtext_home(FAR struct nxtext_state_s *st) +{ + /* The first character is one space from the left */ + + st->fpos.x = st->spwidth; + + /* And LINE_SEPARATION lines from the top */ + + st->fpos.y = LINE_SEPARATION; +} + +/**************************************************************************** + * Name: nxtext_newline + * + * Description: + * Set the next character position to the beginning of the next line. + * + ****************************************************************************/ + +void nxtext_newline(FAR struct nxtext_state_s *st) +{ + /* Carriage return: The first character is one space from the left */ + + st->fpos.x = st->spwidth; + + /* Linefeed: Down the max font height + LINE_SEPARATION */ + + st->fpos.y += (st->fheight + LINE_SEPARATION); +} + +/**************************************************************************** + * Name: nxtext_putc + * + * Description: + * Render the specified character at the current display position. + * + ****************************************************************************/ + +void nxtext_putc(NXWINDOW hwnd, FAR struct nxtext_state_s *st, NXHANDLE hfont, uint8_t ch) +{ + FAR const struct nxtext_bitmap_s *bm; + + /* If it is a newline character, then just perform the logical newline + * operation. + */ + + if (ch == '\n') + { + nxtext_newline(st); + } + + /* Otherwise, find the glyph associated with the character and render it + * onto the display. + */ + + else + { + bm = nxtext_addchar(hfont, st, ch); + if (bm) + { + nxtext_fillchar(hwnd, NULL, st, hfont, bm); + } + } +} + +/**************************************************************************** + * Name: nxtext_fillchar + * + * Description: + * This implements the character display. It is part of the nxtext_putc + * operation but may also be used when redrawing an existing display. + * + ****************************************************************************/ + +void nxtext_fillchar(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, + FAR struct nxtext_state_s *st, + NXHANDLE hfont, FAR const struct nxtext_bitmap_s *bm) +{ + FAR struct nxtext_glyph_s *glyph; + struct nxgl_rect_s bounds; + struct nxgl_rect_s intersection; + struct nxgl_size_s fsize; + int ret; + + /* Handle the special case of spaces which have no glyph bitmap */ + + if (BM_ISSPACE(bm)) + { + return; + } + + /* Get the size of the font glyph (which may not have been created yet) */ + + ret = nxtext_fontsize(hfont, bm->code, &fsize); + if (ret < 0) + { + /* This would mean that there is no bitmap for the character code and + * that the font would be rendered as a space. But this case should + * never happen here because the BM_ISSPACE() should have already + * found all such cases. + */ + + return; + } + + /* Construct a bounding box for the glyph */ + + bounds.pt1.x = bm->pos.x; + bounds.pt1.y = bm->pos.y; + bounds.pt2.x = bm->pos.x + fsize.w - 1; + bounds.pt2.y = bm->pos.y + fsize.h - 1; + + /* Should this also be clipped to a region in the window? */ + + if (rect) + { + /* Get the intersection of the redraw region and the character bitmap */ + + nxgl_rectintersect(&intersection, rect, &bounds); + } + else + { + /* The intersection is the whole glyph */ + + nxgl_rectcopy(&intersection, &bounds); + } + + /* Check for empty intersections */ + + if (!nxgl_nullrect(&intersection)) + { + FAR const void *src; + + /* Find (or create) the glyph that goes with this font */ + + glyph = nxtext_getglyph(hfont, st, bm->code); + if (!glyph) + { + /* Shouldn't happen */ + + return; + } + + /* Blit the font bitmap into the window */ + + src = (FAR const void *)glyph->bitmap; + ret = nx_bitmap((NXWINDOW)hwnd, &intersection, &src, + &bm->pos, (unsigned int)glyph->stride); + if (ret < 0) + { + message("nxtext_fillchar: nx_bitmapwindow failed: %d\n", errno); + } + } +} + diff --git a/apps/examples/nxtext/nxtext_server.c b/apps/examples/nxtext/nxtext_server.c new file mode 100644 index 0000000000..2049a31213 --- /dev/null +++ b/apps/examples/nxtext/nxtext_server.c @@ -0,0 +1,194 @@ +/**************************************************************************** + * examples/nxtext/nxtext_server.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#ifdef CONFIG_NX_LCDDRIVER +# include +#else +# include +#endif + +#include "nxtext_internal.h" + +#ifdef CONFIG_NX_MULTIUSER + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxtext_server + ****************************************************************************/ + +int nxtext_server(int argc, char *argv[]) +{ + FAR NX_DRIVERTYPE *dev; + int ret; + +#if defined(CONFIG_EXAMPLES_NXTEXT_EXTERNINIT) + /* Use external graphics driver initialization */ + + message("nxtext_server: Initializing external graphics device\n"); + dev = up_nxdrvinit(CONFIG_EXAMPLES_NXTEXT_DEVNO); + if (!dev) + { + message("nxtext_server: up_nxdrvinit failed, devno=%d\n", CONFIG_EXAMPLES_NXTEXT_DEVNO); + g_exitcode = NXEXIT_EXTINITIALIZE; + return ERROR; + } + +#elif defined(CONFIG_NX_LCDDRIVER) + /* Initialize the LCD device */ + + message("nxtext_server: Initializing LCD\n"); + ret = up_lcdinitialize(); + if (ret < 0) + { + message("nxtext_server: up_lcdinitialize failed: %d\n", -ret); + return 1; + } + + /* Get the device instance */ + + dev = up_lcdgetdev(CONFIG_EXAMPLES_NXTEXT_DEVNO); + if (!dev) + { + message("nxtext_server: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NXTEXT_DEVNO); + return 2; + } + + /* Turn the LCD on at 75% power */ + + (void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4)); +#else + /* Initialize the frame buffer device */ + + message("nxtext_server: Initializing framebuffer\n"); + ret = up_fbinitialize(); + if (ret < 0) + { + message("nxtext_server: up_fbinitialize failed: %d\n", -ret); + return 1; + } + + dev = up_fbgetvplane(CONFIG_EXAMPLES_NXTEXT_VPLANE); + if (!dev) + { + message("nxtext_server: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXTEXT_VPLANE); + return 2; + } +#endif + + /* Then start the server */ + + ret = nx_run(dev); + gvdbg("nx_run returned: %d\n", errno); + return 3; +} + +/**************************************************************************** + * Name: nxtext_listener + ****************************************************************************/ + +FAR void *nxtext_listener(FAR void *arg) +{ + int ret; + + /* Process events forever */ + + for (;;) + { + /* Handle the next event. If we were configured blocking, then + * we will stay right here until the next event is received. Since + * we have dedicated a while thread to servicing events, it would + * be most natural to also select CONFIG_NX_BLOCKING -- if not, the + * following would be a tight infinite loop (unless we added addition + * logic with nx_eventnotify and sigwait to pace it). + */ + + ret = nx_eventhandler(g_hnx); + if (ret < 0) + { + /* An error occurred... assume that we have lost connection with + * the server. + */ + + message("nxtext_listener: Lost server connection: %d\n", errno); + exit(NXEXIT_LOSTSERVERCONN); + } + + /* If we received a message, we must be connected */ + + if (!g_connected) + { + g_connected = true; + sem_post(&g_semevent); + message("nxtext_listener: Connected\n"); + } + } +} + +#endif /* CONFIG_NX_MULTIUSER */ diff --git a/apps/examples/ostest/Makefile b/apps/examples/ostest/Makefile new file mode 100644 index 0000000000..1405a2afb2 --- /dev/null +++ b/apps/examples/ostest/Makefile @@ -0,0 +1,133 @@ +############################################################################ +# apps/examples/ostest/Makefile +# +# Copyright (C) 2007-2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# NuttX OS Test + +ASRCS = +CSRCS = main.c dev_null.c + +ifneq ($(CONFIG_DISABLE_PTHREAD),y) +CSRCS += cancel.c cond.c mutex.c sem.c barrier.c +ifneq ($(CONFIG_RR_INTERVAL),0) +CSRCS += roundrobin.c +endif # CONFIG_RR_INTERVAL +ifeq ($(CONFIG_MUTEX_TYPES),y) +CSRCS += rmutex.c +endif # CONFIG_MUTEX_TYPES +endif # CONFIG_DISABLE_PTHREAD + +ifneq ($(CONFIG_DISABLE_SIGNALS),y) +CSRCS += sighand.c +ifneq ($(CONFIG_DISABLE_PTHREAD),y) +ifneq ($(CONFIG_DISABLE_CLOCK),y) +CSRCS += timedwait.c +endif # CONFIG_DISABLE_CLOCK +endif # CONFIG_DISABLE_PTHREAD +endif # CONFIG_DISABLE_SIGNALS + +ifneq ($(CONFIG_DISABLE_MQUEUE),y) +ifneq ($(CONFIG_DISABLE_PTHREAD),y) +CSRCS += mqueue.c +ifneq ($(CONFIG_DISABLE_CLOCK),y) +CSRCS += timedmqueue.c +endif # CONFIG_DISABLE_CLOCK +endif # CONFIG_DISABLE_PTHREAD +endif # CONFIG_DISABLE_MQUEUE + +ifneq ($(CONFIG_DISABLE_POSIX_TIMERS),y) +CSRCS += posixtimer.c +endif + +ifneq ($(CONFIG_DISABLE_SIGNALS),y) +ifneq ($(CONFIG_DISABLE_PTHREAD),y) +ifeq ($(CONFIG_PRIORITY_INHERITANCE),y) +CSRCS += prioinherit.c +endif # CONFIG_PRIORITY_INHERITANCE +endif # CONFIG_DISABLE_PTHREAD +endif # CONFIG_DISABLE_SIGNALS + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/ostest/barrier.c b/apps/examples/ostest/barrier.c new file mode 100644 index 0000000000..da1301dc3c --- /dev/null +++ b/apps/examples/ostest/barrier.c @@ -0,0 +1,208 @@ +/**************************************************************************** + * examples/ostest/barrier.c + * + * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include + +#include "ostest.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#define HALF_SECOND 500000L + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static pthread_barrier_t barrier; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: barrier_func + ****************************************************************************/ + +static void *barrier_func(void *parameter) +{ + int id = (int)parameter; + int status; + + printf("barrier_func: Thread %d started\n", id); +#ifndef CONFIG_DISABLE_SIGNALS + usleep(HALF_SECOND); +#endif + + /* Wait at the barrier until all threads are synchronized. */ + + printf("barrier_func: Thread %d calling pthread_barrier_wait()\n", + id); + FFLUSH(); + status = pthread_barrier_wait(&barrier); + if (status == 0) + { + printf("barrier_func: Thread %d, back with " + "status=0 (I am not special)\n", + id, status); + } + else if (status == PTHREAD_BARRIER_SERIAL_THREAD) + { + printf("barrier_func: Thread %d, back with " + "status=PTHREAD_BARRIER_SERIAL_THREAD (I AM SPECIAL)\n", + id, status); + } + else + { + printf("barrier_func: ERROR thread %d could not get semaphore value\n", + id); + } + FFLUSH(); + +#ifndef CONFIG_DISABLE_SIGNALS + usleep(HALF_SECOND); +#endif + printf("barrier_func: Thread %d done\n", id); + FFLUSH(); + return NULL; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: barrier_test + ****************************************************************************/ + +void barrier_test(void) +{ + pthread_t barrier_thread[CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS]; + pthread_addr_t result; + pthread_attr_t attr; + pthread_barrierattr_t barrierattr; + int status; + int i; + + printf("barrier_test: Initializing barrier\n"); + + status = pthread_barrierattr_init(&barrierattr); + if (status != OK) + { + printf("barrier_test: pthread_barrierattr_init failed, status=%d\n", + status); + } + + status = pthread_barrier_init(&barrier, &barrierattr, + CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS); + if (status != OK) + { + printf("barrier_test: pthread_barrierattr_init failed, status=%d\n", + status); + } + + /* Create the barrier */ + + status = pthread_barrierattr_init(&barrierattr); + + /* Start CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS thread instances */ + + status = pthread_attr_init(&attr); + if (status != OK) + { + printf("barrier_test: pthread_attr_init failed, status=%d\n", + status); + } + + for (i = 0; i < CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS; i++) + { + status = pthread_create(&barrier_thread[i], &attr, barrier_func, + (pthread_addr_t)i); + if (status != 0) + { + printf("barrier_test: Error in thread %d create, status=%d\n", + i, status); + printf("barrier_test: Test aborted with waiting threads\n"); + goto abort_test; + } + else + { + printf("barrier_test: Thread %d created\n", i); + } + } + FFLUSH(); + + /* Wait for all thread instances to complete */ + + for (i = 0; i < CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS; i++) + { + status = pthread_join(barrier_thread[i], &result); + if (status != 0) + { + printf("barrier_test: Error in thread %d join, status=%d\n", + i, status); + } + else + { + printf("barrier_test: Thread %d completed with result=%p\n", + i, result); + } + } + + /* Destroy the barrier */ + +abort_test: + status = pthread_barrier_destroy(&barrier); + if (status != OK) + { + printf("barrier_test: pthread_barrier_destroy failed, status=%d\n", + status); + } + + status = pthread_barrierattr_destroy(&barrierattr); + if (status != OK) + { + printf("barrier_test: pthread_barrierattr_destroy failed, status=%d\n", + status); + } + FFLUSH(); +} diff --git a/apps/examples/ostest/cancel.c b/apps/examples/ostest/cancel.c new file mode 100644 index 0000000000..bf2d03615f --- /dev/null +++ b/apps/examples/ostest/cancel.c @@ -0,0 +1,333 @@ +/*********************************************************************** + * examples/ostest/cancel.c + * + * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ***********************************************************************/ + +#include +#include +#include +#include +#include "ostest.h" + +static pthread_mutex_t mutex; +static pthread_cond_t cond; + +static void *thread_waiter(void *parameter) +{ + int status; + + /* Take the mutex */ + + printf("thread_waiter: Taking mutex\n"); + status = pthread_mutex_lock(&mutex); + if (status != 0) + { + printf("thread_waiter: ERROR pthread_mutex_lock failed, status=%d\n", status); + } + + printf("thread_waiter: Starting wait for condition\n"); + + /* Are we a non-cancelable thread? Yes, set the non-cancelable state */ + + if (!parameter) + { + printf("thread_waiter: Setting non-cancelable\n"); + status = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); + if (status != 0) + { + printf("thread_waiter: ERROR pthread_setcancelstate failed, status=%d\n", status); + } + } + + /* The wait -- we will never awaken from this. */ + + status = pthread_cond_wait(&cond, &mutex); + if (status != 0) + { + printf("thread_waiter: ERROR pthread_cond_wait failed, status=%d\n", status); + } + + /* Release the mutex */ + + printf("thread_waiter: Releasing mutex\n"); + status = pthread_mutex_unlock(&mutex); + if (status != 0) + { + printf("thread_waiter: ERROR pthread_mutex_unlock failed, status=%d\n", status); + } + + /* Set the cancelable state */ + + printf("thread_waiter: Setting cancelable\n"); + status = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + if (status != 0) + { + printf("thread_waiter: ERROR pthread_setcancelstate failed, status=%d\n", status); + } + + printf("thread_waiter: Exit with status 0x12345678\n"); + pthread_exit((pthread_addr_t)0x12345678); + return NULL; +} + +static void start_thread(pthread_t *waiter, int cancelable) +{ + pthread_attr_t attr; + int status; + + /* Initialize the mutex */ + + printf("start_thread: Initializing mutex\n"); + status = pthread_mutex_init(&mutex, NULL); + if (status != 0) + { + printf("start_thread: ERROR pthread_mutex_init failed, status=%d\n", status); + } + + /* Initialize the condition variable */ + + printf("start_thread: Initializing cond\n"); + status = pthread_cond_init(&cond, NULL); + if (status != 0) + { + printf("start_thread: ERROR pthread_cond_init failed, status=%d\n", status); + } + + /* Set up attributes */ + + status = pthread_attr_init(&attr); + if (status != 0) + { + printf("start_thread: pthread_attr_init failed, status=%d\n", status); + } + + status = pthread_attr_setstacksize(&attr, STACKSIZE); + if (status != 0) + { + printf("start_thread: pthread_attr_setstacksize failed, status=%d\n", status); + } + + /* Start the waiter thread */ + + printf("start_thread: Starting thread\n"); + status = pthread_create(waiter, &attr, thread_waiter, (pthread_addr_t)cancelable); + if (status != 0) + { + printf("start_thread: ERROR pthread_create failed, status=%d\n", status); + } + + /* Make sure that the waiter thread gets a chance to run */ + + printf("start_thread: Yielding\n"); + pthread_yield(); +} + +static void restart_thread(pthread_t *waiter, int cancelable) +{ + int status; + + /* Destroy the condition variable */ + + printf("restart_thread: Destroying cond\n"); + status = pthread_cond_destroy(&cond); + if (status != 0) + { + printf("restart_thread: ERROR pthread_cond_destroy failed, status=%d\n", status); + } + + /* Destroy the mutex */ + + printf("restart_thread: Destroying mutex\n"); + status = pthread_cond_destroy(&cond); + if (status != 0) + { + printf("restart_thread: ERROR pthread_mutex_destroy failed, status=%d\n", status); + } + + /* Then restart the thread */ + + printf("restart_thread: Re-starting thread\n"); + start_thread(waiter, cancelable); +} + +void cancel_test(void) +{ + pthread_t waiter; + void *result; + int status; + + /* Test 1: Normal Cancel *********************************************/ + /* Start the waiter thread */ + + printf("cancel_test: Test 1: Normal Cancelation\n"); + printf("cancel_test: Starting thread\n"); + start_thread(&waiter, 1); + + /* Then cancel it. It should be in the pthread_cond_wait now */ + + printf("cancel_test: Canceling thread\n"); + status = pthread_cancel(waiter); + if (status != 0) + { + printf("cancel_test: ERROR pthread_cancel failed, status=%d\n", status); + } + + /* Then join to the thread to pick up the result (if we don't do + * we will have a memory leak!) + */ + + printf("cancel_test: Joining\n"); + status = pthread_join(waiter, &result); + if (status != 0) + { + printf("cancel_test: ERROR pthread_join failed, status=%d\n", status); + } + else + { + printf("cancel_test: waiter exited with result=%p\n", result); + if (result != PTHREAD_CANCELED) + { + printf("cancel_test: ERROR expected result=%p\n", PTHREAD_CANCELED); + } + else + { + printf("cancel_test: PASS thread terminated with PTHREAD_CANCELED\n"); + } + } + + /* Test 2: Cancel Detached Thread ************************************/ + + printf("cancel_test: Test 2: Cancelation of detached thread\n"); + printf("cancel_test: Re-starting thread\n"); + restart_thread(&waiter, 1); + + /* Detach the thread */ + + status = pthread_detach(waiter); + if (status != 0) + { + printf("cancel_test: ERROR pthread_detach, status=%d\n", status); + } + + /* Then cancel it. It should be in the pthread_cond_wait now */ + + printf("cancel_test: Canceling thread\n"); + status = pthread_cancel(waiter); + if (status != 0) + { + printf("cancel_test: ERROR pthread_cancel failed, status=%d\n", status); + } + + /* Join should now fail */ + + printf("cancel_test: Joining\n"); + status = pthread_join(waiter, &result); + if (status == 0) + { + printf("cancel_test: ERROR pthread_join succeeded\n"); + } + else if (status != ESRCH) + { + printf("cancel_test: ERROR pthread_join failed but with wrong status=%d\n", status); + } + else + { + printf("cancel_test: PASS pthread_join failed with status=ESRCH\n"); + } + + /* Test 3: Non-cancelable threads ************************************/ + + printf("cancel_test: Test 3: Non-cancelable threads\n"); + printf("cancel_test: Re-starting thread (non-cancelable)\n"); + restart_thread(&waiter, 0); + + /* Then cancel it. It should be in the pthread_cond_wait now. The + * behavior here is non-standard: when the thread is at a cancelation + * point, it should be cancelable, even when cancelation is disable. + * + * The cancelation should succeed, because the cancelation is pending. + */ + + printf("cancel_test: Canceling thread\n"); + status = pthread_cancel(waiter); + if (status != 0) + { + printf("cancel_test: ERROR pthread_cancel failed, status=%d\n", status); + } + + /* Signal the thread. It should wake up and restore the cancelable state. + * When the cancelable state is re-enabled, the thread should be canceled. + */ + + status = pthread_mutex_lock(&mutex); + if (status != 0) + { + printf("cancel_test: ERROR pthread_mutex_lock failed, status=%d\n", status); + } + + status = pthread_cond_signal(&cond); + if (status != 0) + { + printf("cancel_test: ERROR pthread_cond_signal failed, status=%d\n", status); + } + + status = pthread_mutex_unlock(&mutex); + if (status != 0) + { + printf("cancel_test: ERROR pthread_mutex_unlock failed, status=%d\n", status); + } + + /* Then join to the thread to pick up the result (if we don't do + * we will have a memory leak!) + */ + + printf("cancel_test: Joining\n"); + status = pthread_join(waiter, &result); + if (status != 0) + { + printf("cancel_test: ERROR pthread_join failed, status=%d\n", status); + } + else + { + printf("cancel_test: waiter exited with result=%p\n", result); + if (result != PTHREAD_CANCELED) + { + printf("cancel_test: ERROR expected result=%p\n", PTHREAD_CANCELED); + } + else + { + printf("cancel_test: PASS thread terminated with PTHREAD_CANCELED\n"); + } + } + +} diff --git a/apps/examples/ostest/cond.c b/apps/examples/ostest/cond.c new file mode 100644 index 0000000000..11191b7d52 --- /dev/null +++ b/apps/examples/ostest/cond.c @@ -0,0 +1,294 @@ +/*********************************************************************** + * cond.c + * + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ***********************************************************************/ + +#include +#include +#include +#include "ostest.h" + +#ifndef NULL +# define NULL (void*)0 +#endif + +static volatile enum { RUNNING, MUTEX_WAIT, COND_WAIT} waiter_state; + +static pthread_mutex_t mutex; +static pthread_cond_t cond; +static volatile int data_available = 0; +static int waiter_nloops = 0; +static int waiter_waits = 0; +static int waiter_nerrors = 0; +static int signaler_nloops = 0; +static int signaler_already = 0; +static int signaler_state = 0; +static int signaler_nerrors = 0; + +static void *thread_waiter(void *parameter) +{ + int status; + + printf("waiter_thread: Started\n"); + + for(;;) + { + /* Take the mutex */ + + waiter_state = MUTEX_WAIT; + status = pthread_mutex_lock(&mutex); + waiter_state = RUNNING; + + if (status != 0) + { + printf("waiter_thread: ERROR pthread_mutex_lock failed, status=%d\n", status); + waiter_nerrors++; + } + + /* Check if data is available -- if data is not available then + * wait for it + */ + + if (!data_available) + { + /* We are higher priority than the signaler thread so the + * only time that the signaler thread will have a chance to run is when + * we are waiting for the condition variable. In this case, pthread_cond_wait + * will automatically release the mutex for the signaler (then re-acquire + * the mutex before returning. + */ + + waiter_state = COND_WAIT; + status = pthread_cond_wait(&cond, &mutex); + waiter_state = RUNNING; + + if (status != 0) + { + printf("waiter_thread: ERROR pthread_cond_wait failed, status=%d\n", status); + waiter_nerrors++; + } + waiter_waits++; + } + + /* Now data should be available */ + + if (!data_available) + { + printf("waiter_thread: ERROR data not available after wait\n"); + waiter_nerrors++; + } + + /* Clear data available */ + + data_available = 0; + + /* Release the mutex */ + + status = pthread_mutex_unlock(&mutex); + if (status != 0) + { + printf("waiter_thread: ERROR waiter: pthread_mutex_unlock failed, status=%d\n", status); + waiter_nerrors++; + } + + waiter_nloops++; + } + return NULL; +} + +static void *thread_signaler(void *parameter) +{ + int status; + int i; + + printf("thread_signaler: Started\n"); + for (i = 0; i < 32; i++) + { + /* Take the mutex. The waiter is higher priority and should + * run until it waits for the condition. So, at this point + * signaler should be waiting for the condition. + */ + + status = pthread_mutex_lock(&mutex); + if (status != 0) + { + printf("thread_signaler: ERROR pthread_mutex_lock failed, status=%d\n", status); + signaler_nerrors++; + } + + /* Verify the state */ + + if (waiter_state != COND_WAIT) + { + printf("thread_signaler: ERROR waiter state = %d != COND_WAITING\n", waiter_state); + signaler_state++; + } + + if (data_available) + { + printf("thread_signaler: ERROR data already available, waiter_state=%d\n", waiter_state); + signaler_already++; + } + + /* Set data available and signal the waiter */ + + data_available = 1; + status = pthread_cond_signal(&cond); + if (status != 0) + { + printf("thread_signaler: ERROR pthread_cond_signal failed, status=%d\n", status); + signaler_nerrors++; + } + + /* Release the mutex */ + + status = pthread_mutex_unlock(&mutex); + if (status != 0) + { + printf("thread_signaler: ERROR pthread_mutex_unlock failed, status=%d\n", status); + signaler_nerrors++; + } + + signaler_nloops++; + } + + printf("thread_signaler: Terminating\n"); + pthread_exit(NULL); + return NULL; /* Non-reachable -- needed for some compilers */ +} + +void cond_test(void) +{ + pthread_t waiter; + pthread_t signaler; + pthread_attr_t attr; +#ifdef SDCC + pthread_addr_t result; +#endif + struct sched_param sparam; + int prio_min; + int prio_max; + int prio_mid; + int status; + + /* Initialize the mutex */ + + printf("cond_test: Initializing mutex\n"); + status = pthread_mutex_init(&mutex, NULL); + if (status != 0) + { + printf("cond_test: ERROR pthread_mutex_init failed, status=%d\n", status); + } + + /* Initialize the condition variable */ + + printf("cond_test: Initializing cond\n"); + status = pthread_cond_init(&cond, NULL); + if (status != 0) + { + printf("cond_test: ERROR pthread_condinit failed, status=%d\n", status); + } + + /* Start the waiter thread at higher priority */ + + printf("cond_test: Starting waiter\n"); + status = pthread_attr_init(&attr); + if (status != 0) + { + printf("cond_test: pthread_attr_init failed, status=%d\n", status); + } + + prio_min = sched_get_priority_min(SCHED_FIFO); + prio_max = sched_get_priority_max(SCHED_FIFO); + prio_mid = (prio_min + prio_max) / 2; + + sparam.sched_priority = prio_mid; + status = pthread_attr_setschedparam(&attr,&sparam); + if (status != OK) + { + printf("cond_test: pthread_attr_setschedparam failed, status=%d\n", status); + } + else + { + printf("cond_test: Set thread 1 priority to %d\n", sparam.sched_priority); + } + + status = pthread_create(&waiter, &attr, thread_waiter, NULL); + if (status != 0) + { + printf("cond_test: pthread_create failed, status=%d\n", status); + } + + printf("cond_test: Starting signaler\n"); + status = pthread_attr_init(&attr); + if (status != 0) + { + printf("cond_test: pthread_attr_init failed, status=%d\n", status); + } + + sparam.sched_priority = (prio_min + prio_mid) / 2; + status = pthread_attr_setschedparam(&attr,&sparam); + if (status != OK) + { + printf("cond_test: pthread_attr_setschedparam failed, status=%d\n", status); + } + else + { + printf("cond_test: Set thread 2 priority to %d\n", sparam.sched_priority); + } + + status = pthread_create(&signaler, &attr, thread_signaler, NULL); + if (status != 0) + { + printf("cond_test: pthread_create failed, status=%d\n", status); + } + + /* Wait for the threads to stop */ + +#ifdef SDCC + pthread_join(signaler, &result); +#else + pthread_join(signaler, NULL); +#endif + printf("cond_test: signaler terminated, now cancel the waiter\n"); + pthread_detach(waiter); + pthread_cancel(waiter); + + printf("cond_test: \tWaiter\tSignaler\n"); + printf("cond_test: Loops\t%d\t%d\n", waiter_nloops, signaler_nloops); + printf("cond_test: Errors\t%d\t%d\n", waiter_nerrors, signaler_nerrors); + printf("cond_test:\n"); + printf("cond_test: %d times, waiter did not have to wait for data\n", waiter_nloops - waiter_waits); + printf("cond_test: %d times, data was already available when the signaler run\n", signaler_already); + printf("cond_test: %d times, the waiter was in an unexpected state when the signaler ran\n", signaler_state); +} diff --git a/apps/examples/ostest/dev_null.c b/apps/examples/ostest/dev_null.c new file mode 100644 index 0000000000..e8fc6cf3f9 --- /dev/null +++ b/apps/examples/ostest/dev_null.c @@ -0,0 +1,92 @@ +/**************************************************************************** + * examples/ostest/dev_null.c + * + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include +#include "ostest.h" + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +#if CONFIG_NFILE_DESCRIPTORS > 0 + +static FAR char buffer[1024]; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int dev_null(void) +{ + int nbytes; + int fd; + + fd = open("/dev/null", O_RDWR); + if (fd < 0) + { + printf("dev_null: ERROR Failed to open /dev/null\n"); + return -1; + } + + nbytes = read(fd, buffer, 1024); + if (nbytes < 0) + { + printf("dev_null: ERROR Failed to read from /dev/null\n"); + close(fd); + return -1; + } + printf("dev_null: Read %d bytes from /dev/null\n", nbytes); + + nbytes = write(fd, buffer, 1024); + if (nbytes < 0) + { + printf("dev_null: ERROR Failed to write to /dev/null\n"); + close(fd); + return -1; + } + printf("dev_null: Wrote %d bytes to /dev/null\n", nbytes); + + close(fd); + return 0; +} + +#endif /*CONFIG_NFILE_DESCRIPTORS */ diff --git a/apps/examples/ostest/main.c b/apps/examples/ostest/main.c new file mode 100644 index 0000000000..327ec60e18 --- /dev/null +++ b/apps/examples/ostest/main.c @@ -0,0 +1,514 @@ +/**************************************************************************** + * examples/ostest/main.c + * + * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "ostest.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#define PRIORITY 100 +#define NARGS 4 +#define HALF_SECOND_USEC 500000L + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const char arg1[] = "Arg1"; +static const char arg2[] = "Arg2"; +static const char arg3[] = "Arg3"; +static const char arg4[] = "Arg4"; + +#if CONFIG_NFILE_DESCRIPTORS > 0 +static const char write_data1[] = "stdio_test: write fd=1\n"; +static const char write_data2[] = "stdio_test: write fd=2\n"; +#endif + +#ifdef SDCC +/* I am not yet certain why SDCC does not like the following + * initializer. It involves some issues with 2- vs 3-byte + * pointer types. + */ + +static const char *g_argv[NARGS+1]; +#else +static const char *g_argv[NARGS+1] = { arg1, arg2, arg3, arg4, NULL }; +#endif + +#ifndef CONFIG_DISABLE_SIGNALS +static struct mallinfo g_mmbefore; +static struct mallinfo g_mmprevious; +static struct mallinfo g_mmafter; +#endif + +#ifndef CONFIG_DISABLE_ENVIRON +const char g_var1_name[] = "Variable1"; +const char g_var1_value[] = "GoodValue1"; +const char g_var2_name[] = "Variable2"; +const char g_var2_value[] = "GoodValue2"; +const char g_var3_name[] = "Variable3"; +const char g_var3_value[] = "GoodValue3"; + +const char g_bad_value1[] = "BadValue1"; +const char g_bad_value2[] = "BadValue2"; + +const char g_putenv_value[] = "Variable1=BadValue3"; + +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: show_memory_usage + ****************************************************************************/ + +#ifndef CONFIG_DISABLE_SIGNALS +static void show_memory_usage(struct mallinfo *mmbefore, + struct mallinfo *mmafter) +{ + printf("VARIABLE BEFORE AFTER\n"); + printf("======== ======== ========\n"); + printf("arena %8x %8x\n", mmbefore->arena, mmafter->arena); + printf("ordblks %8d %8d\n", mmbefore->ordblks, mmafter->ordblks); + printf("mxordblk %8x %8x\n", mmbefore->mxordblk, mmafter->mxordblk); + printf("uordblks %8x %8x\n", mmbefore->uordblks, mmafter->uordblks); + printf("fordblks %8x %8x\n", mmbefore->fordblks, mmafter->fordblks); +} +#else +# define show_memory_usage(mm1, mm2) +#endif + +/**************************************************************************** + * Name: check_test_memory_usage + ****************************************************************************/ + +#ifndef CONFIG_DISABLE_SIGNALS +static void check_test_memory_usage(void) +{ + /* Wait a little bit to let any threads terminate */ + + usleep(HALF_SECOND_USEC); + + /* Get the current memory usage */ + +#ifdef CONFIG_CAN_PASS_STRUCTS + g_mmafter = mallinfo(); +#else + (void)mallinfo(&g_mmafter); +#endif + + /* Show the change from the previous time */ + + printf("\nEnd of test memory usage:\n"); + show_memory_usage(&g_mmprevious, &g_mmafter); + + /* Set up for the next test */ + +#ifdef CONFIG_CAN_PASS_STRUCTS + g_mmprevious = g_mmafter; +#else + memcpy(&g_mmprevious, &g_mmafter, sizeof(struct mallinfo)); +#endif + + /* If so enabled, show the use of priority inheritance resources */ + + dump_nfreeholders("user_main:"); +} +#else +# define check_test_memory_usage() +#endif + +/**************************************************************************** + * Name: show_variable + ****************************************************************************/ + +#ifndef CONFIG_DISABLE_ENVIRON +static void show_variable(const char *var_name, const char *exptd_value, bool var_valid) +{ + char *actual_value = getenv(var_name); + if (actual_value) + { + if (var_valid) + { + if (strcmp(actual_value, exptd_value) == 0) + { + printf("show_variable: Variable=%s has value=%s\n", var_name, exptd_value); + } + else + { + printf("show_variable: ERROR Variable=%s has the wrong value\n", var_name); + printf("show_variable: found=%s expected=%s\n", actual_value, exptd_value); + } + } + else + { + printf("show_variable: ERROR Variable=%s has a value when it should not\n", var_name); + printf("show_variable: value=%s\n", actual_value); + } + } + else if (var_valid) + { + printf("show_variable: ERROR Variable=%s has no value\n", var_name); + printf("show_variable: Should have had value=%s\n", exptd_value); + } + else + { + printf("show_variable: Variable=%s has no value\n", var_name); + } +} + +static void show_environment(bool var1_valid, bool var2_valid, bool var3_valid) +{ + show_variable(g_var1_name, g_var1_value, var1_valid); + show_variable(g_var2_name, g_var2_value, var2_valid); + show_variable(g_var3_name, g_var3_value, var3_valid); +} +#else +# define show_environment() +#endif + +/**************************************************************************** + * Name: user_main + ****************************************************************************/ + +static int user_main(int argc, char *argv[]) +{ + int i; + + /* Sample the memory usage now */ + +#ifndef CONFIG_DISABLE_SIGNALS + usleep(HALF_SECOND_USEC); + +#ifdef CONFIG_CAN_PASS_STRUCTS + g_mmbefore = mallinfo(); + g_mmprevious = g_mmbefore; +#else + (void)mallinfo(&g_mmbefore); + memcpy(&g_mmprevious, &g_mmbefore, sizeof(struct mallinfo)); +#endif +#endif + + printf("\nuser_main: Begin argument test\n"); + printf("user_main: Started with argc=%d\n", argc); + + /* Verify passed arguments */ + + if (argc != NARGS + 1) + { + printf("user_main: Error expected argc=%d got argc=%d\n", + NARGS+1, argc); + } + + for (i = 0; i <= NARGS; i++) + { + printf("user_main: argv[%d]=\"%s\"\n", i, argv[i]); + } + + for (i = 1; i <= NARGS; i++) + { + if (strcmp(argv[i], g_argv[i-1]) != 0) + { + printf("user_main: ERROR argv[%d]: Expected \"%s\" found \"%s\"\n", + i, g_argv[i-1], argv[i]); + } + } + check_test_memory_usage(); + + /* Check environment variables */ +#ifndef CONFIG_DISABLE_ENVIRON + show_environment(true, true, true); + + unsetenv(g_var1_name); + show_environment(false, true, true); + check_test_memory_usage(); + + clearenv(); + show_environment(false, false, false); + check_test_memory_usage(); +#endif + + /* Top of test loop */ + +#if CONFIG_EXAMPLES_OSTEST_LOOPS > 1 + for (i = 0; i < CONFIG_EXAMPLES_OSTEST_LOOPS; i++) +#elif CONFIG_EXAMPLES_OSTEST_LOOPS == 0 + for (;;) +#endif + { +#if CONFIG_NFILE_DESCRIPTORS > 0 + /* Checkout /dev/null */ + + printf("\nuser_main: /dev/null test\n"); + dev_null(); + check_test_memory_usage(); +#endif + +#ifndef CONFIG_DISABLE_PTHREAD + /* Verify pthreads and pthread mutex */ + + printf("\nuser_main: mutex test\n"); + mutex_test(); + check_test_memory_usage(); +#endif + +#if !defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_MUTEX_TYPES) + /* Verify recursive mutexes */ + + printf("\nuser_main: recursive mutex test\n"); + recursive_mutex_test(); + check_test_memory_usage(); +#endif + +#ifndef CONFIG_DISABLE_PTHREAD + /* Verify pthread cancellation */ + + printf("\nuser_main: cancel test\n"); + cancel_test(); + check_test_memory_usage(); +#endif + +#ifndef CONFIG_DISABLE_PTHREAD + /* Verify pthreads and semaphores */ + + printf("\nuser_main: semaphore test\n"); + sem_test(); + check_test_memory_usage(); +#endif + +#ifndef CONFIG_DISABLE_PTHREAD + /* Verify pthreads and condition variables */ + + printf("\nuser_main: condition variable test\n"); +#ifdef CONFIG_PRIORITY_INHERITANCE + printf("\n Skipping, Test logic incompatible with priority inheritance\n"); +#else + cond_test(); + check_test_memory_usage(); +#endif +#endif + +#if !defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_DISABLE_PTHREAD) && !defined(CONFIG_DISABLE_CLOCK) + /* Verify pthreads and condition variable timed waits */ + + printf("\nuser_main: timed wait test\n"); + timedwait_test(); + check_test_memory_usage(); +#endif + +#if !defined(CONFIG_DISABLE_MQUEUE) && !defined(CONFIG_DISABLE_PTHREAD) + /* Verify pthreads and message queues */ + + printf("\nuser_main: message queue test\n"); + mqueue_test(); + check_test_memory_usage(); +#endif + +#if !defined(CONFIG_DISABLE_MQUEUE) && !defined(CONFIG_DISABLE_PTHREAD) && !defined(CONFIG_DISABLE_CLOCK) + /* Verify pthreads and message queues */ + + printf("\nuser_main: timed message queue test\n"); + timedmqueue_test(); + check_test_memory_usage(); +#endif + +#ifndef CONFIG_DISABLE_SIGNALS + /* Verify signal handlers */ + + printf("\nuser_main: signal handler test\n"); + sighand_test(); + check_test_memory_usage(); +#endif + +#if !defined(CONFIG_DISABLE_POSIX_TIMERS) && !defined(CONFIG_DISABLE_SIGNALS) + /* Verify posix timers */ + + printf("\nuser_main: POSIX timer test\n"); + timer_test(); + check_test_memory_usage(); +#endif + +#if !defined(CONFIG_DISABLE_PTHREAD) && CONFIG_RR_INTERVAL > 0 + /* Verify round robin scheduling */ + + printf("\nuser_main: round-robin scheduler test\n"); + rr_test(); + check_test_memory_usage(); +#endif + +#ifndef CONFIG_DISABLE_PTHREAD + /* Verify pthread barriers */ + + printf("\nuser_main: barrier test\n"); + barrier_test(); + check_test_memory_usage(); +#endif + +#if defined(CONFIG_PRIORITY_INHERITANCE) && !defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_DISABLE_PTHREAD) + /* Verify priority inheritance */ + + printf("\nuser_main: priority inheritance test\n"); + priority_inheritance(); + check_test_memory_usage(); +#endif /* CONFIG_PRIORITY_INHERITANCE && !CONFIG_DISABLE_SIGNALS && !CONFIG_DISABLE_PTHREAD */ + + /* Compare memory usage at time user_start started until + * user_main exits. These should not be identical, but should + * be similar enough that we can detect any serious OS memory + * leaks. + */ + +#ifndef CONFIG_DISABLE_SIGNALS + usleep(HALF_SECOND_USEC); + +#ifdef CONFIG_CAN_PASS_STRUCTS + g_mmafter = mallinfo(); +#else + (void)mallinfo(&g_mmafter); +#endif + + printf("\nFinal memory usage:\n"); + show_memory_usage(&g_mmbefore, &g_mmafter); +#endif + } + printf("user_main: Exitting\n"); + return 0; +} + +/**************************************************************************** + * Name: stdio_test + ****************************************************************************/ + +static void stdio_test(void) +{ + /* Verify that we can communicate */ + +#if CONFIG_NFILE_DESCRIPTORS > 0 + write(1, write_data1, sizeof(write_data1)-1); +#endif + printf("stdio_test: Standard I/O Check: printf\n"); + +#if CONFIG_NFILE_DESCRIPTORS > 1 + write(2, write_data2, sizeof(write_data2)-1); +#endif +#if CONFIG_NFILE_STREAMS > 0 + fprintf(stderr, "stdio_test: Standard I/O Check: fprintf to stderr\n"); +#endif +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + int result; + + /* Verify that stdio works first */ + + stdio_test(); + +#ifdef SDCC + /* I am not yet certain why SDCC does not like the following initilizers. + * It involves some issues with 2- vs 3-byte pointer types. + */ + + g_argv[0] = arg1; + g_argv[1] = arg2; + g_argv[2] = arg3; + g_argv[3] = arg4; + g_argv[4] = NULL; +#endif + + /* Set up some environment variables */ + +#ifndef CONFIG_DISABLE_ENVIRON + printf("user_start: putenv(%s)\n", g_putenv_value); + putenv(g_putenv_value); /* Varaible1=BadValue3 */ + printf("user_start: setenv(%s, %s, TRUE)\n", g_var1_name, g_var1_value); + setenv(g_var1_name, g_var1_value, TRUE); /* Variable1=GoodValue1 */ + + printf("user_start: setenv(%s, %s, FALSE)\n", g_var2_name, g_bad_value1); + setenv(g_var2_name, g_bad_value1, FALSE); /* Variable2=BadValue1 */ + printf("user_start: setenv(%s, %s, TRUE)\n", g_var2_name, g_var2_value); + setenv(g_var2_name, g_var2_value, TRUE); /* Variable2=GoodValue2 */ + + printf("user_start: setenv(%s, %s, FALSE)\n", g_var3_name, g_var3_name); + setenv(g_var3_name, g_var3_value, FALSE); /* Variable3=GoodValue3 */ + printf("user_start: setenv(%s, %s, FALSE)\n", g_var3_name, g_var3_name); + setenv(g_var3_name, g_bad_value2, FALSE); /* Variable3=GoodValue3 */ + show_environment(true, true, true); +#endif + + /* Verify that we can spawn a new task */ + +#ifndef CONFIG_CUSTOM_STACK + result = task_create("ostest", PRIORITY, STACKSIZE, user_main, g_argv); +#else + result = task_create("ostest", PRIORITY, user_main, g_argv); +#endif + if (result == ERROR) + { + printf("user_start: ERROR Failed to start user_main\n"); + } + else + { + printf("user_start: Started user_main at PID=%d\n", result); + } + + printf("user_start: Exitting\n"); + return 0; +} diff --git a/apps/examples/ostest/mqueue.c b/apps/examples/ostest/mqueue.c new file mode 100644 index 0000000000..95e6bbfc83 --- /dev/null +++ b/apps/examples/ostest/mqueue.c @@ -0,0 +1,394 @@ +/************************************************************************** + * apps/examples/ostest/mqueue.c + * + * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + **************************************************************************/ + +/************************************************************************** + * Included Files + **************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ostest.h" + +/************************************************************************** + * Private Definitions + **************************************************************************/ + +#define TEST_MESSAGE "This is a test and only a test" +#if defined(SDCC) || defined(__ZILOG__) + /* Cannot use strlen in array size */ + +# define TEST_MSGLEN (31) +#else + /* Message lenght is the size of the message plus the null terminator */ + +# define TEST_MSGLEN (strlen(TEST_MESSAGE)+1) +#endif + +#define TEST_SEND_NMSGS (10) +#ifndef CONFIG_DISABLE_SIGNALS +# define TEST_RECEIVE_NMSGS (11) +#else +# define TEST_RECEIVE_NMSGS (10) +#endif + +#define HALF_SECOND_USEC_USEC 500000L + +/************************************************************************** + * Private Types + **************************************************************************/ + +/************************************************************************** + * Private Function Prototypes + **************************************************************************/ + +/************************************************************************** + * Global Variables + **************************************************************************/ + +/************************************************************************** + * Private Variables + **************************************************************************/ + +/************************************************************************** + * Private Functions + **************************************************************************/ + +/************************************************************************** + * Public Functions + **************************************************************************/ + +static void *sender_thread(void *arg) +{ + mqd_t mqfd; + char msg_buffer[TEST_MSGLEN]; + struct mq_attr attr; + int status = 0; + int nerrors = 0; + int i; + + printf("sender_thread: Starting\n"); + + /* Fill in attributes for message queue */ + + attr.mq_maxmsg = 20; + attr.mq_msgsize = TEST_MSGLEN; + attr.mq_flags = 0; + + /* Set the flags for the open of the queue. + * Make it a blocking open on the queue, meaning it will block if + * this process tries to send to the queue and the queue is full. + * + * O_CREAT - the queue will get created if it does not already exist. + * O_WRONLY - we are only planning to write to the queue. + * + * Open the queue, and create it if the receiving process hasn't + * already created it. + */ + + mqfd = mq_open("testmq", O_WRONLY|O_CREAT, 0666, &attr); + if (mqfd < 0) + { + printf("sender_thread: ERROR mq_open failed\n"); + pthread_exit((pthread_addr_t)1); + } + + /* Fill in a test message buffer to send */ + + memcpy(msg_buffer, TEST_MESSAGE, TEST_MSGLEN); + + /* Perform the send TEST_SEND_NMSGS times */ + + for (i = 0; i < TEST_SEND_NMSGS; i++) + { + status = mq_send(mqfd, msg_buffer, TEST_MSGLEN, 42); + if (status < 0) + { + printf("sender_thread: ERROR mq_send failure=%d on msg %d\n", status, i); + nerrors++; + } + else + { + printf("sender_thread: mq_send succeeded on msg %d\n", i); + } + } + + /* Close the queue and return success */ + + if (mq_close(mqfd) < 0) + { + printf("sender_thread: ERROR mq_close failed\n"); + } + + printf("sender_thread: returning nerrors=%d\n", nerrors); + return (pthread_addr_t)nerrors; +} + +static void *receiver_thread(void *arg) +{ + mqd_t mqfd; + char msg_buffer[TEST_MSGLEN]; + struct mq_attr attr; + int nbytes; + int nerrors = 0; + int i; + + printf("receiver_thread: Starting\n"); + + /* Fill in attributes for message queue */ + + attr.mq_maxmsg = 20; + attr.mq_msgsize = TEST_MSGLEN; + attr.mq_flags = 0; + + /* Set the flags for the open of the queue. + * Make it a blocking open on the queue, meaning it will block if + * this task tries to read from the queue when the queue is empty + * + * O_CREAT - the queue will get created if it does not already exist. + * O_RDONLY - we are only planning to read from the queue. + * + * Open the queue, and create it if the sending process hasn't + * already created it. + */ + + mqfd = mq_open("testmq", O_RDONLY|O_CREAT, 0666, &attr); + if (mqfd < 0) + { + printf("receiver_thread: ERROR mq_open failed\n"); + pthread_exit((pthread_addr_t)1); + } + + /* Perform the receive TEST_RECEIVE_NMSGS times */ + + for (i = 0; i < TEST_RECEIVE_NMSGS; i++) + { + memset(msg_buffer, 0xaa, TEST_MSGLEN); + nbytes = mq_receive(mqfd, msg_buffer, TEST_MSGLEN, 0); + if (nbytes < 0) + { + /* mq_receive failed. If the error is because of EINTR then + * it is not a failure. + */ + + if (errno != EINTR) + { + printf("receiver_thread: ERROR mq_receive failure on msg %d, errno=%d\n", i, errno); + nerrors++; + } + else + { + printf("receiver_thread: mq_receive interrupted!\n", i); + } + } + else if (nbytes != TEST_MSGLEN) + { + printf("receiver_thread: mq_receive return bad size %d on msg %d\n", nbytes, i); + nerrors++; + } + else if (memcmp(TEST_MESSAGE, msg_buffer, nbytes) != 0) + { + int j; + + printf("receiver_thread: mq_receive returned corrupt message on msg %d\n", i); + printf("receiver_thread: i Expected Received\n"); + + for (j = 0; j < TEST_MSGLEN-1; j++) + { + if (isprint(msg_buffer[j])) + { + printf("receiver_thread: %2d %02x (%c) %02x (%c)\n", + j, TEST_MESSAGE[j], TEST_MESSAGE[j], msg_buffer[j], msg_buffer[j]); + } + else + { + printf("receiver_thread: %2d %02x (%c) %02x\n", + j, TEST_MESSAGE[j], TEST_MESSAGE[j], msg_buffer[j]); + } + } + printf("receiver_thread: %2d 00 %02x\n", + j, msg_buffer[j]); + } + else + { + printf("receiver_thread: mq_receive succeeded on msg %d\n", i); + } + } + + /* Close the queue and return success */ + + if (mq_close(mqfd) < 0) + { + printf("receiver_thread: ERROR mq_close failed\n"); + nerrors++; + } + + /* Destroy the queue */ + + if (mq_unlink("testmq") < 0) + { + printf("receiver_thread: ERROR mq_close failed\n"); + nerrors++; + } + + printf("receiver_thread: returning nerrors=%d\n", nerrors); + pthread_exit((pthread_addr_t)nerrors); + return (pthread_addr_t)nerrors; +} + +void mqueue_test(void) +{ + pthread_t sender; + pthread_t receiver; + void *result; + pthread_attr_t attr; + struct sched_param sparam; + int prio_min; + int prio_max; + int prio_mid; + int status; + + /* Start the sending thread at higher priority */ + + printf("mqueue_test: Starting receiver\n"); + status = pthread_attr_init(&attr); + if (status != 0) + { + printf("mqueue_test: pthread_attr_init failed, status=%d\n", status); + } + + status = pthread_attr_setstacksize(&attr, STACKSIZE); + if (status != 0) + { + printf("mqueue_test: pthread_attr_setstacksize failed, status=%d\n", status); + } + + prio_min = sched_get_priority_min(SCHED_FIFO); + prio_max = sched_get_priority_max(SCHED_FIFO); + prio_mid = (prio_min + prio_max) / 2; + + sparam.sched_priority = prio_mid; + status = pthread_attr_setschedparam(&attr,&sparam); + if (status != OK) + { + printf("mqueue_test: pthread_attr_setschedparam failed, status=%d\n", status); + } + else + { + printf("mqueue_test: Set receiver priority to %d\n", sparam.sched_priority); + } + + status = pthread_create(&receiver, &attr, receiver_thread, NULL); + if (status != 0) + { + printf("mqueue_test: pthread_create failed, status=%d\n", status); + } + + /* Start the sending thread at lower priority */ + + printf("mqueue_test: Starting sender\n"); + status = pthread_attr_init(&attr); + if (status != 0) + { + printf("mqueue_test: pthread_attr_init failed, status=%d\n", status); + } + + status = pthread_attr_setstacksize(&attr, STACKSIZE); + if (status != 0) + { + printf("mqueue_test: pthread_attr_setstacksize failed, status=%d\n", status); + } + + sparam.sched_priority = (prio_min + prio_mid) / 2; + status = pthread_attr_setschedparam(&attr,&sparam); + if (status != OK) + { + printf("mqueue_test: pthread_attr_setschedparam failed, status=%d\n", status); + } + else + { + printf("mqueue_test: Set sender thread priority to %d\n", sparam.sched_priority); + } + + status = pthread_create(&sender, &attr, sender_thread, NULL); + if (status != 0) + { + printf("mqueue_test: pthread_create failed, status=%d\n", status); + } + + printf("mqueue_test: Waiting for sender to complete\n"); + pthread_join(sender, &result); + if (result != (void*)0) + { + printf("mqueue_test: ERROR sender thread exited with %d errors\n", (int)result); + } + +#ifndef CONFIG_DISABLE_SIGNALS + /* Wake up the receiver thread with a signal */ + + printf("mqueue_test: Killing receiver\n"); + pthread_kill(receiver, 9); + + /* Wait a bit to see if the thread exits on its own */ + + usleep(HALF_SECOND_USEC_USEC); +#endif + + /* Then cancel the thread and see if it did */ + + printf("mqueue_test: Canceling receiver\n"); + status = pthread_cancel(receiver); + if (status == ESRCH) + { + printf("mqueue_test: receiver has already terminated\n"); + } + + pthread_join(receiver, &result); + if (result != (void*)0) + { + printf("mqueue_test: ERROR receiver thread exited with %d errors\n", (int)result); + } +} + + diff --git a/apps/examples/ostest/mutex.c b/apps/examples/ostest/mutex.c new file mode 100644 index 0000000000..752f833f25 --- /dev/null +++ b/apps/examples/ostest/mutex.c @@ -0,0 +1,142 @@ +/*********************************************************************** + * mutex.c + * + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ***********************************************************************/ + +#include +#include +#include "ostest.h" + +#ifndef NULL +# define NULL (void*)0 +#endif + +#define NLOOPS 32 + +static pthread_mutex_t mut; +static volatile int my_mutex = 0; +static unsigned long nloops[2] = {0, 0}; +static unsigned long nerrors[2] = {0, 0}; + +static void *thread_func(void *parameter) +{ + int id = (int)parameter; + int ndx = id - 1; + int i; + + for (nloops[ndx] = 0; nloops[ndx] < NLOOPS; nloops[ndx]++) + { + int status = pthread_mutex_lock(&mut); + if (status != 0) + { + printf("ERROR thread %d: pthread_mutex_lock failed, status=%d\n", + id, status); + } + + if (my_mutex == 1) + { + printf("ERROR thread=%d: " + "my_mutex should be zero, instead my_mutex=%d\n", + id, my_mutex); + nerrors[ndx]++; + } + + my_mutex = 1; + for (i = 0; i < 10; i++) + { + pthread_yield(); + } + my_mutex = 0; + + status = pthread_mutex_unlock(&mut); + if (status != 0) + { + printf("ERROR thread %d: pthread_mutex_unlock failed, status=%d\n", + id, status); + } + } + pthread_exit(NULL); + return NULL; /* Non-reachable -- needed for some compilers */ +} + +void mutex_test(void) +{ + pthread_t thread1, thread2; +#ifdef SDCC + pthread_addr_t result1, result2; + pthread_attr_t attr; +#endif + int status; + + /* Initialize the mutex */ + + printf("Initializing mutex\n"); + pthread_mutex_init(&mut, NULL); + + /* Start two thread instances */ + + printf("Starting thread 1\n"); +#ifdef SDCC + (void)pthread_attr_init(&attr); + status = pthread_create(&thread1, &attr, thread_func, (pthread_addr_t)1); +#else + status = pthread_create(&thread1, NULL, thread_func, (pthread_addr_t)1); +#endif + if (status != 0) + { + printf("Error in thread#1 creation\n"); + } + + printf("Starting thread 2\n"); +#ifdef SDCC + status = pthread_create(&thread2, &attr, thread_func, (pthread_addr_t)2); +#else + status = pthread_create(&thread2, NULL, thread_func, (pthread_addr_t)2); +#endif + if (status != 0) + { + printf("Error in thread#2 creation\n"); + } + +#ifdef SDCC + pthread_join(thread1, &result1); + pthread_join(thread2, &result2); +#else + pthread_join(thread1, NULL); + pthread_join(thread2, NULL); +#endif + + printf("\t\tThread1\tThread2\n"); + printf("\tLoops\t%ld\t%ld\n", nloops[0], nloops[1]); + printf("\tErrors\t%ld\t%ld\n", nerrors[0], nerrors[1]); +} diff --git a/apps/examples/ostest/ostest.h b/apps/examples/ostest/ostest.h new file mode 100644 index 0000000000..99290828e0 --- /dev/null +++ b/apps/examples/ostest/ostest.h @@ -0,0 +1,174 @@ +/**************************************************************************** + * examples/ostest/ostest.h + * + * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __OSTEST_H +#define __OSTEST_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* The task_create task size can be specified in the defconfig file */ + +#ifdef CONFIG_EXAMPLES_OSTEST_STACKSIZE +# define STACKSIZE CONFIG_EXAMPLES_OSTEST_STACKSIZE +#else +# define STACKSIZE 8192 +#endif + +/* The number of times to execute the test can be specified in the defconfig + * file. + */ + +#ifndef CONFIG_EXAMPLES_OSTEST_LOOPS +# define CONFIG_EXAMPLES_OSTEST_LOOPS 1 +#endif + +/* This is the number of threads that are created in the barrier test. + * A smaller number should be selected on systems without sufficient memory + * to start so many threads. + */ + +#ifndef CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS +# define CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS 8 +#endif + +/* Priority inheritance */ + +#if defined(CONFIG_DEBUG) && defined(CONFIG_PRIORITY_INHERITANCE) && defined(CONFIG_SEM_PHDEBUG) +# define dump_nfreeholders(s) printf(s " nfreeholders: %d\n", sem_nfreeholders()) +#else +# define dump_nfreeholders(s) +#endif + +/* If CONFIG_STDIO_LINEBUFFER is defined, the STDIO buffer will be flushed + * on each new line. Otherwise, STDIO needs to be explicitly flushed to + * see the output in context. + */ + +#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && \ + CONFIG_STDIO_BUFFER_SIZE > 0 && !defined(CONFIG_STDIO_LINEBUFFER) +# define FFLUSH() fflush(stdout) +#else +# define FFLUSH() +#endif + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/* dev_null.c ***************************************************************/ + +extern int dev_null(void); + +/* mutex.c ******************************************************************/ + +extern void mutex_test(void); + +/* rmutex.c ******************************************************************/ + +extern void recursive_mutex_test(void); + +/* sem.c ********************************************************************/ + +extern void sem_test(void); + +/* cond.c *******************************************************************/ + +extern void cond_test(void); + +/* mqueue.c *****************************************************************/ + +extern void mqueue_test(void); + +/* timedmqueue.c ************************************************************/ + +extern void timedmqueue_test(void); + +/* cancel.c *****************************************************************/ + +extern void cancel_test(void); + +/* timedwait.c **************************************************************/ + +extern void timedwait_test(void); + +/* sighand.c ****************************************************************/ + +extern void sighand_test(void); + +/* posixtimers.c ************************************************************/ + +extern void timer_test(void); + +/* roundrobin.c *************************************************************/ + +extern void rr_test(void); + +/* barrier.c ****************************************************************/ + +extern void barrier_test(void); + +/* prioinherit.c ************************************************************/ + +extern void priority_inheritance(void); + +/* APIs exported (conditionally) by the OS specifically for testing of + * priority inheritance + */ + +#if defined(CONFIG_DEBUG) && defined(CONFIG_PRIORITY_INHERITANCE) && defined(CONFIG_SEM_PHDEBUG) +extern void sem_enumholders(FAR sem_t *sem); +extern int sem_nfreeholders(void); +#else +# define sem_enumholders(sem) +# define sem_nfreeholders() +#endif + +#endif /* __OSTEST_H */ diff --git a/apps/examples/ostest/posixtimer.c b/apps/examples/ostest/posixtimer.c new file mode 100644 index 0000000000..3560c712be --- /dev/null +++ b/apps/examples/ostest/posixtimer.c @@ -0,0 +1,262 @@ +/*********************************************************************** + * examples/ostest/posixtimer.c + * + * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ***********************************************************************/ + +/************************************************************************** + * Included Files + **************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include "ostest.h" + +/************************************************************************** + * Private Definitions + **************************************************************************/ + +#ifndef NULL +# define NULL (void*)0 +#endif + +#define MY_TIMER_SIGNAL 17 +#define SIGVALUE_INT 42 + +/************************************************************************** + * Private Data + **************************************************************************/ + +static sem_t sem; +static int g_nsigreceived = 0; + +/************************************************************************** + * Private Functions + **************************************************************************/ + +static void timer_expiration(int signo, siginfo_t *info, void *ucontext) +{ + sigset_t oldset; + sigset_t allsigs; + int status; + + printf("timer_expiration: Received signal %d\n" , signo); + + g_nsigreceived++; + + /* Check signo */ + + if (signo != MY_TIMER_SIGNAL) + { + printf("timer_expiration: ERROR expected signo=%d\n" , MY_TIMER_SIGNAL); + } + + /* Check siginfo */ + + if (info->si_value.sival_int != SIGVALUE_INT) + { + printf("timer_expiration: ERROR sival_int=%d expected %d\n", + info->si_value.sival_int, SIGVALUE_INT); + } + else + { + printf("timer_expiration: sival_int=%d\n" , info->si_value.sival_int); + } + + if (info->si_signo != MY_TIMER_SIGNAL) + { + printf("timer_expiration: ERROR expected si_signo=%d, got=%d\n", + MY_TIMER_SIGNAL, info->si_signo); + } + + if (info->si_code == SI_TIMER) + { + printf("timer_expiration: si_code=%d (SI_TIMER)\n" , info->si_code); + } + else + { + printf("timer_expiration: ERROR si_code=%d, expected SI_TIMER=%d\n", + info->si_code, SI_TIMER); + } + + /* Check ucontext_t */ + + printf("timer_expiration: ucontext=%p\n" , ucontext); + + /* Check sigprocmask */ + + (void)sigfillset(&allsigs); + status = sigprocmask(SIG_SETMASK, NULL, &oldset); + if (status != OK) + { + printf("timer_expiration: ERROR sigprocmask failed, status=%d\n", + status); + } + + if (oldset != allsigs) + { + printf("timer_expiration: ERROR sigprocmask=%x expected=%x\n", + oldset, allsigs); + } + +} + +/************************************************************************** + * Public Functions + **************************************************************************/ + +void timer_test(void) +{ + sigset_t sigset; + struct sigaction act; + struct sigaction oact; + struct sigevent notify; + struct itimerspec timer; + timer_t timerid; + int status; + int i; + + printf("timer_test: Initializing semaphore to 0\n" ); + sem_init(&sem, 0, 0); + + /* Start waiter thread */ + + printf("timer_test: Unmasking signal %d\n" , MY_TIMER_SIGNAL); + + (void)sigemptyset(&sigset); + (void)sigaddset(&sigset, MY_TIMER_SIGNAL); + status = sigprocmask(SIG_UNBLOCK, &sigset, NULL); + if (status != OK) + { + printf("timer_test: ERROR sigprocmask failed, status=%d\n", + status); + } + + printf("timer_test: Registering signal handler\n" ); + act.sa_sigaction = timer_expiration; + act.sa_flags = SA_SIGINFO; + + (void)sigfillset(&act.sa_mask); + (void)sigdelset(&act.sa_mask, MY_TIMER_SIGNAL); + + status = sigaction(MY_TIMER_SIGNAL, &act, &oact); + if (status != OK) + { + printf("timer_test: ERROR sigaction failed, status=%d\n" , status); + } + +#ifndef SDCC + printf("timer_test: oact.sigaction=%p oact.sa_flags=%x oact.sa_mask=%x\n", + oact.sa_sigaction, oact.sa_flags, oact.sa_mask); +#endif + + /* Create the POSIX timer */ + + printf("timer_test: Creating timer\n" ); + + notify.sigev_notify = SIGEV_SIGNAL; + notify.sigev_signo = MY_TIMER_SIGNAL; + notify.sigev_value.sival_int = SIGVALUE_INT; + + status = timer_create(CLOCK_REALTIME, ¬ify, &timerid); + if (status != OK) + { + printf("timer_test: timer_create failed, errno=%d\n", errno); + goto errorout; + } + + /* Start the POSIX timer */ + + printf("timer_test: Starting timer\n" ); + + timer.it_value.tv_sec = 2; + timer.it_value.tv_nsec = 0; + timer.it_interval.tv_sec = 2; + timer.it_interval.tv_nsec = 0; + + status = timer_settime(timerid, 0, &timer, NULL); + if (status != OK) + { + printf("timer_test: timer_settime failed, errno=%d\n", errno); + goto errorout; + } + + /* Take the semaphore */ + + for (i = 0; i < 5; i++) + { + printf("timer_test: Waiting on semaphore\n" ); + FFLUSH(); + status = sem_wait(&sem); + if (status != 0) + { + int error = errno; + if (error == EINTR) + { + printf("timer_test: sem_wait() successfully interrupted by signal\n" ); + } + else + { + printf("timer_test: ERROR sem_wait failed, errno=%d\n" , error); + } + } + else + { + printf("timer_test: ERROR awakened with no error!\n" ); + } + printf("timer_test: g_nsigreceived=%d\n", g_nsigreceived); + } + +errorout: + sem_destroy(&sem); + + /* Then delete the timer */ + + printf("timer_test: Deleting timer\n" ); + status = timer_delete(timerid); + if (status != OK) + { + printf("timer_test: timer_create failed, errno=%d\n", errno); + } + + /* Detach the signal handler */ + + act.sa_sigaction = SIG_DFL; + status = sigaction(MY_TIMER_SIGNAL, &act, &oact); + + printf("timer_test: done\n" ); + FFLUSH(); +} diff --git a/apps/examples/ostest/prioinherit.c b/apps/examples/ostest/prioinherit.c new file mode 100644 index 0000000000..993c9e14a2 --- /dev/null +++ b/apps/examples/ostest/prioinherit.c @@ -0,0 +1,541 @@ +/**************************************************************************** + * examples/ostest/prioinherit.c + * + * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include +#include + +#ifdef CONFIG_ARCH_SIM +# include +#endif + +#include "ostest.h" + +#if defined(CONFIG_PRIORITY_INHERITANCE) && !defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_DISABLE_PTHREAD) + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#ifndef CONFIG_SEM_PREALLOCHOLDERS +# define CONFIG_SEM_PREALLOCHOLDERS 0 +#endif +#define NLOWPRI_THREADS (CONFIG_SEM_PREALLOCHOLDERS+1) + +#ifndef CONFIG_SEM_NNESTPRIO +# define CONFIG_SEM_NNESTPRIO 0 +#endif +#define NHIGHPRI_THREADS (CONFIG_SEM_NNESTPRIO+1) + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +enum thstate_e +{ + NOTSTARTED = 0, + RUNNING, + WAITING, + DONE +}; + +static sem_t g_sem; +static volatile enum thstate_e g_middlestate; +static volatile enum thstate_e g_highstate[NHIGHPRI_THREADS]; +static volatile enum thstate_e g_lowstate[NLOWPRI_THREADS]; +static int g_highpri; +static int g_medpri; +static int g_lowpri; + +/**************************************************************************** + * Name: nhighpri_waiting + ****************************************************************************/ + +static int nhighpri_waiting(void) +{ + int n = 0; + int i; + + for (i = 0; i < NHIGHPRI_THREADS; i++) + { + if (g_highstate[i] == WAITING) + { + n++; + } + } + return n; +} + +/**************************************************************************** + * Name: nhighpri_running + ****************************************************************************/ + +static int nhighpri_running(void) +{ + int n = 0; + int i; + + for (i = 0; i < NHIGHPRI_THREADS; i++) + { + if (g_highstate[i] != DONE) + { + n++; + } + } + return n; +} + +/**************************************************************************** + * Name: highpri_thread + ****************************************************************************/ + +static void *highpri_thread(void *parameter) +{ + int threadno = (int)parameter; + int ret; + + g_highstate[threadno-1] = RUNNING; + + printf("highpri_thread-%d: Started\n", threadno); + FFLUSH(); + sleep(1); + + printf("highpri_thread-%d: Calling sem_wait()\n", threadno); + g_highstate[threadno-1] = WAITING; + ret = sem_wait(&g_sem); + g_highstate[threadno-1] = DONE; + + if (ret != 0) + { + printf("highpri_thread-%d: sem_take failed: %d\n", threadno, ret); + } + else if (g_middlestate == RUNNING) + { + printf("highpri_thread-%d: SUCCESS midpri_thread is still running!\n", threadno); + } + else + { + printf("highpri_thread-%d: ERROR -- midpri_thread has already exited!\n", threadno); + } + + sem_post(&g_sem); + printf("highpri_thread-%d: Okay... I'm done!\n", threadno); + FFLUSH(); + return NULL; +} + +/**************************************************************************** + * Name: hog_cpu + ****************************************************************************/ + +static inline void hog_cpu(void) +{ +#ifdef CONFIG_ARCH_SIM + /* The simulator doesn't have any mechanism to do asynchronous pre-emption + * (basically because it doesn't have any interupts/asynchronous events). + * The simulator does "fake" a timer interrupt in up_idle() -- the idle + * thread that only executes when nothing else is running. In the simulator, + * we cannot suspend the middle priority task, or we wouldn't have the + * test that we want. So, we have no option but to pump the fake clock + * here by calling up_idle(). Sigh! + */ + + up_idle(); +#else + /* On real platforms with a real timer interrupt, we really can hog the + * CPU. When the sleep() goes off in priority_inheritance(), it will + * wake up and start the high priority thread. + */ + + volatile int i; + for (i = 0; i < INT_MAX; i++); +#endif +} + +/**************************************************************************** + * Name: medpri_thread + ****************************************************************************/ + +static void *medpri_thread(void *parameter) +{ + printf("medpri_thread: Started ... I won't let go of the CPU!\n"); + g_middlestate = RUNNING; + FFLUSH(); + + /* The following loop will completely block lowpri_thread from running. + * UNLESS priority inheritance is working. In that case, its priority + * will be boosted. + */ + + while (nhighpri_running() > 0) + { + hog_cpu(); + } + + printf("medpri_thread: Okay... I'm done!\n"); + FFLUSH(); + g_middlestate = DONE; + return NULL; +} + +/**************************************************************************** + * Name: lowpri_thread + ****************************************************************************/ + +static void *lowpri_thread(void *parameter) +{ + void *retval = (void*)-1; + struct sched_param sparam; + int threadno = (int)parameter; + int expected; + int count; + int policy; + int ret; + int nwaiting; + int i; + + g_lowstate[threadno-1] = RUNNING; + printf("lowpri_thread-%d: Started\n", threadno); + + ret = pthread_getschedparam(pthread_self(), &policy, &sparam); + if (ret != 0) + { + printf("lowpri_thread-%d: ERROR pthread_getschedparam failed: %d\n", threadno, ret); + } + else + { + printf("lowpri_thread-%d: initial priority: %d\n", threadno, sparam.sched_priority); + if (sparam.sched_priority != g_lowpri) + { + printf(" ERROR should have been %d\n", g_lowpri); + } + } + + g_lowstate[threadno-1] = WAITING; + ret = sem_wait(&g_sem); + if (ret != 0) + { + printf("lowpri_thread-%d: sem_take failed: %d\n", threadno, ret); + } + else + { + /* Hang on to the thread until the middle priority thread runs */ + + while (g_middlestate == NOTSTARTED && nhighpri_waiting() < NHIGHPRI_THREADS) + { + printf("lowpri_thread-%d: Waiting for the midle pri task to run\n", threadno); + printf(" g_middlestate: %d\n", (int)g_middlestate); + for (i = 0; i < NHIGHPRI_THREADS; i++) + { + printf(" g_highstate[%d]: %d\n", i, (int)g_highstate[i]); + } + printf(" I still have a count on the semaphore\n"); + sem_enumholders(&g_sem); + FFLUSH(); + sleep(1); + } + + /* Account for all of the semaphore counts. At any given time if there are 'n' + * running hight prioity tasks, then the semaphore count should be '-n' + */ + + sched_lock(); /* Needs to be atomic */ + ret = sem_getvalue(&g_sem, &count); + nwaiting = nhighpri_waiting(); + sched_unlock(); + + if (ret < 0) + { + printf("lowpri_thread-%d: ERROR sem_getvalue failed: %d\n", threadno, errno); + } + printf("lowpri_thread-%d: Sem count: %d, No. highpri thread: %d\n", threadno, count, nwaiting); + + /* The middle priority task is running, let go of the semaphore */ + + if (g_middlestate == RUNNING && nwaiting == -count) + { + /* Good.. the middle priority task is still running and the counts are okay. */ + + retval = NULL; + } + else + { + /* If the sem count is positive, then there all of the higher priority threads + * should have already completed. + */ + + printf("lowpri_thread-%d: %s the middle priority task has already exitted!\n", + threadno, count >= 0 ? "SUCCESS" : "ERROR" ); + printf(" g_middlestate: %d sem count=%d\n", (int)g_middlestate, count); + for (i = 0; i < NHIGHPRI_THREADS; i++) + { + printf(" g_highstate[%d]: %d\n", i, (int)g_highstate[i]); + } + } + } + + ret = pthread_getschedparam(pthread_self(), &policy, &sparam); + sem_enumholders(&g_sem); + sem_post(&g_sem); + if (ret != 0) + { + printf("lowpri_thread-%d: ERROR pthread_getschedparam failed: %d\n", threadno, ret); + } + else + { + if (nwaiting > 0) + { + expected = g_highpri; + } + else + { + expected = g_lowpri; + } + + printf("lowpri_thread-%d: %s priority before sem_post: %d\n", + threadno, + sparam.sched_priority != expected ? "ERROR" : "SUCCESS", + sparam.sched_priority); + + if (sparam.sched_priority != expected) + { + printf(" ERROR should have been %d\n", expected); + } + } + + ret = pthread_getschedparam(pthread_self(), &policy, &sparam); + if (ret != 0) + { + printf("lowpri_thread-%d: ERROR pthread_getschedparam failed: %d\n", threadno, ret); + } + else + { + printf("lowpri_thread-%d: %s final priority: %d\n", + threadno, + sparam.sched_priority != g_lowpri ? "ERROR" : "SUCCESS", + sparam.sched_priority); + + if (sparam.sched_priority != g_lowpri) + { + printf(" ERROR should have been %d\n", g_lowpri); + } + } + sem_enumholders(&g_sem); + + printf("lowpri_thread-%d: Okay... I'm done!\n", threadno); + FFLUSH(); + g_lowstate[threadno-1] = DONE; + return retval; +} +#endif /* CONFIG_PRIORITY_INHERITANCE && !CONFIG_DISABLE_SIGNALS && !CONFIG_DISABLE_PTHREAD */ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: priority_inheritance + ****************************************************************************/ + +void priority_inheritance(void) +{ +#if defined(CONFIG_PRIORITY_INHERITANCE) && !defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_DISABLE_PTHREAD) + pthread_t lowpri[NLOWPRI_THREADS]; + pthread_t medpri; + pthread_t highpri[NHIGHPRI_THREADS]; + pthread_addr_t result; + pthread_attr_t attr; + struct sched_param sparam; + int my_pri; + int status; + int i; + + printf("priority_inheritance: Started\n"); + + g_middlestate = NOTSTARTED; + for (i = 0; i < NHIGHPRI_THREADS; i++) g_highstate[i] = NOTSTARTED; + for (i = 0; i < NLOWPRI_THREADS; i++) g_lowstate[i] = NOTSTARTED; + + status = sched_getparam (getpid(), &sparam); + if (status != 0) + { + printf("priority_inheritance: sched_getparam failed\n"); + sparam.sched_priority = PTHREAD_DEFAULT_PRIORITY; + } + my_pri = sparam.sched_priority; + + g_highpri = sched_get_priority_max(SCHED_FIFO); + g_lowpri = sched_get_priority_min(SCHED_FIFO); + g_medpri = my_pri - 1; + + sem_init(&g_sem, 0, NLOWPRI_THREADS); + dump_nfreeholders("priority_inheritance:"); + + /* Start the low priority threads */ + + for (i = 0; i < NLOWPRI_THREADS; i++) + { + int threadno = i+1; + printf("priority_inheritance: Starting lowpri_thread-%d (of %d) at %d\n", + threadno, NLOWPRI_THREADS, g_lowpri); + status = pthread_attr_init(&attr); + if (status != 0) + { + printf("priority_inheritance: pthread_attr_init failed, status=%d\n", status); + } + sparam.sched_priority = g_lowpri; + status = pthread_attr_setschedparam(&attr,& sparam); + if (status != OK) + { + printf("priority_inheritance: pthread_attr_setschedparam failed, status=%d\n", status); + } + else + { + printf("priority_inheritance: Set lowpri_thread-%d priority to %d\n", + threadno, sparam.sched_priority); + } + + status = pthread_create(&lowpri[i], &attr, lowpri_thread, (void*)threadno); + if (status != 0) + { + printf("priority_inheritance: pthread_create failed, status=%d\n", status); + } + } + printf("priority_inheritance: Waiting...\n"); + sleep(2); + dump_nfreeholders("priority_inheritance:"); + + /* Start the medium priority thread */ + + printf("priority_inheritance: Starting medpri_thread at %d\n", g_medpri); + status = pthread_attr_init(&attr); + if (status != 0) + { + printf("priority_inheritance: pthread_attr_init failed, status=%d\n", status); + } + + sparam.sched_priority = g_medpri; + status = pthread_attr_setschedparam(&attr,& sparam); + if (status != OK) + { + printf("priority_inheritance: pthread_attr_setschedparam failed, status=%d\n", status); + } + else + { + printf("priority_inheritance: Set medpri_thread priority to %d\n", sparam.sched_priority); + } + FFLUSH(); + + status = pthread_create(&medpri, &attr, medpri_thread, NULL); + if (status != 0) + { + printf("priority_inheritance: pthread_create failed, status=%d\n", status); + } + printf("priority_inheritance: Waiting...\n"); + sleep(1); + dump_nfreeholders("priority_inheritance:"); + + /* Start the high priority threads */ + + for (i = 0; i < NHIGHPRI_THREADS; i++) + { + int threadno = i+1; + printf("priority_inheritance: Starting highpri_thread-%d (of %d) at %d\n", + threadno, NHIGHPRI_THREADS, g_highpri); + status = pthread_attr_init(&attr); + if (status != 0) + { + printf("priority_inheritance: pthread_attr_init failed, status=%d\n", status); + } + + sparam.sched_priority = g_highpri - i; + status = pthread_attr_setschedparam(&attr,& sparam); + if (status != OK) + { + printf("priority_inheritance: pthread_attr_setschedparam failed, status=%d\n", status); + } + else + { + printf("priority_inheritance: Set highpri_thread-%d priority to %d\n", + threadno, sparam.sched_priority); + } + FFLUSH(); + + status = pthread_create(&highpri[i], &attr, highpri_thread, (void*)threadno); + if (status != 0) + { + printf("priority_inheritance: pthread_create failed, status=%d\n", status); + } + } + dump_nfreeholders("priority_inheritance:"); + FFLUSH(); + + /* Wait for all thread instances to complete */ + + for (i = 0; i < NHIGHPRI_THREADS; i++) + { + printf("priority_inheritance: Waiting for highpri_thread-%d to complete\n", i+1); + FFLUSH(); + (void)pthread_join(highpri[i], &result); + dump_nfreeholders("priority_inheritance:"); + } + printf("priority_inheritance: Waiting for medpri_thread to complete\n"); + FFLUSH(); + (void)pthread_join(medpri, &result); + dump_nfreeholders("priority_inheritance:"); + for (i = 0; i < NLOWPRI_THREADS; i++) + { + printf("priority_inheritance: Waiting for lowpri_thread-%d to complete\n", i+1); + FFLUSH(); + (void)pthread_join(lowpri[i], &result); + dump_nfreeholders("priority_inheritance:"); + } + + printf("priority_inheritance: Finished\n"); + sem_destroy(&g_sem); + dump_nfreeholders("priority_inheritance:"); + FFLUSH(); +#endif /* CONFIG_PRIORITY_INHERITANCE && !CONFIG_DISABLE_SIGNALS && !CONFIG_DISABLE_PTHREAD */ +} diff --git a/apps/examples/ostest/rmutex.c b/apps/examples/ostest/rmutex.c new file mode 100644 index 0000000000..44eb4bb3b5 --- /dev/null +++ b/apps/examples/ostest/rmutex.c @@ -0,0 +1,166 @@ +/*********************************************************************** + * rmutex.c + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ***********************************************************************/ + +#include +#include +#include "ostest.h" + +#ifndef NULL +# define NULL (void*)0 +#endif + +#define NTHREADS 3 +#define NLOOPS 3 +#define NRECURSIONS 3 + +static pthread_mutex_t mut; + +static void thread_inner(int id, int level) +{ + int status; + if (level < NRECURSIONS) + { + /* Take the mutex */ + + printf("thread_inner[%d, %d]: Locking\n", id, level); + status = pthread_mutex_lock(&mut); + if (status != 0) + { + printf("thread_inner[%d, %d]: ERROR pthread_mutex_lock failed: %d\n", + id, level, status); + } + printf("thread_inner[%d, %d]: Locked\n", id, level); + + /* Give the other threads a chance */ + + pthread_yield(); + thread_inner(id, level+1); + pthread_yield(); + + /* Unlock the mutex */ + + printf("thread_inner[%d, %d]: Unlocking\n", id, level); + status = pthread_mutex_unlock(&mut); + if (status != 0) + { + printf("thread_inner[%d, %d]: ERROR pthread_mutex_unlock failed: %d\n", + id, level, status); + } + printf("thread_inner[%d, %d]: Unlocked\n", id, level); + pthread_yield(); + } +} + +static void *thread_outer(void *parameter) +{ + int i; + printf("thread_outer[%d]: Started\n", (int)parameter); + for (i = 0; i < NLOOPS; i++) + { + printf("thread_outer[%d]: Loop %d\n", (int)parameter, i); + thread_inner((int)parameter, 0); + } + printf("thread_outer[%d]: Exitting\n", (int)parameter); + pthread_exit(NULL); + return NULL; /* Non-reachable -- needed for some compilers */ +} + +void recursive_mutex_test(void) +{ + pthread_t thread[NTHREADS]; +#ifdef SDCC + pthread_addr_t result[NTHREADS]; + pthread_attr_t attr; +#endif + pthread_mutexattr_t mattr; + int type; + int status; + int i; + + /* Initialize the mutex attributes */ + + pthread_mutexattr_init(&mattr); + status = pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE); + if (status != 0) + { + printf("recursive_mutex_test: ERROR pthread_mutexattr_settype failed, status=%d\n", status); + } + + status = pthread_mutexattr_gettype(&mattr, &type); + if (status != 0) + { + printf("recursive_mutex_test: ERROR pthread_mutexattr_gettype failed, status=%d\n", status); + } + if (type != PTHREAD_MUTEX_RECURSIVE) + { + printf("recursive_mutex_test: ERROR pthread_mutexattr_gettype return type=%d\n", type); + } + + /* Initialize the mutex */ + + printf("recursive_mutex_test: Initializing mutex\n"); + pthread_mutex_init(&mut, &mattr); + + /* Start the threads -- all at the same, default priority */ + + for (i = 0; i < NTHREADS; i++) + { + printf("recursive_mutex_test: Starting thread %d\n", i+1); +#ifdef SDCC + (void)pthread_attr_init(&attr); + status = pthread_create(&thread[i], &attr, thread_outer, (pthread_addr_t)i+1); +#else + status = pthread_create(&thread[i], NULL, thread_outer, (pthread_addr_t)i+1); +#endif + if (status != 0) + { + printf("recursive_mutex_test: ERRROR thread#%d creation: %d\n", i+1, status); + } + } + + /* Wait for all; of the threads to complete */ + + for (i = 0; i < NTHREADS; i++) + { + printf("recursive_mutex_test: Waiting for thread %d\n", i+1); +#ifdef SDCC + pthread_join(thread[i], &result1); +#else + pthread_join(thread[i], NULL); +#endif + } + + printf("recursive_mutex_test: Complete\n"); +} diff --git a/apps/examples/ostest/roundrobin.c b/apps/examples/ostest/roundrobin.c new file mode 100644 index 0000000000..061d51f3da --- /dev/null +++ b/apps/examples/ostest/roundrobin.c @@ -0,0 +1,232 @@ +/******************************************************************************** + * examples/ostest/roundrobin.c + * + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ********************************************************************************/ + +/******************************************************************************** + * Included Files + ********************************************************************************/ + +#include +#include +#include "ostest.h" + +#if CONFIG_RR_INTERVAL > 0 + +/******************************************************************************** + * Definitions + ********************************************************************************/ + +/* This number may need to be tuned for different processor speeds. Since these + * arrays must be large to very correct SCHED_RR behavior, this test may require + * too much memory on many targets. + */ + +/* #define CONFIG_NINTEGERS 32768 Takes forever on 60Mhz ARM7 */ + +#define CONFIG_NINTEGERS 2048 + +/******************************************************************************** + * Private Data + ********************************************************************************/ + +static int prime1[CONFIG_NINTEGERS]; +static int prime2[CONFIG_NINTEGERS]; + +/******************************************************************************** + * Private Functions + ********************************************************************************/ + +/******************************************************************************** + * Name: dosieve + * + * Description + * This implements a "sieve of aristophanes" algorithm for finding prime number. + * Credit for this belongs to someone, but I am not sure who anymore. Anyway, + * the only purpose here is that we need some algorithm that takes a long period + * of time to execute. + * + ********************************************************************************/ + +static void dosieve(int *prime) +{ + int a,d; + int i; + int j; + + a = 2; + d = a; + + for (i = 0; i < CONFIG_NINTEGERS; i++) + { + prime[i] = i+2; + } + + for (i = 1; i < 10; i++) + { + for (j = 0; j < CONFIG_NINTEGERS; j++) + { + d = a + d; + if (d < CONFIG_NINTEGERS) + { + prime[d]=0; + } + } + a++; + d = a; + i++; + } + +#if 0 /* We don't really care what the numbers are */ + for (i = 0, j= 0; i < CONFIG_NINTEGERS; i++) + { + if (prime[i] != 0) + { + printf(" Prime %d: %d\n", j, prime[i]); + j++; + } + } +#endif +} + +/******************************************************************************** + * Name: sieve1 + ********************************************************************************/ + +static void *sieve1(void *parameter) +{ + int i; + + printf("sieve1 started\n"); + + for (i = 0; i < 1000; i++) + { + dosieve(prime1); + } + + printf("sieve1 finished\n"); + + pthread_exit(NULL); + return NULL; /* To keep some compilers happy */ +} + +/******************************************************************************** + * Name: sieve2 + ********************************************************************************/ + +static void *sieve2(void *parameter) +{ + int i; + + printf("sieve2 started\n"); + + for (i = 0; i < 1000; i++) + { + dosieve(prime2); + } + + printf("sieve2 finished\n"); + + pthread_exit(NULL); + return NULL; /* To keep some compilers happy */ +} + +/******************************************************************************** + * Public Functions + ********************************************************************************/ + +/******************************************************************************** + * Name: rr_test + ********************************************************************************/ + +void rr_test(void) +{ + pthread_t sieve1_thread; + pthread_t sieve2_thread; + struct sched_param sparam; + pthread_attr_t attr; + pthread_addr_t result; + int status; + + printf("rr_test: Starting sieve1 thread \n"); + status = pthread_attr_init(&attr); + if (status != OK) + { + printf("rr_test: pthread_attr_init failed, status=%d\n", status); + } + + sparam.sched_priority = sched_get_priority_min(SCHED_FIFO); + status = pthread_attr_setschedparam(&attr, &sparam); + if (status != OK) + { + printf("rr_test: pthread_attr_setschedparam failed, status=%d\n", status); + } + else + { + printf("rr_test: Set thread priority to %d\n", sparam.sched_priority); + } + + status = pthread_attr_setschedpolicy(&attr, SCHED_RR); + if (status != OK) + { + printf("rr_test: pthread_attr_setschedpolicy failed, status=%d\n", status); + } + else + { + printf("rr_test: Set thread policty to SCHED_RR\n"); + } + + status = pthread_create(&sieve1_thread, &attr, sieve1, NULL); + if (status != 0) + { + printf("rr_test: Error in thread 1 creation, status=%d\n", status); + } + + printf("rr_test: Starting sieve1 thread \n"); + + status = pthread_create(&sieve2_thread, &attr, sieve2, NULL); + if (status != 0) + { + printf("rr_test: Error in thread 2 creation, status=%d\n", status); + } + + printf("rr_test: Waiting for sieves to complete -- this should take awhile\n"); + printf("rr_test: If RR scheduling is working, they should start and complete at\n"); + printf("rr_test: about the same time\n"); + + pthread_join(sieve2_thread, &result); + pthread_join(sieve1_thread, &result); + printf("rr_test: Done\n"); +} + +#endif /* CONFIG_RR_INTERVAL */ diff --git a/apps/examples/ostest/sem.c b/apps/examples/ostest/sem.c new file mode 100644 index 0000000000..850cf8040b --- /dev/null +++ b/apps/examples/ostest/sem.c @@ -0,0 +1,246 @@ +/*********************************************************************** + * sem.c + * + * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ***********************************************************************/ + +#include +#include +#include +#include +#include "ostest.h" + +#ifndef NULL +# define NULL (void*)0 +#endif + +static sem_t sem; + +static void *waiter_func(void *parameter) +{ + int id = (int)parameter; + int status; + int value; + + printf("waiter_func: Thread %d Started\n", id); + + /* Take the semaphore */ + + status = sem_getvalue(&sem, &value); + if (status < 0) + { + printf("waiter_func: ERROR thread %d could not get semaphore value\n", id); + } + else + { + printf("waiter_func: Thread %d initial semaphore value = %d\n", id, value); + } + + printf("waiter_func: Thread %d waiting on semaphore\n", id); + status = sem_wait(&sem); + if (status != 0) + { + printf("waiter_func: ERROR thread %d sem_wait failed\n", id); + } + printf("waiter_func: Thread %d awakened\n", id); + + status = sem_getvalue(&sem, &value); + if (status < 0) + { + printf("waiter_func: ERROR thread %d could not get semaphore value\n", id); + } + else + { + printf("waiter_func: Thread %d new semaphore value = %d\n", id, value); + } + + printf("waiter_func: Thread %d done\n", id); + return NULL; +} + +static void *poster_func(void *parameter) +{ + int id = (int)parameter; + int status; + int value; + + printf("poster_func: Thread %d started\n", id); + + /* Take the semaphore */ + + do + { + status = sem_getvalue(&sem, &value); + if (status < 0) + { + printf("poster_func: ERROR thread %d could not get semaphore value\n", id); + } + else + { + printf("poster_func: Thread %d semaphore value = %d\n", id, value); + } + + if (value < 0) + { + printf("poster_func: Thread %d posting semaphore\n", id); + status = sem_post(&sem); + if (status != 0) + { + printf("poster_func: ERROR thread %d sem_wait failed\n", id); + } + + pthread_yield(); + + status = sem_getvalue(&sem, &value); + if (status < 0) + { + printf("poster_func: ERROR thread %d could not get semaphore value\n", id); + } + else + { + printf("poster_func: Thread %d new semaphore value = %d\n", id, value); + } + } + } + while (value < 0); + + printf("poster_func: Thread %d done\n", id); + return NULL; + +} + +void sem_test(void) +{ + pthread_t waiter_thread1; + pthread_t waiter_thread2; + pthread_t poster_thread; +#ifdef SDCC + pthread_addr_t result; +#endif + struct sched_param sparam; + int prio_min; + int prio_max; + int prio_mid; + pthread_attr_t attr; + int status; + + printf("sem_test: Initializing semaphore to 0\n"); + sem_init(&sem, 0, 0); + + /* Start two waiter thread instances */ + + printf("sem_test: Starting waiter thread 1\n"); + status = pthread_attr_init(&attr); + if (status != OK) + { + printf("sem_test: pthread_attr_init failed, status=%d\n", status); + } + + prio_min = sched_get_priority_min(SCHED_FIFO); + prio_max = sched_get_priority_max(SCHED_FIFO); + prio_mid = (prio_min + prio_max) / 2; + + sparam.sched_priority = (prio_mid + prio_max) / 2; + status = pthread_attr_setschedparam(&attr,&sparam); + if (status != OK) + { + printf("sem_test: pthread_attr_setschedparam failed, status=%d\n", status); + } + else + { + printf("sem_test: Set thread 1 priority to %d\n", sparam.sched_priority); + } + + status = pthread_create(&waiter_thread1, &attr, waiter_func, (pthread_addr_t)1); + if (status != 0) + { + printf("sem_test: Error in thread 1 creation, status=%d\n", status); + } + + printf("sem_test: Starting waiter thread 2\n"); + status = pthread_attr_init(&attr); + if (status != 0) + { + printf("sem_test: pthread_attr_init failed, status=%d\n", status); + } + + sparam.sched_priority = prio_mid; + status = pthread_attr_setschedparam(&attr,&sparam); + if (status != OK) + { + printf("sem_test: pthread_attr_setschedparam failed, status=%d\n", status); + } + else + { + printf("sem_test: Set thread 2 priority to %d\n", sparam.sched_priority); + } + + status = pthread_create(&waiter_thread2, &attr, waiter_func, (pthread_addr_t)2); + if (status != 0) + { + printf("sem_test: Error in thread 2 creation, status=%d\n", status); + } + + printf("sem_test: Starting poster thread 3\n"); + status = pthread_attr_init(&attr); + if (status != 0) + { + printf("sem_test: pthread_attr_init failed, status=%d\n", status); + } + + sparam.sched_priority = (prio_min + prio_mid) / 2; + status = pthread_attr_setschedparam(&attr,&sparam); + if (status != OK) + { + printf("sem_test: pthread_attr_setschedparam failed, status=%d\n", status); + } + else + { + printf("sem_test: Set thread 3 priority to %d\n", sparam.sched_priority); + } + + status = pthread_create(&poster_thread, &attr, poster_func, (pthread_addr_t)3); + if (status != 0) + { + printf("sem_test: Error in thread 3 creation, status=%d\n", status); + } + +#ifdef SDCC + pthread_join(waiter_thread1, &result); + pthread_join(waiter_thread2, &result); + pthread_join(poster_thread, &result); +#else + pthread_join(waiter_thread1, NULL); + pthread_join(waiter_thread2, NULL); + pthread_join(poster_thread, NULL); +#endif +} diff --git a/apps/examples/ostest/sighand.c b/apps/examples/ostest/sighand.c new file mode 100644 index 0000000000..6815316395 --- /dev/null +++ b/apps/examples/ostest/sighand.c @@ -0,0 +1,267 @@ +/*********************************************************************** + * apps/examples/ostest/sighand.c + * + * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ***********************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "ostest.h" + +#ifndef NULL +# define NULL (void*)0 +#endif + +#define WAKEUP_SIGNAL 17 +#define SIGVALUE_INT 42 + +static sem_t sem; +static bool sigreceived = false; +static bool threadexited = false; + +static void wakeup_action(int signo, siginfo_t *info, void *ucontext) +{ + sigset_t oldset; + sigset_t allsigs; + int status; + + printf("wakeup_action: Received signal %d\n" , signo); + + sigreceived = true; + + /* Check signo */ + + if (signo != WAKEUP_SIGNAL) + { + printf("wakeup_action: ERROR expected signo=%d\n" , WAKEUP_SIGNAL); + } + + /* Check siginfo */ + + if (info->si_value.sival_int != SIGVALUE_INT) + { + printf("wakeup_action: ERROR sival_int=%d expected %d\n", + info->si_value.sival_int, SIGVALUE_INT); + } + else + { + printf("wakeup_action: sival_int=%d\n" , info->si_value.sival_int); + } + + if (info->si_signo != WAKEUP_SIGNAL) + { + printf("wakeup_action: ERROR expected si_signo=%d, got=%d\n", + WAKEUP_SIGNAL, info->si_signo); + } + + printf("wakeup_action: si_code=%d\n" , info->si_code); + + /* Check ucontext_t */ + + printf("wakeup_action: ucontext=%p\n" , ucontext); + + /* Check sigprocmask */ + + (void)sigfillset(&allsigs); + status = sigprocmask(SIG_SETMASK, NULL, &oldset); + if (status != OK) + { + printf("wakeup_action: ERROR sigprocmask failed, status=%d\n", + status); + } + + if (oldset != allsigs) + { + printf("wakeup_action: ERROR sigprocmask=%x expected=%x\n", + oldset, allsigs); + } +} + +static int waiter_main(int argc, char *argv[]) +{ + sigset_t sigset; + struct sigaction act; + struct sigaction oact; + int status; + + printf("waiter_main: Waiter started\n" ); + + printf("waiter_main: Unmasking signal %d\n" , WAKEUP_SIGNAL); + (void)sigemptyset(&sigset); + (void)sigaddset(&sigset, WAKEUP_SIGNAL); + status = sigprocmask(SIG_UNBLOCK, &sigset, NULL); + if (status != OK) + { + printf("waiter_main: ERROR sigprocmask failed, status=%d\n", + status); + } + + printf("waiter_main: Registering signal handler\n" ); + act.sa_sigaction = wakeup_action; + act.sa_flags = SA_SIGINFO; + + (void)sigfillset(&act.sa_mask); + (void)sigdelset(&act.sa_mask, WAKEUP_SIGNAL); + + status = sigaction(WAKEUP_SIGNAL, &act, &oact); + if (status != OK) + { + printf("waiter_main: ERROR sigaction failed, status=%d\n" , status); + } + +#ifndef SDCC + printf("waiter_main: oact.sigaction=%p oact.sa_flags=%x oact.sa_mask=%x\n", + oact.sa_sigaction, oact.sa_flags, oact.sa_mask); +#endif + + /* Take the semaphore */ + + printf("waiter_main: Waiting on semaphore\n" ); + FFLUSH(); + + status = sem_wait(&sem); + if (status != 0) + { + int error = errno; + if (error == EINTR) + { + printf("waiter_main: sem_wait() successfully interrupted by signal\n" ); + } + else + { + printf("waiter_main: ERROR sem_wait failed, errno=%d\n" , error); + } + } + else + { + printf("waiter_main: ERROR awakened with no error!\n" ); + } + + /* Detach the signal handler */ + + act.sa_sigaction = SIG_DFL; + status = sigaction(WAKEUP_SIGNAL, &act, &oact); + + printf("waiter_main: done\n" ); + FFLUSH(); + + threadexited = true; + return 0; +} + +void sighand_test(void) +{ + struct sched_param param; + union sigval sigvalue; + pid_t waiterpid; + int policy; + int status; + + printf("sighand_test: Initializing semaphore to 0\n" ); + sem_init(&sem, 0, 0); + + /* Start waiter thread */ + + printf("sighand_test: Starting waiter task\n" ); + status = sched_getparam (0, ¶m); + if (status != OK) + { + printf("sighand_test: ERROR sched_getparam() failed\n" ); + param.sched_priority = PTHREAD_DEFAULT_PRIORITY; + } + + policy = sched_getscheduler(0); + if (policy == ERROR) + { + printf("sighand_test: ERROR sched_getscheduler() failed\n" ); + policy = SCHED_FIFO; + } + + waiterpid = task_create("waiter", param.sched_priority, + PTHREAD_STACK_DEFAULT, waiter_main, NULL); + if (waiterpid == ERROR) + { + printf("sighand_test: ERROR failed to start waiter_main\n" ); + } + else + { + printf("sighand_test: Started waiter_main pid=%d\n", waiterpid); + } + + /* Wait a bit */ + + FFLUSH(); + sleep(2); + + /* Then signal the waiter thread. */ + + printf("sighand_test: Signaling pid=%d with signo=%d sigvalue=%d\n", + waiterpid, WAKEUP_SIGNAL, SIGVALUE_INT); + + sigvalue.sival_int = SIGVALUE_INT; +#ifdef CONFIG_CAN_PASS_STRUCTS + status = sigqueue(waiterpid, WAKEUP_SIGNAL, sigvalue); +#else + status = sigqueue(waiterpid, WAKEUP_SIGNAL, sigvalue.sival_ptr); +#endif + if (status != OK) + { + printf("sighand_test: ERROR sigqueue failed\n" ); + task_delete(waiterpid); + } + + /* Wait a bit */ + + FFLUSH(); + sleep(2); + + /* Then check the result */ + + if (!threadexited) + { + printf("sighand_test: ERROR waiter task did not exit\n" ); + } + + if (!sigreceived) + { + printf("sighand_test: ERROR signal handler did not run\n" ); + } + + printf("sighand_test: done\n" ); + FFLUSH(); +} diff --git a/apps/examples/ostest/timedmqueue.c b/apps/examples/ostest/timedmqueue.c new file mode 100644 index 0000000000..807d8537bf --- /dev/null +++ b/apps/examples/ostest/timedmqueue.c @@ -0,0 +1,387 @@ +/************************************************************************** + * apps/examples/ostest/mqueue.c + * + * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + **************************************************************************/ + +/************************************************************************** + * Included Files + **************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ostest.h" + +/************************************************************************** + * Private Definitions + **************************************************************************/ + +#define TEST_MESSAGE "This is a test and only a test" +#if defined(SDCC) || defined(__ZILOG__) + /* Cannot use strlen in array size */ + +# define TEST_MSGLEN (31) +#else + /* Message lenght is the size of the message plus the null terminator */ + +# define TEST_MSGLEN (strlen(TEST_MESSAGE)+1) +#endif + +#define TEST_SEND_NMSGS (10) +#define TEST_RECEIVE_NMSGS (10) + +/************************************************************************** + * Private Types + **************************************************************************/ + +/************************************************************************** + * Private Function Prototypes + **************************************************************************/ + +/************************************************************************** + * Global Variables + **************************************************************************/ + +/************************************************************************** + * Private Variables + **************************************************************************/ + +/************************************************************************** + * Private Functions + **************************************************************************/ + +/************************************************************************** + * Public Functions + **************************************************************************/ + +static void *sender_thread(void *arg) +{ + mqd_t mqfd; + char msg_buffer[TEST_MSGLEN]; + struct mq_attr attr; + int status = 0; + int nerrors = 0; + int i; + + printf("sender_thread: Starting\n"); + + /* Fill in attributes for message queue */ + + attr.mq_maxmsg = TEST_SEND_NMSGS-1; + attr.mq_msgsize = TEST_MSGLEN; + attr.mq_flags = 0; + + /* Set the flags for the open of the queue. + * Make it a blocking open on the queue, meaning it will block if + * this process tries to send to the queue and the queue is full. + * + * O_CREAT - the queue will get created if it does not already exist. + * O_WRONLY - we are only planning to write to the queue. + * + * Open the queue, and create it if the receiving process hasn't + * already created it. + */ + + mqfd = mq_open("testmq", O_WRONLY|O_CREAT, 0666, &attr); + if (mqfd < 0) + { + printf("sender_thread: ERROR mq_open failed\n"); + pthread_exit((pthread_addr_t)1); + } + + /* Fill in a test message buffer to send */ + + memcpy(msg_buffer, TEST_MESSAGE, TEST_MSGLEN); + + /* Perform the send TEST_SEND_NMSGS times */ + + for (i = 0; i < TEST_SEND_NMSGS; i++) + { + struct timespec ts; + status = clock_gettime(CLOCK_REALTIME, &ts); + if (status != 0) + { + printf("sender_thread: ERROR clock_gettime failed\n"); + } + ts.tv_sec += 5; + + /* The first TEST_SEND_NMSGS-1 send should succeed. The last + * one should fail with errno == ETIMEDOUT + */ + + status = mq_timedsend(mqfd, msg_buffer, TEST_MSGLEN, 42, &ts); + if (status < 0) + { + if (i == TEST_SEND_NMSGS-1 && errno == ETIMEDOUT) + { + printf("sender_thread: mq_timedsend %d timed out as expected\n", i); + } + else + { + printf("sender_thread: ERROR mq_timedsend failure=%d on msg %d\n", errno, i); + nerrors++; + } + } + else + { + if (i == TEST_SEND_NMSGS-1) + { + printf("sender_thread: ERROR mq_timedsend of msg %d succeeded\n", i); + nerrors++; + } + else + { + printf("sender_thread: mq_timedsend succeeded on msg %d\n", i); + } + } + } + + /* Close the queue and return success */ + + if (mq_close(mqfd) < 0) + { + printf("sender_thread: ERROR mq_close failed\n"); + } + + printf("sender_thread: returning nerrors=%d\n", nerrors); + FFLUSH(); + return (pthread_addr_t)nerrors; +} + +static void *receiver_thread(void *arg) +{ + mqd_t mqfd; + char msg_buffer[TEST_MSGLEN]; + struct mq_attr attr; + int nbytes; + int nerrors = 0; + int i; + + printf("receiver_thread: Starting\n"); + + /* Fill in attributes for message queue */ + + attr.mq_maxmsg = TEST_SEND_NMSGS-1; + attr.mq_msgsize = TEST_MSGLEN; + attr.mq_flags = 0; + + /* Set the flags for the open of the queue. + * Make it a blocking open on the queue, meaning it will block if + * this process tries to* send to the queue and the queue is full. + * + * O_CREAT - the queue will get created if it does not already exist. + * O_RDONLY - we are only planning to write to the queue. + * + * Open the queue, and create it if the sending process hasn't + * already created it. + */ + + mqfd = mq_open("testmq", O_RDONLY|O_CREAT, 0666, &attr); + if (mqfd < 0) + { + printf("receiver_thread: ERROR mq_open failed\n"); + pthread_exit((pthread_addr_t)1); + } + + /* Perform the receive TEST_RECEIVE_NMSGS times */ + + for (i = 0; i < TEST_RECEIVE_NMSGS; i++) + { + struct timespec ts; + int status = clock_gettime(CLOCK_REALTIME, &ts); + if (status != 0) + { + printf("sender_thread: ERROR clock_gettime failed\n"); + } + ts.tv_sec += 5; + + /* The first TEST_SEND_NMSGS-1 send should succeed. The last + * one should fail with errno == ETIMEDOUT + */ + + memset(msg_buffer, 0xaa, TEST_MSGLEN); + nbytes = mq_timedreceive(mqfd, msg_buffer, TEST_MSGLEN, 0, &ts); + if (nbytes < 0) + { + if (i == TEST_SEND_NMSGS-1 && errno == ETIMEDOUT) + { + printf("receiver_thread: Receive %d timed out as expected\n", i); + } + else + { + printf("receiver_thread: ERROR mq_timedreceive failure=%d on msg %d\n", errno, i); + nerrors++; + } + } + else if (nbytes != TEST_MSGLEN) + { + printf("receiver_thread: mq_timedreceive return bad size %d on msg %d\n", nbytes, i); + nerrors++; + } + else if (memcmp(TEST_MESSAGE, msg_buffer, nbytes) != 0) + { + int j; + + printf("receiver_thread: mq_timedreceive returned corrupt message on msg %d\n", i); + printf("receiver_thread: i Expected Received\n"); + + for (j = 0; j < TEST_MSGLEN-1; j++) + { + if (isprint(msg_buffer[j])) + { + printf("receiver_thread: %2d %02x (%c) %02x (%c)\n", + j, TEST_MESSAGE[j], TEST_MESSAGE[j], msg_buffer[j], msg_buffer[j]); + } + else + { + printf("receiver_thread: %2d %02x (%c) %02x\n", + j, TEST_MESSAGE[j], TEST_MESSAGE[j], msg_buffer[j]); + } + } + printf("receiver_thread: %2d 00 %02x\n", + j, msg_buffer[j]); + } + else if (i == TEST_SEND_NMSGS-1) + { + printf("receiver_thread: ERROR mq_timedreceive of msg %d succeeded\n", i); + nerrors++; + } + else + { + printf("receiver_thread: mq_timedreceive succeeded on msg %d\n", i); + } + } + + /* Close the queue and return success */ + + if (mq_close(mqfd) < 0) + { + printf("receiver_thread: ERROR mq_close failed\n"); + nerrors++; + } + + /* Destroy the queue */ + + if (mq_unlink("testmq") < 0) + { + printf("receiver_thread: ERROR mq_close failed\n"); + nerrors++; + } + + printf("receiver_thread: returning nerrors=%d\n", nerrors); + FFLUSH(); + pthread_exit((pthread_addr_t)nerrors); + return (pthread_addr_t)nerrors; +} + +void timedmqueue_test(void) +{ + pthread_t sender; + pthread_t receiver; + void *result; + pthread_attr_t attr; + int status; + + /* Start the sending thread at the default priority */ + + printf("timedmqueue_test: Starting sender\n"); + status = pthread_attr_init(&attr); + if (status != 0) + { + printf("timedmqueue_test: pthread_attr_init failed, status=%d\n", status); + } + + status = pthread_attr_setstacksize(&attr, STACKSIZE); + if (status != 0) + { + printf("timedmqueue_test: pthread_attr_setstacksize failed, status=%d\n", status); + } + + status = pthread_create(&sender, &attr, sender_thread, NULL); + if (status != 0) + { + printf("timedmqueue_test: pthread_create failed, status=%d\n", status); + } + + /* Wait for the sending thread to complete */ + + printf("timedmqueue_test: Waiting for sender to complete\n"); + pthread_join(sender, &result); + if (result != (void*)0) + { + printf("timedmqueue_test: ERROR sender thread exited with %d errors\n", (int)result); + } + + /* Start the receiving thread at the default priority */ + + printf("timedmqueue_test: Starting receiver\n"); + status = pthread_attr_init(&attr); + if (status != 0) + { + printf("timedmqueue_test: pthread_attr_init failed, status=%d\n", status); + } + + status = pthread_attr_setstacksize(&attr, STACKSIZE); + if (status != 0) + { + printf("timedmqueue_test: pthread_attr_setstacksize failed, status=%d\n", status); + } + + status = pthread_create(&receiver, &attr, receiver_thread, NULL); + if (status != 0) + { + printf("timedmqueue_test: pthread_create failed, status=%d\n", status); + } + + /* Wait for the receiving thread to complete */ + + printf("timedmqueue_test: Waiting for receiver to complete\n"); + pthread_join(receiver, &result); + if (result != (void*)0) + { + printf("timedmqueue_test: ERROR receiver thread exited with %d errors\n", (int)result); + } + + printf("timedmqueue_test: Test complete\n"); +} + + diff --git a/apps/examples/ostest/timedwait.c b/apps/examples/ostest/timedwait.c new file mode 100644 index 0000000000..fc381ddda4 --- /dev/null +++ b/apps/examples/ostest/timedwait.c @@ -0,0 +1,195 @@ +/*********************************************************************** + * examples/ostest/timedwait.c + * + * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ***********************************************************************/ + +/************************************************************************** + * Included Files + **************************************************************************/ + +#include +#include +#include +#include +#include + +#include "ostest.h" + +/************************************************************************** + * Private Definitions + **************************************************************************/ + +/************************************************************************** + * Private Data + **************************************************************************/ + +static pthread_mutex_t mutex; +static pthread_cond_t cond; + +/************************************************************************** + * Private Functions + **************************************************************************/ + +static void *thread_waiter(void *parameter) +{ + struct timespec ts; + int status; + + /* Take the mutex */ + + printf("thread_waiter: Taking mutex\n"); + status = pthread_mutex_lock(&mutex); + if (status != 0) + { + printf("thread_waiter: ERROR pthread_mutex_lock failed, status=%d\n", status); + } + + printf("thread_waiter: Starting 5 second wait for condition\n"); + + status = clock_gettime(CLOCK_REALTIME, &ts); + if (status != 0) + { + printf("thread_waiter: ERROR clock_gettime failed\n"); + } + ts.tv_sec += 5; + + /* The wait -- no-one is ever going to awaken us */ + + status = pthread_cond_timedwait(&cond, &mutex, &ts); + if (status != 0) + { + if (status == ETIMEDOUT) + { + printf("thread_waiter: pthread_cond_timedwait timed out\n"); + } + else + { + printf("thread_waiter: ERROR pthread_cond_timedwait failed, status=%d\n", status); + } + } + else + { + printf("thread_waiter: ERROR pthread_cond_timedwait returned without timeout, status=%d\n", status); + } + + /* Release the mutex */ + + printf("thread_waiter: Releasing mutex\n"); + status = pthread_mutex_unlock(&mutex); + if (status != 0) + { + printf("thread_waiter: ERROR pthread_mutex_unlock failed, status=%d\n", status); + } + + printf("thread_waiter: Exit with status 0x12345678\n"); + pthread_exit((pthread_addr_t)0x12345678); + return NULL; +} + +/************************************************************************** + * Public Definitions + **************************************************************************/ + +void timedwait_test(void) +{ + pthread_t waiter; + pthread_attr_t attr; + struct sched_param sparam; + void *result; + int prio_max; + int status; + + /* Initialize the mutex */ + + printf("thread_waiter: Initializing mutex\n"); + status = pthread_mutex_init(&mutex, NULL); + if (status != 0) + { + printf("timedwait_test: ERROR pthread_mutex_init failed, status=%d\n", status); + } + + /* Initialize the condition variable */ + + printf("timedwait_test: Initializing cond\n"); + status = pthread_cond_init(&cond, NULL); + if (status != 0) + { + printf("timedwait_test: ERROR pthread_condinit failed, status=%d\n", status); + } + + /* Start the waiter thread at higher priority */ + + printf("timedwait_test: Starting waiter\n"); + status = pthread_attr_init(&attr); + if (status != 0) + { + printf("timedwait_test: pthread_attr_init failed, status=%d\n", status); + } + + prio_max = sched_get_priority_max(SCHED_FIFO); + status = sched_getparam (getpid(), &sparam); + if (status != 0) + { + printf("timedwait_test: sched_getparam failed\n"); + sparam.sched_priority = PTHREAD_DEFAULT_PRIORITY; + } + + sparam.sched_priority = (prio_max + sparam.sched_priority) / 2; + status = pthread_attr_setschedparam(&attr,&sparam); + if (status != OK) + { + printf("timedwait_test: pthread_attr_setschedparam failed, status=%d\n", status); + } + else + { + printf("timedwait_test: Set thread 2 priority to %d\n", sparam.sched_priority); + } + + status = pthread_create(&waiter, &attr, thread_waiter, NULL); + if (status != 0) + { + printf("timedwait_test: pthread_create failed, status=%d\n", status); + } + + printf("timedwait_test: Joining\n"); + FFLUSH(); + status = pthread_join(waiter, &result); + if (status != 0) + { + printf("timedwait_test: ERROR pthread_join failed, status=%d\n", status); + } + else + { + printf("timedwait_test: waiter exited with result=%p\n", result); + } +} diff --git a/apps/examples/pashello/Makefile b/apps/examples/pashello/Makefile new file mode 100644 index 0000000000..44830eee21 --- /dev/null +++ b/apps/examples/pashello/Makefile @@ -0,0 +1,93 @@ +############################################################################ +# apps/examples/pashello/Makefile +# +# Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# Pascal Add-On Example + +ASRCS = +CSRCS = pashello.c device.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/pashello/README.txt b/apps/examples/pashello/README.txt new file mode 100644 index 0000000000..b976f18cf3 --- /dev/null +++ b/apps/examples/pashello/README.txt @@ -0,0 +1,34 @@ +README +^^^^^^ + +hello.pas + + This is a sample "Hello, World!" Pascal Program + +hello.pex + + This is the compiled, linked P-Code executable that results + when hello.pas is compiled. + +hello.h + + This file defines an initialized C array holds a copy of + hello.pex. This file as created by: + + xxd -i hello.pex >hello.h + +mkhello.sh + + This is a scripts that can be used to rebuild both hello.pex + and hello.h. + +device.c + + The hello.pex file must be provided to the interpreter as a file + in the file system. Normally this would be done using real storage + medium. In this example, we will use device.c: + + device.c implements a simple device driver. Reads from this device + will access the in-memory copy of hello.pex This device driver is + registered as /dev/pashello in the psuedo filesystem. + diff --git a/apps/examples/pashello/device.c b/apps/examples/pashello/device.c new file mode 100644 index 0000000000..5f0038ad71 --- /dev/null +++ b/apps/examples/pashello/device.c @@ -0,0 +1,110 @@ +/**************************************************************************** + * examples/pashello/device.c + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Compilation Switches + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include "hello.h" +#include "pashello.h" + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static ssize_t hello_read(struct file *, char *, size_t); + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const struct file_operations hello_fops = +{ + 0, /* open */ + 0, /* close */ + hello_read, /* read */ + 0, /* write */ + 0, /* seek */ + 0, /* ioctl */ +#ifndef CONFIG_DISABLE_POLL + 0 /* poll */ +#endif +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static ssize_t hello_read(struct file *filep, char *buffer, size_t len) +{ + off_t offset = filep->f_pos; /* Start read position */ + ssize_t nread = 0; /* Bytes read -- assume EOF */ + + /* Make sure that the offset is within the .pex file */ + + if (offset < hello_pex_len) + { + /* Make sure the read does not extend beyond the .pex file */ + + nread = len; + if (nread + offset > hello_pex_len) + { + nread = hello_pex_len - offset; + } + memcpy(buffer, &hello_pex[offset], nread); + filep->f_pos += nread; + } + return nread; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void hello_register(void) +{ + (void)register_driver("/dev/hello", &hello_fops, 0444, NULL); +} diff --git a/apps/examples/pashello/hello.h b/apps/examples/pashello/hello.h new file mode 100644 index 0000000000..818e5e4a54 --- /dev/null +++ b/apps/examples/pashello/hello.h @@ -0,0 +1,23 @@ +unsigned char hello_pex[] = { + 0x50, 0x4f, 0x46, 0x46, 0x01, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x05, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, + 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x11, 0x01, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, + 0x00, 0x00, 0x00, 0x0f, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x04, + 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, + 0x00, 0x00, 0x00, 0x38, 0xb1, 0x00, 0x00, 0x74, 0x0e, 0xf9, 0x00, 0x00, + 0x25, 0xb5, 0xff, 0xfc, 0xf9, 0x00, 0x00, 0x20, 0x3f, 0x48, 0x65, 0x6c, + 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21, 0x21, 0x21, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4c, + 0x4c, 0x4f, 0x00, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x70, 0x61, 0x73, + 0x00, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x00, 0x2e, 0x72, 0x6f, 0x64, 0x61, + 0x74, 0x61, 0x00, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x74, 0x61, 0x62, 0x00, + 0x2e, 0x6c, 0x69, 0x6e, 0x65, 0x6e, 0x6f, 0x00, 0x2e, 0x73, 0x74, 0x72, + 0x74, 0x61, 0x62, 0x00 +}; +unsigned int hello_pex_len = 232; diff --git a/apps/examples/pashello/hello.pas b/apps/examples/pashello/hello.pas new file mode 100644 index 0000000000..fe137f1b67 --- /dev/null +++ b/apps/examples/pashello/hello.pas @@ -0,0 +1,5 @@ +program hello(output); +begin + writeln('Hello world!!!'); +end. + diff --git a/apps/examples/pashello/hello.pex b/apps/examples/pashello/hello.pex new file mode 100644 index 0000000000000000000000000000000000000000..c2361059840240b8f6b25a71c4988fee16b58021 GIT binary patch literal 232 zcmWIWcXMN8WME(rVPFN4AQlKnFtUMZK`_a{Py?g|8JWR6ai~}?kmd(!Vgb_fP_a2c zngytp14wH?#TEc*0f<%x1E|;rAZ@XcfuV%&Cj*1(*8hKil!CoSYEDkRLV12sPKu(U zA_F^65mX=85&@8A4_6-_e})W@O1*-_Vg|jE)QS=Yy`ub-#F9h?y|m1n)RM#`2EClj PywtpW2EF2vA`l+{p$8(T literal 0 HcmV?d00001 diff --git a/apps/examples/pashello/mkhello.sh b/apps/examples/pashello/mkhello.sh new file mode 100755 index 0000000000..716a7e96df --- /dev/null +++ b/apps/examples/pashello/mkhello.sh @@ -0,0 +1,141 @@ +#!/bin/bash +############################################################################ +# examples/pashello/mkhello.sh +# +# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +#set -x + +BINDIR=$1 +WD=`pwd` + +PASCAL=${BINDIR}/pascal +POPT=${BINDIR}/popt +PLINK=${BINDIR}/plink +PRUN=${BINDIR}/prun + +PASFILENAME=hello.pas +OUFILE=hello.h +STRSTKSZ=1024 + +function sanity_check () +{ + if [ ! -f "${WD}/${PASFILENAME}" ]; then + echo "ERROR: Source ${PASFILENAME} does not exist in this directory" + exit 1 + fi + if [ -z "${BINDIR}" ]; then + echo "ERROR: Path to the pascal bin/ directory not provided" + exit 1 + fi + if [ ! -d "${BINDIR}" ]; then + echo "ERROR: Tool ${BINDIR} does not exist" + exit 1 + fi + if [ ! -x "${PASCAL}" ]; then + echo "ERROR: Executable ${PASCAL} does not exist" + exit 1 + fi + if [ ! -x "${POPT}" ]; then + echo "ERROR: Executable ${POPT} does not exist" + exit 1 + fi + if [ ! -x "${PLINK}" ]; then + echo "ERROR: Executable ${PLINK} does not exist" + exit 1 + fi + if [ ! -x "${PRUN}" ]; then + echo "ERROR: Executable ${PRUN} does not exist" + exit 1 + fi +} + +function compile_hello () +{ + PASOPTS= + ${PASCAL} ${PASOPTS} ${PASFILENAME} 2>&1 || rm -f hello.o1 + if [ -f hello.err ] ; then + cat hello.err | grep Line + fi + if [ ! -f hello.o1 ] ; then + echo "Compilation failed" + else + POPTOPTS= + ${POPT} ${POPTOPTS} hello.o1 2>&1 + ${PLINK} hello.o hello.pex 2>&1 + fi +} + +function test_program () +{ + if [ "${CONFIG_REGM}" == "y" ]; then + echo "Don't know how to run REGM programs yet" + else + echo "Using string stack size = ${STRSTKSZ}" + PRUNOPTS="-t ${STRSTKSZ}" + + if [ ! -f hello.pex ]; then + echo "No p-code executable" + else + if [ -f hello.inp ] ; then + ${PRUN} ${PRUNOPTS} hello.pex 2>&1 &1 + fi + fi + fi +} + +function test_hello () +{ + echo "Using string stack size = ${STRSTKSZ}" + PRUNOPTS="-t ${STRSTKSZ}" + + if [ ! -f hello.pex ]; then + echo "No p-code executable" + exit 1 + else + ${PRUN} ${PRUNOPTS} hello.pex + fi +} + +function make_include () +{ + xxd -i hello.pex >hello.h +} + +sanity_check +compile_hello +rm *.o *.o1 *.lst *.err +test_hello +make_include + diff --git a/apps/examples/pashello/pashello.c b/apps/examples/pashello/pashello.c new file mode 100644 index 0000000000..ae19c94f55 --- /dev/null +++ b/apps/examples/pashello/pashello.c @@ -0,0 +1,133 @@ +/**************************************************************************** + * examples/pashello/pashello.c + * + * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include "apps/pcode/insn/pexec.h" +#include "apps/pcode/pedefs.h" +#include "pashello.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#ifndef CONFIG_PASHELLO_VARSTACKSIZE +# define CONFIG_PASHELLO_VARSTACKSIZE 1024 +#endif + +#ifndef CONFIG_PASHELLO_STRSTACKSIZE +# define CONFIG_PASHELLO_STRSTACKSIZE 128 +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: prun + * + * Description: + * This function executes the P-Code program until a stopping condition + * is encountered. + * + ****************************************************************************/ + +static void prun(FAR struct pexec_s *st) +{ + int errcode; + + for (;;) + { + /* Execute the instruction; Check for exceptional conditions */ + + errcode = pexec(st); + if (errcode != eNOERROR) break; + } + + if (errcode != eEXIT) + { + printf("Runtime error 0x%02x -- Execution Stopped\n", errcode); + } +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * user_start + ****************************************************************************/ + +int user_start(int argc, FAR char *argv[]) +{ + FAR struct pexec_s *st; + + /* Register the /dev/hello driver */ + + hello_register(); + + /* Load the POFF file */ + + st = pload("/dev/hello", CONFIG_PASHELLO_VARSTACKSIZE, CONFIG_PASHELLO_STRSTACKSIZE); + if (!st) + { + fprintf(stderr, "user_start: ERROR: Could not load /dev/hello\n"); + exit(1); + } + printf("user_start: /dev/hello Loaded\n"); + printf("user_start: Interpreter started:\n"); + + /* And start program execution */ + + prun(st); + + /* Clean up resources used by the interpreter */ + + printf("user_start: Interpreter terminated"); + pexec_release(st); + return 0; +} diff --git a/apps/examples/pashello/pashello.h b/apps/examples/pashello/pashello.h new file mode 100644 index 0000000000..ad206261e2 --- /dev/null +++ b/apps/examples/pashello/pashello.h @@ -0,0 +1,55 @@ +/**************************************************************************** + * examples/pashello/pashello.h + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __EXAMPLES_PASHELLO_H +#define __EXAMPLES_PASHELLO_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/* Defined in device.c */ + +extern void hello_register(void); + +#endif /* __EXAMPLES_PASHELLO_H */ diff --git a/apps/examples/pipe/Makefile b/apps/examples/pipe/Makefile new file mode 100644 index 0000000000..3bcc9b5f78 --- /dev/null +++ b/apps/examples/pipe/Makefile @@ -0,0 +1,93 @@ +############################################################################ +# apps/examples/pipe/Makefile +# +# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# Pipe Example + +ASRCS = +CSRCS = pipe_main.c transfer_test.c interlock_test.c redirect_test.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/pipe/interlock_test.c b/apps/examples/pipe/interlock_test.c new file mode 100644 index 0000000000..e049a65f60 --- /dev/null +++ b/apps/examples/pipe/interlock_test.c @@ -0,0 +1,224 @@ +/**************************************************************************** + * examples/pipe/interlock_test.c + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +#include + +#include +#include +#include +#include + +#include "pipe.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: null_writer + ****************************************************************************/ + +static void *null_writer(pthread_addr_t pvarg) +{ + int fd; + + /* Wait a bit */ + + printf("null_writer: started -- sleeping\n"); + sleep(5); + + /* Then open the FIFO for write access */ + + printf("null_writer: Opening FIFO for write access\n"); + fd = open(FIFO_PATH2, O_WRONLY); + if (fd < 0) + { + fprintf(stderr, "null_writer: Failed to open FIFO %s for writing, errno=%d\n", + FIFO_PATH2, errno); + return (void*)1; + } + + /* Wait a bit more */ + + printf("null_writer: Opened %s for writing -- sleeping\n", FIFO_PATH2); + sleep(5); + + /* Then close the FIFO */ + + printf("null_writer: Closing %s\n", FIFO_PATH2); + if (close(fd) != 0) + { + fprintf(stderr, "null_writer: close failed: %d\n", errno); + } + sleep(5); + + printf("null_writer: Returning success\n"); + return (void*)0; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: interlock_test + ****************************************************************************/ + +int interlock_test(void) +{ + pthread_t writerid; + void *value; + char data[16]; + ssize_t nbytes; + int fd; + int ret; + + /* Create a FIFO */ + + ret = mkfifo(FIFO_PATH2, 0666); + if (ret < 0) + { + fprintf(stderr, "interlock_test: mkfifo failed with errno=%d\n", errno); + return 1; + } + + /* Start the null_writer_thread */ + + printf("interlock_test: Starting null_writer thread\n"); + ret = pthread_create(&writerid, NULL, null_writer, (pthread_addr_t)NULL); + if (ret != 0) + { + fprintf(stderr, "interlock_test: Failed to create null_writer thread, error=%d\n", ret); + ret = 2; + goto errout_with_fifo; + } + + /* Open one end of the FIFO for reading. This open call should block until the + * null_writer thread opens the other end of the FIFO for writing. + */ + + printf("interlock_test: Opening FIFO for read access\n"); + fd = open(FIFO_PATH2, O_RDONLY); + if (fd < 0) + { + fprintf(stderr, "interlock_test: Failed to open FIFO %s for reading, errno=%d\n", + FIFO_PATH2, errno); + ret = 3; + goto errout_with_thread; + } + + /* Attempt to read one byte from the FIFO. This should return end-of-file because + * the null_writer closes the FIFO without writing anything. + */ + + printf("interlock_test: Reading from %s\n", FIFO_PATH2); + nbytes = read(fd, data, 16); + if (nbytes < 0 ) + { + fprintf(stderr, "interlock_test: read failed, errno=%d\n", errno); + ret = 4; + goto errout_with_file; + } + else if (ret != 0) + { + fprintf(stderr, "interlock_test: Read %d bytes of data -- aborting: %d\n", nbytes); + ret = 5; + goto errout_with_file; + } + + /* Close the file */ + + printf("interlock_test: Closing %s\n", FIFO_PATH2); + if (close(fd) != 0) + { + fprintf(stderr, "interlock_test: close failed: %d\n", errno); + } + + /* Wait for null_writer thread to complete */ + + printf("interlock_test: Waiting for null_writer thread\n"); + ret = pthread_join(writerid, &value); + if (ret != 0) + { + fprintf(stderr, "interlock_test: pthread_join failed, error=%d\n", ret); + ret = 6; + goto errout_with_fifo; + } + else + { + printf("interlock_test: writer returned %d\n", (int)value); + if (value != (void*)0) + { + ret = 7; + goto errout_with_fifo; + } + } + + /* unlink(FIFO_PATH2); */ + printf("interlock_test: Returning success\n"); + return 0; + +errout_with_file: + if (close(fd) != 0) + { + fprintf(stderr, "interlock_test: close failed: %d\n", errno); + } +errout_with_thread: + pthread_detach(writerid); + pthread_cancel(writerid); +errout_with_fifo: + /* unlink(FIFO_PATH2); */ + printf("interlock_test: Returning %d\n", ret); + return ret; +} diff --git a/apps/examples/pipe/pipe.h b/apps/examples/pipe/pipe.h new file mode 100644 index 0000000000..2c18fd868b --- /dev/null +++ b/apps/examples/pipe/pipe.h @@ -0,0 +1,74 @@ +/**************************************************************************** + * examples/pipe/pipe.h + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __EXAMPLES_PIPE_PIPE_H +#define __EXAMPLES_PIPE_PIPE_H + +/**************************************************************************** + * Compilation Switches + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#define FIFO_PATH1 "/tmp/testfifo-1" +#define FIFO_PATH2 "/tmp/testfifo-2" + +#ifndef CONFIG_EXAMPLES_PIPE_STACKSIZE +# define CONFIG_EXAMPLES_PIPE_STACKSIZE 1024 +#endif + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +extern int transfer_test(int fdin, int fdout); +extern int interlock_test(void); +extern int redirection_test(void); + +#endif /* __EXAMPLES_PIPE_PIPE_H */ diff --git a/apps/examples/pipe/pipe_main.c b/apps/examples/pipe/pipe_main.c new file mode 100644 index 0000000000..1f0f73032a --- /dev/null +++ b/apps/examples/pipe/pipe_main.c @@ -0,0 +1,189 @@ +/**************************************************************************** + * examples/pipe/pipe_main.c + * + * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include + +#include "pipe.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + int filedes[2]; + int ret; + + /* Test FIFO logic */ + + printf("\nuser_start: Performing FIFO test\n"); + ret = mkfifo(FIFO_PATH1, 0666); + if (ret < 0) + { + fprintf(stderr, "user_start: mkfifo failed with errno=%d\n", errno); + return 1; + } + + /* Open one end of the FIFO for reading and the other end for writing. NOTE: + * the following might not work on most FIFO implementations because the attempt + * to open just one end of the FIFO for writing might block. The NuttX FIFOs block + * only on open for read-only (see interlock_test()). + */ + + filedes[1] = open(FIFO_PATH1, O_WRONLY); + if (filedes[1] < 0) + { + fprintf(stderr, "user_start: Failed to open FIFO %s for writing, errno=%d\n", + FIFO_PATH1, errno); + return 2; + } + + filedes[0] = open(FIFO_PATH1, O_RDONLY); + if (filedes[0] < 0) + { + fprintf(stderr, "user_start: Failed to open FIFO %s for reading, errno=%d\n", + FIFO_PATH1, errno); + if (close(filedes[1]) != 0) + { + fprintf(stderr, "user_start: close failed: %d\n", errno); + } + return 3; + } + + /* Then perform the test using those file descriptors */ + + ret = transfer_test(filedes[0], filedes[1]); + if (close(filedes[0]) != 0) + { + fprintf(stderr, "user_start: close failed: %d\n", errno); + } + if (close(filedes[1]) != 0) + { + fprintf(stderr, "user_start: close failed: %d\n", errno); + } + /* unlink(FIFO_PATH1); fails */ + + if (ret != 0) + { + fprintf(stderr, "user_start: FIFO test FAILED (%d)\n", ret); + return 4; + } + printf("user_start: FIFO test PASSED\n"); + + /* Test PIPE logic */ + + printf("\nuser_start: Performing pipe test\n"); + ret = pipe(filedes); + if (ret < 0) + { + fprintf(stderr, "user_start: pipe failed with errno=%d\n", errno); + return 5; + } + + /* Then perform the test using those file descriptors */ + + ret = transfer_test(filedes[0], filedes[1]); + if (close(filedes[0]) != 0) + { + fprintf(stderr, "user_start: close failed: %d\n", errno); + } + if (close(filedes[1]) != 0) + { + fprintf(stderr, "user_start: close failed: %d\n", errno); + } + + if (ret != 0) + { + fprintf(stderr, "user_start: PIPE test FAILED (%d)\n", ret); + return 6; + } + printf("user_start: PIPE test PASSED\n"); + + /* Perform the FIFO interlock test */ + + printf("\nuser_start: Performing pipe interlock test\n"); + ret = interlock_test(); + if (ret != 0) + { + fprintf(stderr, "user_start: FIFO interlock test FAILED (%d)\n", ret); + return 7; + } + printf("user_start: PIPE interlock test PASSED\n"); + + /* Perform the pipe redirection test */ + + printf("\nuser_start: Performing redirection test\n"); + ret = redirection_test(); + if (ret != 0) + { + fprintf(stderr, "user_start: FIFO redirection test FAILED (%d)\n", ret); + return 7; + } + printf("user_start: PIPE redirection test PASSED\n"); + + fflush(stdout); + return 0; +} diff --git a/apps/examples/pipe/redirect_test.c b/apps/examples/pipe/redirect_test.c new file mode 100644 index 0000000000..45e86c3560 --- /dev/null +++ b/apps/examples/pipe/redirect_test.c @@ -0,0 +1,326 @@ +/**************************************************************************** + * examples/pipe/redirect_test.c + * + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include + +#include "pipe.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#define READ_SIZE 37 + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static sem_t g_rddone; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: redirect_reader + ****************************************************************************/ + +static int redirect_reader(int argc, char *argv[]) +{ + char buffer[READ_SIZE]; + int fdin; + int fdout; + int ret; + int nbytes = 0; + + printf("redirect_reader: started with fdin=%s\n", argv[1]); + + /* Convert the fdin to binary */ + + fdin = atoi(argv[1]); + fdout = atoi(argv[2]); + + /* Close fdout -- we don't need it */ + + ret = close(fdout); + if (ret != 0) + { + fprintf(stderr, "redirect_reader: failed to close fdout=%d\n", fdout); + return 1; + } + + /* Re-direct the fdin to stdin */ + + ret = dup2(fdin, 0); + if (ret != 0) + { + fprintf(stderr, "redirect_reader: dup2 failed: %d\n", errno); + close(fdin); + return 2; + } + + /* Close the original file descriptor */ + + ret = close(fdin); + if (ret != 0) + { + fprintf(stderr, "redirect_reader: failed to close fdin=%d\n", fdin); + return 3; + } + + /* Then read from stdin until we hit the end of file */ + + fflush(stdout); + for (;;) + { + /* Read from stdin */ + + ret = read(0, buffer, READ_SIZE); + if (ret < 0 ) + { + fprintf(stderr, "redirect_reader: read failed, errno=%d\n", errno); + return 4; + } + else if (ret == 0) + { + break; + } + nbytes += ret; + + /* Echo to stdout */ + + ret = write(1, buffer, ret); + if (ret < 0) + { + fprintf(stderr, "redirect_reader: read failed, errno=%d\n", errno); + return 5; + } + } + + printf("redirect_reader: %d bytes read\n", nbytes); + ret = close(0); + if (ret != 0) + { + fprintf(stderr, "redirect_reader: failed to close fd=0\n"); + return 6; + } + + sem_post(&g_rddone); + printf("redirect_reader: Returning success\n"); + return 0; +} + +/**************************************************************************** + * Name: redirect_writer + ****************************************************************************/ + +static int redirect_writer(int argc, char *argv[]) +{ + int fdin; + int fdout; + int nbytes = 0; + int ret; + + fprintf(stderr, "redirect_writer: started with fdout=%s\n", argv[2]); + + /* Convert the fdout to binary */ + + fdin = atoi(argv[1]); + fdout = atoi(argv[2]); + + /* Close fdin -- we don't need it */ + + ret = close(fdin); + if (ret != 0) + { + fprintf(stderr, "redirect_reader: failed to close fdin=%d\n", fdin); + return 1; + } + + /* Re-direct the fdout to stdout */ + + ret = dup2(fdout, 1); + if (ret != 0) + { + fprintf(stderr, "redirect_writer: dup2 failed: %d\n", errno); + return 2; + } + + /* Close the original file descriptor */ + + ret = close(fdout); + if (ret != 0) + { + fprintf(stderr, "redirect_reader: failed to close fdout=%d\n", fdout); + return 3; + } + + /* Then write a bunch of stuff to stdout */ + + fflush(stderr); + nbytes += printf("\nFour score and seven years ago our fathers brought forth on this continent a new nation,\n"); + nbytes += printf("conceived in Liberty, and dedicated to the proposition that all men are created equal.\n"); + nbytes += printf("\nNow we are engaged in a great civil war, testing whether that nation, or any nation, so\n"); + nbytes += printf("conceived and so dedicated, can long endure. We are met on a great battle-field of that war.\n"); + nbytes += printf("We have come to dedicate a portion of that field, as a final resting place for those who here\n"); + nbytes += printf("gave their lives that that nation might live. It is altogether fitting and proper that we\n"); + nbytes += printf("should do this.\n"); + nbytes += printf("\nBut, in a larger sense, we can not dedicate - we can not consecrate - we can not hallow - this ground.\n"); + nbytes += printf("The brave men, living and dead, who struggled here, have consecrated it, far above our poor power\n"); + nbytes += printf("to add or detract. The world will little note, nor long remember what we say here, but it can\n"); + nbytes += printf("never forget what they did here. It is for us the living, rather, to be dedicated here to the\n"); + nbytes += printf("unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to\n"); + nbytes += printf("be here dedicated to the great task remaining before us - that from these honored dead we take\n"); + nbytes += printf("increased devotion to that cause for which they gave the last full measure of devotion - that we\n"); + nbytes += printf("here highly resolve that these dead shall not have died in vain - that this nation, under God,\n"); + nbytes += printf("shall have a new birth of freedom - and that government of the people, by the people, for the\n"); + nbytes += printf("people, shall not perish from the earth.\n\n"); + fflush(stdout); + + fprintf(stderr, "redirect_writer: %d bytes written\n", nbytes); + + ret = close(1); + if (ret != 0) + { + fprintf(stderr, "redirect_writer: failed to close fd=1\n"); + return 4; + } + + fprintf(stderr, "redirect_writer: Returning success\n"); + return 0; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: redirection_test + ****************************************************************************/ + +int redirection_test(void) +{ + const char *argv[3]; + char buffer1[8]; + char buffer2[8]; + int readerid; + int writerid; + int filedes[2]; + int ret; + + sem_init(&g_rddone, 0, 0); + + /* Create the pipe */ + + ret = pipe(filedes); + if (ret < 0) + { + fprintf(stderr, "redirection_test: pipe failed with errno=%d\n", errno); + return 5; + } + + sprintf(buffer1, "%d", filedes[0]); + argv[0] = buffer1; + sprintf(buffer2, "%d", filedes[1]); + argv[1] = buffer2; + argv[2] = NULL; + + /* Start redirect_reader thread */ + + printf("redirection_test: Starting redirect_reader task with fd=%d\n", filedes[0]); + readerid = task_create("redirect_reader", 50, CONFIG_EXAMPLES_PIPE_STACKSIZE, redirect_reader, argv); + if (readerid < 0) + { + fprintf(stderr, "redirection_test: Failed to create redirect_writer task: %d\n", errno); + return 1; + } + + /* Start redirect_writer task */ + + printf("redirection_test: Starting redirect_writer task with fd=%d\n", filedes[1]); + writerid = task_create("redirect_writer", 50, CONFIG_EXAMPLES_PIPE_STACKSIZE, redirect_writer, argv); + if (writerid < 0) + { + fprintf(stderr, "redirection_test: Failed to create redirect_writer task: %d\n", errno); + ret = task_delete(readerid); + if (ret != 0) + { + fprintf(stderr, "redirection_test: Failed to delete redirect_reader task %d\n", errno); + } + return 2; + } + + /* We should be able to close the pipe file descriptors now. */ + + if (close(filedes[0]) != 0) + { + fprintf(stderr, "user_start: close failed: %d\n", errno); + } + if (close(filedes[1]) != 0) + { + fprintf(stderr, "user_start: close failed: %d\n", errno); + } + + if (ret != 0) + { + fprintf(stderr, "user_start: PIPE test FAILED (%d)\n", ret); + return 6; + } + + /* Wait for redirect_writer thread to complete */ + + printf("redirection_test: Waiting...\n"); + fflush(stdout); + sem_wait(&g_rddone); + + printf("redirection_test: returning %d\n", ret); + return ret; +} + diff --git a/apps/examples/pipe/transfer_test.c b/apps/examples/pipe/transfer_test.c new file mode 100644 index 0000000000..cb8cad04a4 --- /dev/null +++ b/apps/examples/pipe/transfer_test.c @@ -0,0 +1,242 @@ +/**************************************************************************** + * examples/pipe/transfer_test.c + * + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include "pipe.h" + +/**************************************************************************** + * Pre-proecessor Definitions + ****************************************************************************/ + +#define MAX_BYTE 13 + +#define WRITE_SIZE MAX_BYTE +#define NWRITES 1400 +#define NWRITE_BYTES (NWRITES * WRITE_SIZE) + +#define READ_SIZE (2*MAX_BYTE) +#define NREADS (NWRITES / 2) +#define NREAD_BYTES NWRITE_BYTES + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: transfer_reader + ****************************************************************************/ + +static void *transfer_reader(pthread_addr_t pvarg) +{ + char buffer[READ_SIZE]; + int fd = (int)pvarg; + int ret; + int nbytes; + int value; + int ndx; + + printf("transfer_reader: started\n"); + for (nbytes = 0, value = 0; nbytes < NREAD_BYTES;) + { + ret = read(fd, buffer, READ_SIZE); + if (ret < 0 ) + { + fprintf(stderr, "transfer_reader: read failed, errno=%d\n", errno); + return (void*)1; + } + else if (ret == 0) + { + if (nbytes < NREAD_BYTES) + { + fprintf(stderr, "transfer_reader: Too few bytes read -- aborting: %d\n", nbytes); + return (void*)2; + } + break; + } + for (ndx = 0; ndx < ret; ndx++) + { + if (value >= WRITE_SIZE) + { + value = 0; + } + if (buffer[ndx] != value) + { + fprintf(stderr, "transfer_reader: Byte %d, expected %d, found %d\n", + nbytes + ndx, value, buffer[ndx]); + return (void*)3; + } + value++; + } + nbytes += ret; + if (nbytes > NREAD_BYTES) + { + fprintf(stderr, "transfer_reader: Too many bytes read -- aborting: %d\n", nbytes); + return (void*)4; + } + } + printf("transfer_reader: %d bytes read\n", nbytes); + return (void*)0; +} + +/**************************************************************************** + * Name: transfer_writer + ****************************************************************************/ + +static void *transfer_writer(pthread_addr_t pvarg) +{ + char buffer[WRITE_SIZE]; + int fd = (int)pvarg; + int ret; + int i; + + printf("transfer_writer: started\n"); + for (i = 0; i < WRITE_SIZE; i++) + { + buffer[i] = i; + } + + for (i = 0; i < NWRITES; i++) + { + ret = write(fd, buffer, WRITE_SIZE); + if (ret < 0 ) + { + fprintf(stderr, "transfer_writer: write failed, errno=%d\n", errno); + return (void*)1; + } + else if (ret != WRITE_SIZE) + { + fprintf(stderr, "transfer_writer: Unexpected write size=%d\n", ret); + return (void*)2; + } + } + printf("transfer_writer: %d bytes written\n", NWRITE_BYTES); + return (void*)0; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: transfer_test + ****************************************************************************/ + +int transfer_test(int fdin, int fdout) +{ + pthread_t readerid; + pthread_t writerid; + void *value; + int tmp; + int ret; + + /* Start transfer_reader thread */ + + printf("transfer_test: Starting transfer_reader thread\n"); + ret = pthread_create(&readerid, NULL, transfer_reader, (pthread_addr_t)fdin); + if (ret != 0) + { + fprintf(stderr, "transfer_test: Failed to create transfer_reader thread, error=%d\n", ret); + return 1; + } + + /* Start transfer_writer thread */ + + printf("transfer_test: Starting transfer_writer thread\n"); + ret = pthread_create(&writerid, NULL, transfer_writer, (pthread_addr_t)fdout); + if (ret != 0) + { + fprintf(stderr, "transfer_test: Failed to create transfer_writer thread, error=%d\n", ret); + pthread_detach(readerid); + ret = pthread_cancel(readerid); + if (ret != 0) + { + fprintf(stderr, "transfer_test: Failed to cancel transfer_reader thread, error=%d\n", ret); + } + return 2; + } + + /* Wait for transfer_writer thread to complete */ + + printf("transfer_test: Waiting for transfer_writer thread\n"); + ret = pthread_join(writerid, &value); + if (ret != 0) + { + fprintf(stderr, "transfer_test: pthread_join failed, error=%d\n", ret); + } + else + { + ret = (int)value; + printf("transfer_test: transfer_writer returned %d\n", ret); + } + + /* Wait for transfer_reader thread to complete */ + + printf("transfer_test: Waiting for transfer_reader thread\n"); + tmp = pthread_join(readerid, &value); + if (tmp != 0) + { + fprintf(stderr, "transfer_test: pthread_join failed, error=%d\n", ret); + } + else + { + tmp = (int)value; + printf("transfer_test: transfer_reader returned %d\n", tmp); + } + + if (ret == 0) + { + ret = tmp; + } + printf("transfer_test: returning %d\n", ret); + return ret; +} + diff --git a/apps/examples/poll/Makefile b/apps/examples/poll/Makefile new file mode 100644 index 0000000000..1c85d6f36d --- /dev/null +++ b/apps/examples/poll/Makefile @@ -0,0 +1,94 @@ +############################################################################ +# apps/examples/poll/Makefile +# +# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# Device Driver poll()/select() Example + +ASRCS = +CSRCS = poll_main.c poll_listener.c select_listener.c net_listener.c net_reader.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +# Register application +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend host + +-include Make.dep diff --git a/apps/examples/poll/Makefile.host b/apps/examples/poll/Makefile.host new file mode 100644 index 0000000000..9d9daee27b --- /dev/null +++ b/apps/examples/poll/Makefile.host @@ -0,0 +1,54 @@ +############################################################################ +# apps/examples/poll/Makefile.host +# +# Copyright (C) 2008, 2009, 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# TOPDIR must be defined on the make command line + +include $(TOPDIR)/.config +include $(TOPDIR)/Make.defs + +SRC = host.c +BIN = host + +DEFINES = -DTARGETIP=\"$(TARGETIP)\" + +all: $(BIN) + +$(BIN): $(SRC) + $(HOSTCC) $(HOSTCFLAGS) $(DEFINES) $^ -o $@ + +clean: + @rm -f $(BIN) *~ .*.swp *.o + $(call CLEAN) + diff --git a/apps/examples/poll/host.c b/apps/examples/poll/host.c new file mode 100644 index 0000000000..47f2c3e53e --- /dev/null +++ b/apps/examples/poll/host.c @@ -0,0 +1,166 @@ +/**************************************************************************** + * examples/poll/host.c + * + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define pthread_addr_t void * +#include "poll_internal.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef TARGETIP +# error TARGETIP not defined +#endif + +#define IOBUFFER_SIZE 80 + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * main + ****************************************************************************/ + +int main(int argc, char **argv, char **envp) +{ + struct sockaddr_in myaddr; + char outbuf[IOBUFFER_SIZE]; + char inbuf[IOBUFFER_SIZE]; + int sockfd; + int len; + int nbytessent; + int nbytesrecvd; + int i; + + /* Create a new TCP socket */ + + sockfd = socket(PF_INET, SOCK_STREAM, 0); + if (sockfd < 0) + { + message("client socket failure %d\n", errno); + goto errout_with_outbufs; + } + + /* Connect the socket to the server */ + + myaddr.sin_family = AF_INET; + myaddr.sin_port = htons(LISTENER_PORT); + myaddr.sin_addr.s_addr = inet_addr(TARGETIP); + + message("client: Connecting to %s...\n", TARGETIP); + if (connect( sockfd, (struct sockaddr*)&myaddr, sizeof(struct sockaddr_in)) < 0) + { + message("client: connect failure: %d\n", errno); + goto errout_with_socket; + } + message("client: Connected\n"); + + /* Then send and receive messages */ + + for (i = 0; ; i++) + { + sprintf(outbuf, "Remote message %d", i); + len = strlen(outbuf); + + message("client: Sending '%s' (%d bytes)\n", outbuf, len); + nbytessent = send(sockfd, outbuf, len, 0); + message("client: Sent %d bytes\n", nbytessent); + + if (nbytessent < 0) + { + message("client: send failed: %d\n", errno); + goto errout_with_socket; + } + else if (nbytessent != len) + { + message("client: Bad send length: %d Expected: %d\n", nbytessent, len); + goto errout_with_socket; + } + + message("client: Receiving...\n"); + nbytesrecvd = recv(sockfd, inbuf, IOBUFFER_SIZE, 0); + + if (nbytesrecvd < 0) + { + message("client: recv failed: %d\n", errno); + goto errout_with_socket; + } + + inbuf[nbytesrecvd] = '\0'; + message("client: Received '%s' (%d bytes)\n", inbuf, nbytesrecvd); + + if (nbytesrecvd != len) + { + message("client: Bad recv length: %d Expected: %d\n", nbytesrecvd, len); + goto errout_with_socket; + } + else if (memcmp(inbuf, outbuf, len) != 0) + { + message("client: Received outbuf does not match sent outbuf\n"); + goto errout_with_socket; + } + + message("client: Sleeping\n"); + sleep(8); + } + + close(sockfd); + return 0; + +errout_with_socket: + close(sockfd); +errout_with_outbufs: + exit(1); +} diff --git a/apps/examples/poll/net_listener.c b/apps/examples/poll/net_listener.c new file mode 100644 index 0000000000..4d425c608f --- /dev/null +++ b/apps/examples/poll/net_listener.c @@ -0,0 +1,428 @@ +/**************************************************************************** + * examples/poll/net_listener.c + * + * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "poll_internal.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#define IOBUFFER_SIZE 80 + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct net_listener_s +{ + struct sockaddr_in addr; + fd_set master; + fd_set working; + char buffer[IOBUFFER_SIZE]; + int listensd; + int mxsd; +}; + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: net_closeclient + ****************************************************************************/ + +static bool net_closeclient(struct net_listener_s *nls, int sd) +{ + message("net_listener: Closing host side connection sd=%d\n", sd); + close(sd); + FD_CLR(sd, &nls->master); + + /* If we just closed the max SD, then search downward for the next biggest SD. */ + + while (FD_ISSET(nls->mxsd, &nls->master) == false) + { + nls->mxsd -= 1; + } + return true; +} + +/**************************************************************************** + * Name: net_incomingdata + ****************************************************************************/ + +static inline bool net_incomingdata(struct net_listener_s *nls, int sd) +{ + char *ptr; + int nbytes; + int ret; + + /* Read data from the socket */ + +#ifdef FIONBIO + for (;;) +#endif + { + message("net_listener: Read data from sd=%d\n", sd); + ret = recv(sd, nls->buffer, IOBUFFER_SIZE, 0); + if (ret < 0) + { + if (errno != EINTR) + { + message("net_listener: recv failed sd=%d: %d\n", sd, errno); + if (errno != EAGAIN) + { + net_closeclient(nls, sd); + return false; + } + } + } + else if (ret == 0) + { + message("net_listener: Client connection lost sd=%d\n", sd); + net_closeclient(nls, sd); + return false; + } + else + { + nls->buffer[ret]='\0'; + message("poll_listener: Read '%s' (%d bytes)\n", nls->buffer, ret); + + /* Echo the data back to the client */ + + for (nbytes = ret, ptr = nls->buffer; nbytes > 0; ) + { + ret = send(sd, ptr, nbytes, 0); + if (ret < 0) + { + if (errno != EINTR) + { + message("net_listener: Send failed sd=%d: \n", sd, errno); + net_closeclient(nls, sd); + return false; + } + } + else + { + nbytes -= ret; + ptr += ret; + } + } + } + } + return 0; +} + +/**************************************************************************** + * Name: net_connection + ****************************************************************************/ + +static inline bool net_connection(struct net_listener_s *nls) +{ + int sd; + + /* Loop until all connections have been processed */ + +#ifdef FIONBIO + for (;;) +#endif + { + message("net_listener: Accepting new connection on sd=%d\n", nls->listensd); + + sd = accept(nls->listensd, NULL, NULL); + if (sd < 0) + { + message("net_listener: accept failed: %d\n", errno); + + if (errno != EINTR) + { + return false; + } + } + else + { + /* Add the new connection to the master set */ + + message("net_listener: Connection accepted for sd=%d\n", sd); + + FD_SET(sd, &nls->master); + if (sd > nls->mxsd) + { + nls->mxsd = sd; + } + return true; + } + } + return false; +} + +/**************************************************************************** + * Name: net_mksocket + ****************************************************************************/ + +static inline bool net_mksocket(struct net_listener_s *nls) +{ + int value; + int ret; + + /* Create a listening socket */ + + message("net_listener: Initializing listener socket\n"); + nls->listensd = socket(AF_INET, SOCK_STREAM, 0); + if (nls->listensd < 0) + { + message("net_listener: socket failed: %d\n", errno); + return false; + } + + /* Configure the socket */ + + value = 1; + ret = setsockopt(nls->listensd, SOL_SOCKET, SO_REUSEADDR, (char*)&value, sizeof(int)); + if (ret < 0) + { + message("net_listener: setsockopt failed: %d\n", errno); + close(nls->listensd); + return false; + } + + /* Set the socket to non-blocking */ + +#ifdef FIONBIO + ret = ioctl(nls->listensd, FIONBIO, (char *)&value); + if (ret < 0) + { + message("net_listener: ioctl failed: %d\n", errno); + close(nls->listensd); + return false; + } +#endif + + /* Bind the socket */ + + memset(&nls->addr, 0, sizeof(struct sockaddr_in)); + nls->addr.sin_family = AF_INET; + nls->addr.sin_addr.s_addr = htonl(INADDR_ANY); + nls->addr.sin_port = htons(LISTENER_PORT); + ret = bind(nls->listensd, (struct sockaddr *)&nls->addr, sizeof(struct sockaddr_in)); + if (ret < 0) + { + message("net_listener: bind failed: %d\n", errno); + close(nls->listensd); + return false; + } + + /* Mark the socket as a listener */ + + ret = listen(nls->listensd, 32); + if (ret < 0) + { + message("net_listener: bind failed: %d\n", errno); + close(nls->listensd); + return false; + } + + return true; +} + +/**************************************************************************** + * Name: net_configure + ****************************************************************************/ + +static void net_configure(void) +{ + struct in_addr addr; +#if defined(CONFIG_EXAMPLE_POLL_NOMAC) + uint8_t mac[IFHWADDRLEN]; +#endif + + /* Configure uIP */ + /* Many embedded network interfaces must have a software assigned MAC */ + +#ifdef CONFIG_EXAMPLE_POLL_NOMAC + mac[0] = 0x00; + mac[1] = 0xe0; + mac[2] = 0xb0; + mac[3] = 0x0b; + mac[4] = 0xba; + mac[5] = 0xbe; + uip_setmacaddr("eth0", mac); +#endif + + /* Set up our host address */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_POLL_IPADDR); + uip_sethostaddr("eth0", &addr); + + /* Set up the default router address */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_POLL_DRIPADDR); + uip_setdraddr("eth0", &addr); + + /* Setup the subnet mask */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_POLL_NETMASK); + uip_setnetmask("eth0", &addr); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: net_listener + ****************************************************************************/ + +void *net_listener(pthread_addr_t pvarg) +{ + struct net_listener_s nls; + struct timeval timeout; + int nsds; + int ret; + int i; + + /* Configure uIP */ + + net_configure(); + + /* Set up a listening socket */ + + memset(&nls, 0, sizeof(struct net_listener_s)); + if (!net_mksocket(&nls)) + { + return (void*)1; + } + + /* Initialize the 'master' file descriptor set */ + + FD_ZERO(&nls.master); + nls.mxsd = nls.listensd; + FD_SET(nls.listensd, &nls.master); + + /* Set up a 3 second timeout */ + + timeout.tv_sec = NET_LISTENER_DELAY; + timeout.tv_usec = 0; + + /* Loop waiting for incoming connections or for incoming data + * on any of the connect sockets. + */ + + for (;;) + { + /* Wait on select */ + + message("net_listener: Calling select(), listener sd=%d\n", nls.listensd); + memcpy(&nls.working, &nls.master, sizeof(fd_set)); + ret = select(nls.mxsd + 1, (FAR fd_set*)&nls.working, (FAR fd_set*)NULL, (FAR fd_set*)NULL, &timeout); + if (ret < 0) + { + message("net_listener: select failed: %d\n", errno); + break; + } + + /* Check for timeout */ + + if (ret == 0) + { + message("net_listener: Timeout\n"); + continue; + } + + /* Find which descriptors caused the wakeup */ + + nsds = ret; + for (i = 0; i <= nls.mxsd && nsds > 0; i++) + { + /* Is this descriptor ready? */ + + if (FD_ISSET(i, &nls.working)) + { + /* Yes, is it our listener? */ + + message("net_listener: Activity on sd=%d\n", i); + + nsds--; + if (i == nls.listensd) + { + (void)net_connection(&nls); + } + else + { + net_incomingdata(&nls, i); + } + } + } + } + + /* Cleanup */ + +#if 0 /* Don't get here */ + for (i = 0; i <= nls.mxsd; +i++) + { + if (FD_ISSET(i, &nls.master)) + { + close(i); + } + } +#endif + return NULL; /* Keeps some compilers from complaining */ +} diff --git a/apps/examples/poll/net_reader.c b/apps/examples/poll/net_reader.c new file mode 100644 index 0000000000..b0cf94316b --- /dev/null +++ b/apps/examples/poll/net_reader.c @@ -0,0 +1,317 @@ +/**************************************************************************** + * examples/poll/net_reader.c + * + * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "poll_internal.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#define IOBUFFER_SIZE 80 + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: net_configure + ****************************************************************************/ + +static void net_configure(void) +{ + struct in_addr addr; +#if defined(CONFIG_EXAMPLE_POLL_NOMAC) + uint8_t mac[IFHWADDRLEN]; +#endif + + /* Configure uIP */ + /* Many embedded network interfaces must have a software assigned MAC */ + +#ifdef CONFIG_EXAMPLE_POLL_NOMAC + mac[0] = 0x00; + mac[1] = 0xe0; + mac[2] = 0xb0; + mac[3] = 0x0b; + mac[4] = 0xba; + mac[5] = 0xbe; + uip_setmacaddr("eth0", mac); +#endif + + /* Set up our host address */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_POLL_IPADDR); + uip_sethostaddr("eth0", &addr); + + /* Set up the default router address */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_POLL_DRIPADDR); + uip_setdraddr("eth0", &addr); + + /* Setup the subnet mask */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_POLL_NETMASK); + uip_setnetmask("eth0", &addr); +} + +/**************************************************************************** + * Name: net_receive + ****************************************************************************/ + +static void net_receive(int sd) +{ + struct timeval timeout; + char buffer[IOBUFFER_SIZE]; + char *ptr; + fd_set readset; + int nbytes; + int ret; + + /* Set up the timeout */ + + timeout.tv_sec = NET_LISTENER_DELAY; + timeout.tv_usec = 0; + + /* Loop while we have the connection */ + + for (;;) + { + /* Wait for incoming message */ + + do + { + FD_ZERO(&readset); + FD_SET(sd, &readset); + ret = select(sd + 1, (FAR fd_set*)&readset, (FAR fd_set*)NULL, (FAR fd_set*)NULL, &timeout); + } + while (ret < 0 && errno == EINTR); + + /* Something has happened */ + + if (ret < 0) + { + message("net_reader: select failed: %d\n", errno); + return; + } + else if (ret == 0) + { + message("net_reader: Timeout\n"); + } + else + { + message("net_reader: Read data from sd=%d\n", sd); + memset(buffer, '?', IOBUFFER_SIZE); /* Just to make sure we really receive something */ + ret = recv(sd, buffer, IOBUFFER_SIZE, 0); + if (ret < 0) + { + if (errno != EINTR) + { + message("net_reader: recv failed sd=%d: %d\n", sd, errno); + if (errno != EAGAIN) + { + return; + } + } + } + else if (ret == 0) + { + message("net_reader: Client connection lost sd=%d\n", sd); + return; + } + else + { + buffer[ret]='\0'; + message("net_reader: Read '%s' (%d bytes)\n", buffer, ret); + + /* Echo the data back to the client */ + + for (nbytes = ret, ptr = buffer; nbytes > 0; ) + { + ret = send(sd, ptr, nbytes, 0); + if (ret < 0) + { + if (errno != EINTR) + { + message("net_reader: Send failed sd=%d: %d\n", sd, errno); + return; + } + } + else + { + nbytes -= ret; + ptr += ret; + } + } + } + } + } +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: net_reader + ****************************************************************************/ + +void *net_reader(pthread_addr_t pvarg) +{ + struct sockaddr_in addr; +#ifdef POLL_HAVE_SOLINGER + struct linger ling; +#endif + int listensd; + int acceptsd; + socklen_t addrlen; + int optval; + + /* Configure uIP */ + + net_configure(); + + /* Create a new TCP socket */ + + listensd = socket(PF_INET, SOCK_STREAM, 0); + if (listensd < 0) + { + message("net_reader: socket failure: %d\n", errno); + goto errout; + } + + /* Set socket to reuse address */ + + optval = 1; + if (setsockopt(listensd, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, sizeof(int)) < 0) + { + message("net_reader: setsockopt SO_REUSEADDR failure: %d\n", errno); + goto errout_with_listensd; + } + + /* Bind the socket to a local address */ + + addr.sin_family = AF_INET; + addr.sin_port = HTONS(LISTENER_PORT); + addr.sin_addr.s_addr = INADDR_ANY; + + if (bind(listensd, (struct sockaddr*)&addr, sizeof(struct sockaddr_in)) < 0) + { + message("net_reader: bind failure: %d\n", errno); + goto errout_with_listensd; + } + + /* Listen for connections on the bound TCP socket */ + + if (listen(listensd, 5) < 0) + { + message("net_reader: listen failure %d\n", errno); + goto errout_with_listensd; + } + + /* Connection loop */ + + for (;;) + { + /* Accept only one connection */ + + message("net_reader: Accepting new connections on port %d\n", LISTENER_PORT); + addrlen = sizeof(struct sockaddr_in); + acceptsd = accept(listensd, (struct sockaddr*)&addr, &addrlen); + if (acceptsd < 0) + { + message("net_reader: accept failure: %d\n", errno); + continue; + } + message("net_reader: Connection accepted on sd=%d\n", acceptsd); + + /* Configure to "linger" until all data is sent when the socket is closed */ + +#ifdef POLL_HAVE_SOLINGER + ling.l_onoff = 1; + ling.l_linger = 30; /* timeout is seconds */ + if (setsockopt(acceptsd, SOL_SOCKET, SO_LINGER, &ling, sizeof(struct linger)) < 0) + { + message("net_reader: setsockopt SO_LINGER failure: %d\n", errno); + goto errout_with_acceptsd; + } +#endif + + /* Handle incoming messsages on the connection. */ + + net_receive(acceptsd); + + message("net_reader: Closing sd=%d\n", acceptsd); + close(acceptsd); + } + +#ifdef POLL_HAVE_SOLINGER +errout_with_acceptsd: + close(acceptsd); +#endif +errout_with_listensd: + close(listensd); +errout: + return NULL; +} diff --git a/apps/examples/poll/poll_internal.h b/apps/examples/poll/poll_internal.h new file mode 100644 index 0000000000..cbf42ac566 --- /dev/null +++ b/apps/examples/poll/poll_internal.h @@ -0,0 +1,128 @@ +/**************************************************************************** + * examples/poll/poll_internal.h + * + * Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __EXAMPLES_PIPE_PIPE_H +#define __EXAMPLES_PIPE_PIPE_H + +/**************************************************************************** + * Compilation Switches + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#ifdef CONFIG_DISABLE_POLL +# error "The polling API is disabled" +#endif + +/* Here are all of the configuration settings that must be met to have TCP/IP + * poll/select support. This kind of looks like overkill. + * + * CONFIG_NET - Network support must be enabled + * CONFIG_NSOCKET_DESCRIPTORS - Socket descriptors must be allocated + * CONFIG_NET_TCP - Only support on TCP (because read-ahead + * ibuffering s not yet support for UDP) + * CONFIG_NET_NTCP_READAHEAD_BUFFERS - TCP/IP read-ahead buffering must be enabled + */ + +#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 && \ + defined(CONFIG_NET_TCP) && CONFIG_NET_NTCP_READAHEAD_BUFFERS > 0 +# define HAVE_NETPOLL 1 +#else +# undef HAVE_NETPOLL +#endif + +/* If debug is enabled, then use lib_rawprintf so that OS debug output and + * the test output are synchronized. + * + * These macros will differ depending upon if the toolchain supports + * macros with a variable number of arguments or not. + */ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_DEBUG +# define message(...) lib_rawprintf(__VA_ARGS__) +# define msgflush() +# else +# define message(...) printf(__VA_ARGS__) +# define msgflush() fflush(stdout) +# endif +#else +# ifdef CONFIG_DEBUG +# define message lib_rawprintf +# define msgflush() +# else +# define message printf +# define msgflush() fflush(stdout) +# endif +#endif + +#define FIFO_PATH1 "/dev/fifo0" +#define FIFO_PATH2 "/dev/fifo1" + +#define POLL_LISTENER_DELAY 2000 /* 2 seconds */ +#define SELECT_LISTENER_DELAY 4 /* 4 seconds */ +#define NET_LISTENER_DELAY 3 /* 3 seconds */ +#define WRITER_DELAY 6 /* 6 seconds */ + +#define LISTENER_PORT 5471 + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +extern void *poll_listener(pthread_addr_t pvarg); +extern void *select_listener(pthread_addr_t pvarg); + +#ifdef HAVE_NETPOLL +extern void *net_listener(pthread_addr_t pvarg); +extern void *net_reader(pthread_addr_t pvarg); +#endif +#endif /* __EXAMPLES_PIPE_PIPE_H */ diff --git a/apps/examples/poll/poll_listener.c b/apps/examples/poll/poll_listener.c new file mode 100644 index 0000000000..816647e340 --- /dev/null +++ b/apps/examples/poll/poll_listener.c @@ -0,0 +1,262 @@ +/**************************************************************************** + * examples/poll/poll_listener.c + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "poll_internal.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#if defined(CONFIG_DEV_CONSOLE) && !defined(CONFIG_DEV_LOWCONSOLE) +# define HAVE_CONSOLE +# define NPOLLFDS 2 +# define CONSNDX 0 +# define FIFONDX 1 +#else +# undef HAVE_CONSOLE +# define NPOLLFDS 1 +# define FIFONDX 0 +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: poll_listener + ****************************************************************************/ + +void *poll_listener(pthread_addr_t pvarg) +{ + struct pollfd fds[NPOLLFDS]; + char buffer[64]; + ssize_t nbytes; + bool timeout; + bool pollin; + int nevents; + int fd; + int ret; + int i; + + /* Open the FIFO for non-blocking read */ + + message("poll_listener: Opening %s for non-blocking read\n", FIFO_PATH1); + fd = open(FIFO_PATH1, O_RDONLY|O_NONBLOCK); + if (fd < 0) + { + message("poll_listener: ERROR Failed to open FIFO %s: %d\n", + FIFO_PATH1, errno); + (void)close(fd); + return (void*)-1; + } + + /* Loop forever */ + + for (;;) + { + message("poll_listener: Calling poll()\n"); + + memset(fds, 0, sizeof(struct pollfd)*NPOLLFDS); +#ifdef HAVE_CONSOLE + fds[CONSNDX].fd = 0; + fds[CONSNDX].events = POLLIN; + fds[CONSNDX].revents = 0; +#endif + fds[FIFONDX].fd = fd; + fds[FIFONDX].events = POLLIN; + fds[FIFONDX].revents = 0; + + timeout = false; + pollin = false; + + ret = poll(fds, NPOLLFDS, POLL_LISTENER_DELAY); + + message("\npoll_listener: poll returned: %d\n", ret); + if (ret < 0) + { + message("poll_listener: ERROR poll failed: %d\n", errno); + } + else if (ret == 0) + { + message("poll_listener: Timeout\n"); + timeout = true; + } + else if (ret > NPOLLFDS) + { + message("poll_listener: ERROR poll reported: %d\n"); + } + else + { + pollin = true; + } + + nevents = 0; + for (i = 0; i < NPOLLFDS; i++) + { + message("poll_listener: FIFO revents[%d]=%02x\n", i, fds[i].revents); + if (timeout) + { + if (fds[i].revents != 0) + { + message("poll_listener: ERROR? expected revents=00, received revents[%d]=%02x\n", + fds[i].revents, i); + } + } + else if (pollin) + { + if (fds[i].revents == POLLIN) + { + nevents++; + } + else if (fds[i].revents != 0) + { + message("poll_listener: ERROR unexpected revents[i]=%02x\n", + i, fds[i].revents); + } + } + } + + if (pollin && nevents != ret) + { + message("poll_listener: ERROR found %d events, poll reported %d\n", nevents, ret); + } + + /* In any event, read until the pipe/serial is empty */ + + for (i = 0; i < NPOLLFDS; i++) + { + do + { +#ifdef HAVE_CONSOLE + /* Hack to work around the fact that the console driver on the + * simulator is always non-blocking. + */ + + if (i == CONSNDX) + { + if ((fds[CONSNDX].revents & POLLIN) != 0) + { + buffer[0] = getchar(); + nbytes = 1; + } + else + { + nbytes = 0; + } + } + else +#endif + { + /* The pipe works differently, it returns whatever data + * it has available without blocking. + */ + + nbytes = read(fds[i].fd, buffer, 63); + } + + if (nbytes <= 0) + { + if (nbytes == 0 || errno == EAGAIN) + { + if ((fds[i].revents & POLLIN) != 0) + { + message("poll_listener: ERROR no read data[%d]\n", i); + } + } + else if (errno != EINTR) + { + message("poll_listener: read[%d] failed: %d\n", i, errno); + } + nbytes = 0; + } + else + { + if (timeout) + { + message("poll_listener: ERROR? Poll timeout, but data read[%d]\n", i); + message(" (might just be a race condition)\n"); + } + + buffer[nbytes] = '\0'; + message("poll_listener: Read[%d] '%s' (%d bytes)\n", i, buffer, nbytes); + } + + /* Suppress error report if no read data on the next time through */ + + fds[i].revents = 0; + } + while (nbytes > 0); + } + + /* Make sure that everything is displayed */ + + msgflush(); + } + + /* Won't get here */ + + (void)close(fd); + return NULL; +} diff --git a/apps/examples/poll/poll_main.c b/apps/examples/poll/poll_main.c new file mode 100644 index 0000000000..3db0150e77 --- /dev/null +++ b/apps/examples/poll/poll_main.c @@ -0,0 +1,221 @@ +/**************************************************************************** + * examples/poll/poll_main.c + * + * Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "poll_internal.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + char buffer[64]; + ssize_t nbytes; + pthread_t tid1; + pthread_t tid2; +#ifdef HAVE_NETPOLL + pthread_t tid3; +#endif + int count; + int fd1 = -1; + int fd2 = -1; + int ret; + int exitcode = 0; + + /* Open FIFOs */ + + message("\nuser_start: Creating FIFO %s\n", FIFO_PATH1); + ret = mkfifo(FIFO_PATH1, 0666); + if (ret < 0) + { + message("user_start: mkfifo failed: %d\n", errno); + exitcode = 1; + goto errout; + } + + message("\nuser_start: Creating FIFO %s\n", FIFO_PATH2); + ret = mkfifo(FIFO_PATH2, 0666); + if (ret < 0) + { + message("user_start: mkfifo failed: %d\n", errno); + exitcode = 2; + goto errout; + } + + /* Open the FIFOs for blocking, write */ + + fd1 = open(FIFO_PATH1, O_WRONLY); + if (fd1 < 0) + { + message("user_start: Failed to open FIFO %s for writing, errno=%d\n", + FIFO_PATH1, errno); + exitcode = 3; + goto errout; + } + + fd2 = open(FIFO_PATH2, O_WRONLY); + if (fd2 < 0) + { + message("user_start: Failed to open FIFO %s for writing, errno=%d\n", + FIFO_PATH2, errno); + exitcode = 4; + goto errout; + } + + /* Start the listeners */ + + message("user_start: Starting poll_listener thread\n"); + + ret = pthread_create(&tid1, NULL, poll_listener, NULL); + if (ret != 0) + { + message("user_start: Failed to create poll_listener thread: %d\n", ret); + exitcode = 5; + goto errout; + } + + message("user_start: Starting select_listener thread\n"); + + ret = pthread_create(&tid2, NULL, select_listener, NULL); + if (ret != 0) + { + message("user_start: Failed to create select_listener thread: %d\n", ret); + exitcode = 6; + goto errout; + } + +#ifdef HAVE_NETPOLL +#ifdef CONFIG_NET_TCPBACKLOG + message("user_start: Starting net_listener thread\n"); + + ret = pthread_create(&tid3, NULL, net_listener, NULL); +#else + message("user_start: Starting net_reader thread\n"); + + ret = pthread_create(&tid3, NULL, net_reader, NULL); +#endif + if (ret != 0) + { + message("user_start: Failed to create net_listener thread: %d\n", ret); + } +#endif + + /* Loop forever */ + + for (count = 0; ; count++) + { + /* Send a message to the listener... this should wake the listener + * from the poll. + */ + + sprintf(buffer, "Message %d", count); + nbytes = write(fd1, buffer, strlen(buffer)); + if (nbytes < 0) + { + message("user_start: Write to fd1 failed: %d\n", errno); + exitcode = 7; + goto errout; + } + + nbytes = write(fd2, buffer, strlen(buffer)); + if (nbytes < 0) + { + message("user_start: Write fd2 failed: %d\n", errno); + exitcode = 8; + goto errout; + } + + message("\nuser_start: Sent '%s' (%d bytes)\n", buffer, nbytes); + msgflush(); + + /* Wait awhile. This delay should be long enough that the + * listener will timeout. + */ + + sleep(WRITER_DELAY); + } + +errout: + if (fd1 >= 0) + { + close(fd1); + } + + if (fd2 >= 0) + { + close(fd2); + } + + fflush(stdout); + return exitcode; +} diff --git a/apps/examples/poll/select_listener.c b/apps/examples/poll/select_listener.c new file mode 100644 index 0000000000..80039ada34 --- /dev/null +++ b/apps/examples/poll/select_listener.c @@ -0,0 +1,193 @@ +/**************************************************************************** + * examples/poll/select_listener.c + * + * Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "poll_internal.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: select_listener + ****************************************************************************/ + +void *select_listener(pthread_addr_t pvarg) +{ + fd_set rfds; + struct timeval tv; + char buffer[64]; + ssize_t nbytes; + bool timeout; + bool ready; + int fd; + int ret; + + /* Open the FIFO for non-blocking read */ + + message("select_listener: Opening %s for non-blocking read\n", FIFO_PATH2); + fd = open(FIFO_PATH2, O_RDONLY|O_NONBLOCK); + if (fd < 0) + { + message("select_listener: ERROR Failed to open FIFO %s: %d\n", + FIFO_PATH2, errno); + (void)close(fd); + return (void*)-1; + } + + /* Loop forever */ + + for (;;) + { + message("select_listener: Calling select()\n"); + + FD_ZERO(&rfds); + FD_SET(fd, &rfds); + + tv.tv_sec = SELECT_LISTENER_DELAY; + tv.tv_usec = 0; + + timeout = false; + ready = false; + + ret = select(fd+1, (FAR fd_set*)&rfds, (FAR fd_set*)NULL, (FAR fd_set*)NULL, &tv); + message("\nselect_listener: select returned: %d\n", ret); + + if (ret < 0) + { + message("select_listener: ERROR select failed: %d\n"); + } + else if (ret == 0) + { + message("select_listener: Timeout\n"); + timeout = true; + } + else + { + if (ret != 1) + { + message("select_listener: ERROR poll reported: %d\n"); + } + else + { + ready = true; + } + + if (!FD_ISSET(fd, rfds)) + { + message("select_listener: ERROR fd=%d not in fd_set\n"); + } + } + + /* In any event, read until the pipe is empty */ + + do + { + nbytes = read(fd, buffer, 63); + if (nbytes <= 0) + { + if (nbytes == 0 || errno == EAGAIN) + { + if (ready) + { + message("select_listener: ERROR no read data\n"); + } + } + else if (errno != EINTR) + { + message("select_listener: read failed: %d\n", errno); + } + nbytes = 0; + } + else + { + if (timeout) + { + message("select_listener: ERROR? Poll timeout, but data read\n"); + message(" (might just be a race condition)\n"); + } + + buffer[nbytes] = '\0'; + message("select_listener: Read '%s' (%d bytes)\n", buffer, nbytes); + } + + timeout = false; + ready = false; + } + while (nbytes > 0); + + /* Make sure that everything is displayed */ + + msgflush(); + } + + /* Won't get here */ + + (void)close(fd); + return NULL; +} diff --git a/apps/examples/rgmp/Makefile b/apps/examples/rgmp/Makefile new file mode 100644 index 0000000000..cefe63d54b --- /dev/null +++ b/apps/examples/rgmp/Makefile @@ -0,0 +1,93 @@ +############################################################################ +# examples/rgmp/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# The smallest thing you can build -- the NULL example. + +ASRCS = +CSRCS = main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/rgmp/main.c b/apps/examples/rgmp/main.c new file mode 100644 index 0000000000..ec6450c50f --- /dev/null +++ b/apps/examples/rgmp/main.c @@ -0,0 +1,66 @@ +/**************************************************************************** + * examples/rgmp/main.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + // TODO: add your code here + + return 0; +} + diff --git a/apps/examples/romfs/Makefile b/apps/examples/romfs/Makefile new file mode 100644 index 0000000000..1db45765a7 --- /dev/null +++ b/apps/examples/romfs/Makefile @@ -0,0 +1,111 @@ +############################################################################ +# apps/examples/romfs/Makefile +# +# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# ROMFS File System Example + +ASRCS = +CSRCS = romfs_main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: checkgenromfs clean depend disclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +checkgenromfs: + @genromfs -h 1>/dev/null 2>&1 || { \ + echo "Host executable genromfs not available in PATH"; \ + echo "You may need to download in from http://romfs.sourceforge.net/"; \ + exit 1; \ + } + +testdir : testdir.tar.gz + @tar zxf $< || { echo "tar zxf $< failed" ; exit 1 ; } + +testdir.img : checkgenromfs testdir + @genromfs -f $@ -d testdir -V "ROMFS_Test" || { echo "genromfs failed" ; exit 1 ; } + +romfs_testdir.h : testdir.img + @xxd -i $< >$@ || { echo "xxd of $< failed" ; exit 1 ; } + +.built: romfs_testdir.h $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +# Register application +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend testdir.img + +-include Make.dep + diff --git a/apps/examples/romfs/romfs_main.c b/apps/examples/romfs/romfs_main.c new file mode 100644 index 0000000000..32b3d2654b --- /dev/null +++ b/apps/examples/romfs/romfs_main.c @@ -0,0 +1,498 @@ +/**************************************************************************** + * examples/romfs/romfs_main.c + * + * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* Mount the ROMFS image, Verifty that it contains the + * following: + * + * testdir + * |---------- [drwxr-xr-x 4096] adir + * | |------ [-rw-r--r-- 21] anotherfile.txt + * | |------ [drwxr-xr-x 4096] subdir + * | | `-- [-rw-r--r-- 21] subdirfile.txt + * | `------ [-rw-r--r-- 25] yafile.txt + * |---------- [-rw-r--r-- 15] afile.txt + * |---------- [-rw-r--r-- 21] hfile + * `---------- [lrwxrwxrwx 11] ldir -> adir/subdir + * + * testdir/ldir is a soft-link and should not be detectable. + * hfile is a hardlink to subdirfile and should be identical + */ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "romfs_testdir.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Configuration settings */ + +#ifndef CONFIG_EXAMPLES_ROMFS_RAMDEVNO +# define CONFIG_EXAMPLES_ROMFS_RAMDEVNO 1 +#endif + +#ifndef CONFIG_EXAMPLES_ROMFS_SECTORSIZE +# define CONFIG_EXAMPLES_ROMFS_SECTORSIZE 64 +#endif + +#ifndef CONFIG_EXAMPLES_ROMFS_MOUNTPOINT +# define CONFIG_EXAMPLES_ROMFS_MOUNTPOINT "/usr/local/share" +#endif + +#ifdef CONFIG_DISABLE_MOUNTPOINT +# error "Mountpoint support is disabled" +#endif + +#if CONFIG_NFILE_DESCRIPTORS < 4 +# error "Not enough file descriptors" +#endif + +#ifndef CONFIG_FS_ROMFS +# error "ROMFS support not enabled" +#endif + +#define NSECTORS(b) (((b)+CONFIG_EXAMPLES_ROMFS_SECTORSIZE-1)/CONFIG_EXAMPLES_ROMFS_SECTORSIZE) +#define STR_RAMDEVNO(m) #m +#define MKMOUNT_DEVNAME(m) "/dev/ram" STR_RAMDEVNO(m) +#define MOUNT_DEVNAME MKMOUNT_DEVNAME(CONFIG_EXAMPLES_ROMFS_RAMDEVNO) + +#define SCRATCHBUFFER_SIZE 1024 + +/* Test directory stuff */ + +#define WRITABLE_MODE (S_IWOTH|S_IWGRP|S_IWUSR) +#define READABLE_MODE (S_IROTH|S_IRGRP|S_IRUSR) +#define EXECUTABLE_MODE (S_IXOTH|S_IXGRP|S_IXUSR) + +#define DIRECTORY_MODE (S_IFDIR|READABLE_MODE|EXECUTABLE_MODE) +#define FILE_MODE (S_IFREG|READABLE_MODE) + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct node_s +{ + struct node_s *peer; /* Next node in this directory */ + bool directory; /* True: directory */ + bool found; /* True: found and verified */ + const char *name; /* Node name */ + mode_t mode; /* Expected permissions */ + size_t size; /* Expected size */ + union + { + const char *filecontent; /* Context of text file */ + struct node_s *child; /* Subdirectory start */ + } u; +}; + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const char g_afilecontent[] = "This is a file\n"; +static const char g_anotherfilecontent[] = "This is another file\n"; +static const char g_yafilecontent[] = "This is yet another file\n"; +static const char g_subdirfilecontent[] = "File in subdirectory\n"; + +#define g_hfilecontent g_subdirfilecontent + +static struct node_s g_adir; +static struct node_s g_afile; +static struct node_s g_hfile; + +static struct node_s g_anotherfile; +static struct node_s g_subdir; +static struct node_s g_yafile; + +static struct node_s g_subdirfile; + +static int g_nerrors = 0; + +static char g_scratchbuffer[SCRATCHBUFFER_SIZE]; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: + ****************************************************************************/ + +static void connectem(void) +{ + g_adir.peer = &g_afile; + g_adir.directory = true; + g_adir.found = false; + g_adir.name = "adir"; + g_adir.mode = DIRECTORY_MODE; + g_adir.size = 0; + g_adir.u.child = &g_anotherfile; + + g_afile.peer = &g_hfile; + g_afile.directory = false; + g_afile.found = false; + g_afile.name = "afile.txt"; + g_afile.mode = FILE_MODE; + g_afile.size = strlen(g_afilecontent); + g_afile.u.filecontent = g_afilecontent; + + g_hfile.peer = NULL; + g_hfile.directory = false; /* Actually a hard link */ + g_hfile.found = false; + g_hfile.name = "hfile"; + g_hfile.mode = FILE_MODE; + g_hfile.size = strlen(g_hfilecontent); + g_hfile.u.filecontent = g_hfilecontent; + + g_anotherfile.peer = &g_yafile; + g_anotherfile.directory = false; + g_anotherfile.found = false; + g_anotherfile.name = "anotherfile.txt"; + g_anotherfile.mode = FILE_MODE; + g_anotherfile.size = strlen(g_anotherfilecontent); + g_anotherfile.u.filecontent = g_anotherfilecontent; + + g_yafile.peer = &g_subdir; + g_yafile.directory = false; + g_yafile.found = false; + g_yafile.name = "yafile.txt"; + g_yafile.mode = FILE_MODE; + g_yafile.size = strlen(g_yafilecontent); + g_yafile.u.filecontent = g_yafilecontent; + + g_subdir.peer = NULL; + g_subdir.directory = true; + g_subdir.found = false; + g_subdir.name = "subdir"; + g_subdir.mode = DIRECTORY_MODE; + g_subdir.size = 0; + g_subdir.u.child = &g_subdirfile; + + g_subdirfile.peer = NULL; + g_subdirfile.directory = false; + g_subdirfile.found = false; + g_subdirfile.name = "subdirfile.txt"; + g_subdirfile.mode = FILE_MODE; + g_subdirfile.size = strlen(g_subdirfilecontent); + g_subdirfile.u.filecontent = g_subdirfilecontent; +} + +/**************************************************************************** + * Name: findindirectory + ****************************************************************************/ + +static struct node_s *findindirectory(struct node_s *entry, const char *name) +{ + for (; entry; entry = entry->peer) + { + if (!entry->found && strcmp(entry->name, name) == 0) + { + entry->found = true; + return entry; + } + } + return NULL; +} + +/**************************************************************************** + * Name: checkattributes + ****************************************************************************/ + +static void checkattributes(const char *path, mode_t mode, size_t size) +{ + struct stat buf; + int ret; + + ret = stat(path, &buf); + if (ret != 0) + { + printf(" -- ERROR: Failed to stat %s: %d\n", path, errno); + g_nerrors++; + return; + } + + if (mode != buf.st_mode) + { + printf(" -- ERROR: Expected mode %08x, got %08x\n", mode, buf.st_mode); + g_nerrors++; + } + + if (size != buf.st_size) + { + printf(" -- ERROR: Expected size %d, got %d\n", mode, buf.st_size); + g_nerrors++; + } +} + +/**************************************************************************** + * Name: checkfile + ****************************************************************************/ + +static void checkfile(const char *path, struct node_s *node) +{ + ssize_t nbytesread; + char *filedata; + int fd; + + /* Open the file */ + + fd = open(path, O_RDONLY); + if (fd < 0) + { + printf(" -- ERROR: Failed to open %s: %d\n", path, errno); + g_nerrors++; + return; + } + + /* Read and verify the file contents */ + + nbytesread = read(fd, g_scratchbuffer, SCRATCHBUFFER_SIZE); + if (nbytesread < 0) + { + printf(" -- ERROR: Failed to read from %s: %d\n", path, errno); + g_nerrors++; + } + else if (nbytesread != node->size) + { + printf(" -- ERROR: Read %d bytes, expected %d\n", nbytesread, node->size); + g_nerrors++; + } + else if (memcmp(g_scratchbuffer, node->u.filecontent, node->size) != 0) + { + g_scratchbuffer[nbytesread] = '\0'; + printf(" -- ERROR: File content read does not match expectation:\n"); + printf(" -- Read: [%s]\n", g_scratchbuffer); + printf(" -- Expected: [%s]\n", node->u.filecontent); + g_nerrors++; + } + + /* Memory map and verify the file contents */ + + filedata = (char*)mmap(NULL, node->size, PROT_READ, MAP_SHARED|MAP_FILE, fd, 0); + if (!filedata || filedata == (char*)MAP_FAILED) + { + printf(" -- ERROR: mmap of %s failed: %d\n", path, errno); + g_nerrors++; + } + else + { + if (memcmp(filedata, node->u.filecontent, node->size) != 0) + { + memcpy(g_scratchbuffer, filedata, node->size); + g_scratchbuffer[node->size] = '\0'; + printf(" -- ERROR: Mapped file content read does not match expectation:\n"); + printf(" -- Memory: [%s]\n", filedata); + printf(" -- Expected: [%s]\n", node->u.filecontent); + g_nerrors++; + } + munmap(filedata, node->size); + } + + /* Close the file */ + + if (close(fd) != OK) + { + printf(" -- ERROR: Failed to close %s: %d\n", path, errno); + g_nerrors++; + } +} + +/**************************************************************************** + * Name: readdirectories + ****************************************************************************/ + +static void readdirectories(const char *path, struct node_s *entry) +{ + DIR *dirp; + struct node_s *node; + struct dirent *direntry; + char *fullpath; + + printf("Traversing directory: %s\n", path); + dirp = opendir(path); + if (!dirp) + { + printf(" ERROR opendir(\"%s\") failed: %d\n", path, errno); + g_nerrors++; + return; + } + + for (direntry = readdir(dirp); direntry; direntry = readdir(dirp)) + { + if (strcmp(direntry->d_name, ".") == 0 || strcmp(direntry->d_name, "..") == 0) + { + printf(" Skipping %s\n", direntry->d_name); + continue; + } + + node = findindirectory(entry, direntry->d_name); + if (!node) + { + printf(" ERROR: No node found for %s\n", direntry->d_name); + g_nerrors++; + continue; + } + + /* Get the full path to the entry */ + + sprintf(g_scratchbuffer, "%s/%s", path, direntry->d_name); + fullpath = strdup(g_scratchbuffer); + + if (DIRENT_ISDIRECTORY(direntry->d_type)) + { + printf(" DIRECTORY: %s/\n", fullpath); + if (!node->directory) + { + printf(" -- ERROR: Expected type directory\n"); + g_nerrors++; + } + else + { + checkattributes(fullpath, node->mode, 0); + readdirectories(fullpath, node->u.child); + printf("Continuing directory: %s\n", path); + } + } + else + { + printf(" FILE: %s/\n", fullpath); + if (node->directory) + { + printf(" -- ERROR: Expected type file\n"); + g_nerrors++; + } + else + { + checkattributes(fullpath, node->mode, node->size); + checkfile(fullpath, node); + } + } + free(fullpath); + } + + closedir(dirp); +} + +/**************************************************************************** + * Name: checkdirectories + ****************************************************************************/ + +static void checkdirectories(struct node_s *entry) +{ + for (; entry; entry = entry->peer) + { + if (!entry->found ) + { + printf("ERROR: %s never found\n", entry->name); + g_nerrors++; + } + + if (entry->directory) + { + checkdirectories(entry->u.child); + } + } +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + int ret; + + /* Create a RAM disk for the test */ + + ret = romdisk_register(CONFIG_EXAMPLES_ROMFS_RAMDEVNO, testdir_img, + NSECTORS(testdir_img_len), CONFIG_EXAMPLES_ROMFS_SECTORSIZE); + if (ret < 0) + { + printf("ERROR: Failed to create RAM disk\n"); + return 1; + } + + /* Mount the test file system */ + + printf("Mounting ROMFS filesystem at target=%s with source=%s\n", + CONFIG_EXAMPLES_ROMFS_MOUNTPOINT, MOUNT_DEVNAME); + + ret = mount(MOUNT_DEVNAME, CONFIG_EXAMPLES_ROMFS_MOUNTPOINT, "romfs", MS_RDONLY, NULL); + if (ret < 0) + { + printf("ERROR: Mount failed: %d\n", errno); + return 1; + } + + /* Perform the test */ + + connectem(); + readdirectories(CONFIG_EXAMPLES_ROMFS_MOUNTPOINT, &g_adir); + checkdirectories(&g_adir); + + if (g_nerrors) + { + printf("Finished with %d errors\n", g_nerrors); + return g_nerrors; + } + + printf("PASSED\n"); + return 0; +} diff --git a/apps/examples/romfs/romfs_testdir.h b/apps/examples/romfs/romfs_testdir.h new file mode 100644 index 0000000000..53f93105cf --- /dev/null +++ b/apps/examples/romfs/romfs_testdir.h @@ -0,0 +1,89 @@ +unsigned char testdir_img[] = { + 0x2d, 0x72, 0x6f, 0x6d, 0x31, 0x66, 0x73, 0x2d, 0x00, 0x00, 0x02, 0x60, + 0x27, 0x43, 0x4a, 0x8a, 0x52, 0x4f, 0x4d, 0x46, 0x53, 0x5f, 0x54, 0x65, + 0x73, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xff, 0xff, 0x97, + 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x00, 0xd1, 0xd1, 0xff, 0x80, 0x2e, 0x2e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, + 0x93, 0x9b, 0x95, 0xf0, 0x6c, 0x64, 0x69, 0x72, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x64, 0x69, 0x72, + 0x2f, 0x73, 0x75, 0x62, 0x64, 0x69, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x19, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x00, + 0x9e, 0x9b, 0x93, 0xc5, 0x61, 0x64, 0x69, 0x72, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x58, 0x47, 0x43, 0xf1, + 0x61, 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x66, 0x69, 0x6c, 0x65, 0x2e, + 0x74, 0x78, 0x74, 0x00, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, + 0x61, 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x66, 0x69, 0x6c, 0x65, + 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, + 0xa1, 0xc5, 0x69, 0xd8, 0x79, 0x61, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x74, + 0x78, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x68, 0x69, 0x73, + 0x20, 0x69, 0x73, 0x20, 0x79, 0x65, 0x74, 0x20, 0x61, 0x6e, 0x6f, 0x74, + 0x68, 0x65, 0x72, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x0a, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x50, 0x00, 0x00, 0x00, 0x90, + 0x00, 0x00, 0x00, 0x00, 0xd1, 0xff, 0xfe, 0x20, 0x2e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x70, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, + 0xd1, 0xd1, 0xfe, 0x70, 0x2e, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, + 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x00, 0x00, 0x23, 0x18, 0x9c, 0x03, + 0x73, 0x75, 0x62, 0x64, 0x69, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xd2, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x15, 0x3e, 0x3f, 0x06, 0xd8, 0x73, 0x75, 0x62, 0x64, + 0x69, 0x72, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x00, + 0x46, 0x69, 0x6c, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x75, 0x62, 0x64, + 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x0a, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf0, + 0x00, 0x00, 0x01, 0x70, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xff, 0xfc, 0xa0, + 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, + 0x00, 0x00, 0x00, 0x00, 0xd1, 0xd1, 0xff, 0x70, 0x2e, 0x2e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x30, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x00, 0x00, + 0x32, 0x99, 0x92, 0xd4, 0x68, 0x66, 0x69, 0x6c, 0x65, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc5, 0x6b, 0x22, 0x0b, + 0x61, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, + 0x61, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 +}; +unsigned int testdir_img_len = 1024; diff --git a/apps/examples/romfs/testdir.tar.gz b/apps/examples/romfs/testdir.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..cd0e9c5182e4fe4974a953b0d1093f058bbdc5b5 GIT binary patch literal 387 zcmV-}0et=+iwFqhD9A_v19W9`bYy9AE_7jX0PUCYYJ)Hkhx7NIB2Td0ow?)<_5^zY zx4Bg)Eoch!?U$I^(oyOPCWCn&Vo(GRKYr)MH@$yvyC;bv@S3qU@t^$H8Joaw^N(!60R{iW`> zEyh5^ZRa)-oGBE{BL61GreOr|3CXbVP!-9u|#uPdHzqIILqXpnDvkDJpWVN|5v60 h>Hj4-?f+%!7X(2N1VIo4K@fz0%Qw4_9cTb3000JL%vb;b literal 0 HcmV?d00001 diff --git a/apps/examples/romfs/testdir.txt b/apps/examples/romfs/testdir.txt new file mode 100644 index 0000000000..e321d6ded7 --- /dev/null +++ b/apps/examples/romfs/testdir.txt @@ -0,0 +1,105 @@ +VOLUME HEADER: Name=ROMFS_Test +0000000: 2d72 6f6d 3166 732d 0000 0260 2743 4a8a -rom1fs-...`'CJ. +0000010: 524f 4d46 535f 5465 7374 0000 0000 0000 ROMFS_Test...... + +FILE HEADER 1: Name=. +0000020: 0000 0049 0000 0020 0000 0000 d1ff ff97 ...I... ........ +0000030: 2e00 0000 0000 0000 0000 0000 0000 0000 ................ + +FILE HEADER 2: Name=.. +0000040: 0000 0060 0000 0020 0000 0000 d1d1 ff80 ...`... ........ +0000050: 2e2e 0000 0000 0000 0000 0000 0000 0000 ................ + +FILE HEADER 3: Name=ldir +0000060: 0000 0093 0000 0000 0000 000b 939b 95f0 ................ +0000070: 6c64 6972 0000 0000 0000 0000 0000 0000 ldir............ + + FILE CONTENT: + 0000080: 6164 6972 2f73 7562 6469 7200 0000 0000 adir/subdir..... + +FILE HEADER 4: Name=adir +0000090: 0000 0219 0000 00b0 0000 0000 9e9b 93c5 ................ +00000a0: 6164 6972 0000 0000 0000 0000 0000 0000 adir............ + + FILE HEADER 4.1: Name=anotherfile.txt + 00000b0: 0000 00f2 0000 0000 0000 0015 5847 43f1 ............XGC. + 00000c0: 616e 6f74 6865 7266 696c 652e 7478 7400 anotherfile.txt. + + FILE CONTENT: + 00000d0: 5468 6973 2069 7320 616e 6f74 6865 7220 This is another + 00000e0: 6669 6c65 0a00 0000 0000 0000 0000 0000 file............ + + FILE HEADER 4.2: Name=yafile.txt + 00000f0: 0000 0132 0000 0000 0000 0019 a1c5 69d8 ...2..........i. + 0000100: 7961 6669 6c65 2e74 7874 0000 0000 0000 yafile.txt...... + + FILE CONTENT: + 0000110: 5468 6973 2069 7320 7965 7420 616e 6f74 This is yet anot + 0000120: 6865 7220 6669 6c65 0a00 0000 0000 0000 her file........ + + FILE HEADER 4.3: Name=. + 0000130: 0000 0150 0000 0090 0000 0000 d1ff fe20 ...P........... + 0000140: 2e00 0000 0000 0000 0000 0000 0000 0000 ................ + + FILE HEADER 4.4: Name=.. + 0000150: 0000 0170 0000 0020 0000 0000 d1d1 fe70 ...p... .......p + 0000160: 2e2e 0000 0000 0000 0000 0000 0000 0000 ................ + + FILE HEADER 4.5: Name=subdir + 0000170: 0000 0009 0000 0190 0000 0000 2318 9c03 ............#... + 0000180: 7375 6264 6972 0000 0000 0000 0000 0000 subdir.......... + + FILE HEADER 4.5.1: Name=subdirfile.txt + 0000190: 0000 01d2 0000 0000 0000 0015 3e3f 06d8 ............>?.. + 00001a0: 7375 6264 6972 6669 6c65 2e74 7874 0000 subdirfile.txt.. + + FILE CONTENT: + 00001b0: 4669 6c65 2069 6e20 7375 6264 6972 6563 File in subdirec + 00001c0: 746f 7279 0a00 0000 0000 0000 0000 0000 tory............ + + FILE HEADER 4.5.2: Name=. + 00001d0: 0000 01f0 0000 0170 0000 0000 d1ff fca0 .......p........ + 00001e0: 2e00 0000 0000 0000 0000 0000 0000 0000 ................ + + FILE HEADER 4.5.3: Name=.. + 00001f0: 0000 0000 0000 0090 0000 0000 d1d1 ff70 ...............p + 0000200: 2e2e 0000 0000 0000 0000 0000 0000 0000 ................ + +FILE HEADER 5: Name=hfile +0000210: 0000 0230 0000 0190 0000 0000 3299 92d4 ...0........2... +0000220: 6866 696c 6500 0000 0000 0000 0000 0000 hfile........... + +FILE HEADER 6: Name=afile.txt +0000230: 0000 0002 0000 0000 0000 000f c56b 220b .............k". +0000240: 6166 696c 652e 7478 7400 0000 0000 0000 afile.txt....... + + FILE CONTENT: + 0000250: 5468 6973 2069 7320 6120 6669 6c65 0a00 This is a file.. + +PADDING +0000260: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000270: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000280: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000290: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +00002a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +00002b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +00002c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +00002d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +00002e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +00002f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000300: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000310: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000320: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000330: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000340: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000350: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000360: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000370: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000380: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000390: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +00003a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +00003b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +00003c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +00003d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +00003e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +00003f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ diff --git a/apps/examples/sendmail/Makefile b/apps/examples/sendmail/Makefile new file mode 100644 index 0000000000..2c8883c280 --- /dev/null +++ b/apps/examples/sendmail/Makefile @@ -0,0 +1,96 @@ +############################################################################ +# apps/examples/sendmail/Makefile +# +# Copyright (C) 2009-2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# Sendmail SMTP Example + +ASRCS = +CSRCS = target.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +# Register application +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + @$(MAKE) -f Makefile.host clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep + diff --git a/apps/examples/sendmail/Makefile.host b/apps/examples/sendmail/Makefile.host new file mode 100644 index 0000000000..3b99432e3e --- /dev/null +++ b/apps/examples/sendmail/Makefile.host @@ -0,0 +1,77 @@ +############################################################################ +# apps/examples/sendmail/Makefile.host +# +# Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# TOPDIR must be defined on the make command line + +-include $(TOPDIR)/Make.defs + +OBJS = host.o1 smtp.o1 +BIN = sendmail + +HOSTCFLAGS += -DCONFIG_WEBCLIENT_HOST=1 +HOSTCFLAGS += -I. -include hostdefs.h -Iinclude +VPATH = $(TOPDIR)/netutils/smtp:. + +all: $(BIN) +.PHONY: clean context clean_context distclean + +$(OBJS): %.o1: %.c + $(HOSTCC) -c $(HOSTCFLAGS) $< -o $@ + +include: + @mkdir include + +include/net: include + @ln -s $(TOPDIR)/include/net include/net + +include/nuttx: + @mkdir -p include/nuttx + +include/queue.h: include + @cp -a $(TOPDIR)/include/queue.h include/. + +include/nuttx/config.h: include/nuttx + @touch include/nuttx/config.h + +headers: include/nuttx/config.h include/queue.h include/net + +$(BIN): headers $(OBJS) + $(HOSTCC) $(HOSTLDFLAGS) $(OBJS) -o $@ + +clean: + @rm -f $(BIN).* *.o1 *~ + @rm -rf include + + diff --git a/apps/examples/sendmail/host.c b/apps/examples/sendmail/host.c new file mode 100644 index 0000000000..67a541b0c0 --- /dev/null +++ b/apps/examples/sendmail/host.c @@ -0,0 +1,103 @@ +/**************************************************************************** + * examples/sendmail/host.c + * + * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include +#include + +#include + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const char g_host_name[] = "localhost"; +static const char g_sender[] = "nuttx-testing@example.com"; +static const char g_subject[] = "Testing SMTP from NuttX"; +static const char g_msg_body[] = "Test message sent by NuttX\r\n"; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: show_usage + ****************************************************************************/ + +static void show_usage(const char *progname, int exitcode) +{ + fprintf(stderr, "USAGE: %s \n", progname); + exit(exitcode); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ +/**************************************************************************** + * Name: main + ****************************************************************************/ + +int main(int argc, char **argv, char **envp) +{ + struct in_addr addr; + void *handle; + + if (argc != 2) + { + show_usage(argv[0], 1); + } + + printf("sendmail: To: %s\n", argv[1]); + printf("sendmail: From: %s\n", g_sender); + printf("sendmail: Subject: %s\n", g_subject); + printf("sendmail: Body: %s\n", g_msg_body); + + uip_ipaddr(addr.s_addr, 127, 0, 0, 1); + handle = smtp_open(); + if (handle) + { + smtp_configure(handle, g_host_name, &addr.s_addr); + smtp_send(handle, argv[1], NULL, g_sender, g_subject, + g_msg_body, strlen(g_msg_body)); + smtp_close(handle); + } + return 0; +} diff --git a/apps/examples/sendmail/hostdefs.h b/apps/examples/sendmail/hostdefs.h new file mode 100755 index 0000000000..da072d560a --- /dev/null +++ b/apps/examples/sendmail/hostdefs.h @@ -0,0 +1,69 @@ +/**************************************************************************** + * examples/wget/hostdefs.c + * + * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef __HOSTDEFS_H +#define __HOSTDEFS_H + +/**************************************************************************** + * Included Files + *****************************************************************************/ + +#include +#include +#include + +/**************************************************************************** + * Preprocessor Defintiions + *****************************************************************************/ + +#define HTONS(a) htons(a) +#define HTONL(a) htonl(a) +#define CONFIG_CPP_HAVE_WARNING 1 +#define CONFIG_HAVE_GETHOSTBYNAME 1 +#define FAR + +#define ndbg(...) printf(__VA_ARGS__) +#define nvdbg(...) printf(__VA_ARGS__) + +#define ERROR (-1) +#define OK (0) + +/**************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef void *(*pthread_startroutine_t)(void *); + +#endif /* __HOSTDEFS_H */ diff --git a/apps/examples/sendmail/target.c b/apps/examples/sendmail/target.c new file mode 100644 index 0000000000..ab4da14b19 --- /dev/null +++ b/apps/examples/sendmail/target.c @@ -0,0 +1,157 @@ +/**************************************************************************** + * examples/sendmail/target.c + * + * Copyright (C) 2009. 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +/**************************************************************************** + * Pre-processor Defintitions + ****************************************************************************/ + +#ifndef CONFIG_EXAMPLE_SENDMAIL_RECIPIENT +# error "You must provice CONFIG_EXAMPLE_SENDMAIL_RECIPIENT" +#endif + +#ifndef CONFIG_EXAMPLE_SENDMAIL_IPADDR +# error "You must provice CONFIG_EXAMPLE_SENDMAIL_IPADDR" +#endif + +#ifndef CONFIG_EXAMPLE_SENDMAIL_DRIPADDR +# error "You must provice CONFIG_EXAMPLE_SENDMAIL_DRIPADDR" +#endif + +#ifndef CONFIG_EXAMPLE_SENDMAIL_NETMASK +# error "You must provice CONFIG_EXAMPLE_SENDMAIL_NETMASK" +#endif + +#ifndef CONFIG_EXAMPLE_SENDMAIL_SENDER +# define CONFIG_EXAMPLE_SENDMAIL_SENDER "nuttx-testing@example.com" +#endif + +#ifndef CONFIG_EXAMPLE_SENDMAIL_SUBJECT +# define CONFIG_EXAMPLE_SENDMAIL_SUBJECT "Testing SMTP from NuttX" +#endif + +#ifndef CONFIG_EXAMPLE_SENDMAIL_BODY +# define CONFIG_EXAMPLE_SENDMAIL_BODY "Test message sent by NuttX" +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const char g_host_name[] = "localhost"; +static const char g_recipient[] = CONFIG_EXAMPLE_SENDMAIL_RECIPIENT; +static const char g_sender[] = CONFIG_EXAMPLE_SENDMAIL_SENDER; +static const char g_subject[] = CONFIG_EXAMPLE_SENDMAIL_SUBJECT; +static const char g_msg_body[] = CONFIG_EXAMPLE_SENDMAIL_BODY "\r\n"; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + struct in_addr addr; +#if defined(CONFIG_EXAMPLE_SENDMAIL_NOMAC) + uint8_t mac[IFHWADDRLEN]; +#endif + void *handle; + + printf("sendmail: To: %s\n", g_recipient); + printf("sendmail: From: %s\n", g_sender); + printf("sendmail: Subject: %s\n", g_subject); + printf("sendmail: Body: %s\n", g_msg_body); + +/* Many embedded network interfaces must have a software assigned MAC */ + +#ifdef CONFIG_EXAMPLE_SENDMAIL_NOMAC + mac[0] = 0x00; + mac[1] = 0xe0; + mac[2] = 0xb0; + mac[3] = 0x0b; + mac[4] = 0xba; + mac[5] = 0xbe; + uip_setmacaddr("eth0", mac); +#endif + + /* Set up our host address */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_SENDMAIL_IPADDR); + uip_sethostaddr("eth0", &addr); + + /* Set up the default router address */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_SENDMAIL_DRIPADDR); + uip_setdraddr("eth0", &addr); + + /* Setup the subnet mask */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_SENDMAIL_NETMASK); + uip_setnetmask("eth0", &addr); + + /* Then send the mail */ + + uip_ipaddr(addr.s_addr, 127, 0, 0, 1); + handle = smtp_open(); + if (handle) + { + smtp_configure(handle, g_host_name, &addr.s_addr); + smtp_send(handle, g_recipient, NULL, g_sender, g_subject, + g_msg_body, strlen(g_msg_body)); + smtp_close(handle); + } + return 0; +} diff --git a/apps/examples/serloop/Makefile b/apps/examples/serloop/Makefile new file mode 100644 index 0000000000..67c805d46c --- /dev/null +++ b/apps/examples/serloop/Makefile @@ -0,0 +1,95 @@ +############################################################################ +# apps/examples/serloop/Makefile +# +# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# Mindlessly simple console loopack test + +ASRCS = +CSRCS = main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +# Register application +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep + diff --git a/apps/examples/serloop/main.c b/apps/examples/serloop/main.c new file mode 100644 index 0000000000..3c635fe886 --- /dev/null +++ b/apps/examples/serloop/main.c @@ -0,0 +1,100 @@ +/**************************************************************************** + * examples/serloop/main.c + * + * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ +#ifdef CONFIG_EXAMPLES_SERLOOP_BUFIO + int ch; + + for (;;) + { + ch = getchar(); + if (ch < 1) + { + ch = '!'; + } + else if ((ch < 0x20 || ch > 0x7e) && ch != '\n') + { + ch = '.'; + } + putchar(ch); + } +#else + uint8_t ch; + int ret; + + for (;;) + { + ret = read(0, &ch, 1); + if (ret < 1) + { + ch = '!'; + } + else if ((ch < 0x20 || ch > 0x7e) && ch != '\n') + { + ch = '.'; + } + ret = write(1, &ch, 1); + } +#endif + return 0; +} + diff --git a/apps/examples/thttpd/Makefile b/apps/examples/thttpd/Makefile new file mode 100644 index 0000000000..9df26af359 --- /dev/null +++ b/apps/examples/thttpd/Makefile @@ -0,0 +1,98 @@ +############################################################################ +# apps/examples/thttpd/Makefile +# +# Copyright (C) 2009-2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# THTTPD Web Server Example + +ASRCS = +CSRCS = main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: headers clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +headers: + @$(MAKE) -C content TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV) + +.built: headers $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + @$(MAKE) -C content clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV) + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep + diff --git a/apps/examples/thttpd/content/Makefile b/apps/examples/thttpd/content/Makefile new file mode 100644 index 0000000000..8c213a9d5c --- /dev/null +++ b/apps/examples/thttpd/content/Makefile @@ -0,0 +1,104 @@ +############################################################################ +# apps/examples/thttpd/content/Makefile +# +# Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +SUBDIRS = hello tasks netstat +INSTALL_FILES = index.html style.css + +THTTPD_DIR = $(APPDIR)/examples/thttpd +CONTENT_DIR = $(THTTPD_DIR)/content +ROMFS_DIR = $(CONTENT_DIR)/romfs +ROMFS_IMG = $(CONTENT_DIR)/romfs.img +ROMFS_HDR = $(CONTENT_DIR)/romfs.h +ROMFSCGI_DIR = $(ROMFS_DIR)/cgi-bin +SYMTAB = $(CONTENT_DIR)/symtab.h + +define DIR_template +$(1)_$(2): + @$(MAKE) -C $(1) $(3) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV) CGI_DIR="$(ROMFSCGI_DIR)" +endef + +all: $(ROMFS_HDR) $(SYMTAB) +.PHONY: all build clean install populate + +$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),build, all))) +$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),clean,clean))) +$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),install,install))) + +# Build program(s) in each sud-directory + +build: $(foreach DIR, $(SUBDIRS), $(DIR)_build) + +# Install each program in the romfs directory + +install: $(foreach DIR, $(SUBDIRS), $(DIR)_install) + @( for file in $(INSTALL_FILES); do\ + install -m 0644 -D $${file} $(ROMFS_DIR)/$${file}; \ + done; ) + +# Create the romfs directory + +$(ROMFS_DIR): + @mkdir -p $(ROMFS_DIR) + +$(ROMFSCGI_DIR): $(ROMFS_DIR) + @mkdir -p $(ROMFSCGI_DIR) + +# Populate the romfs directory + +populate: $(ROMFSCGI_DIR) build install + +# Create the romfs.img file from the populated romfs directory + +$(ROMFS_IMG): populate + @genromfs -f $@ -d $(ROMFS_DIR) -V "THTTPDTEST" + +# Create the romfs.h header file from the romfs.img file + +$(ROMFS_HDR) : $(ROMFS_IMG) + @(cd $(CONTENT_DIR); xxd -i romfs.img | sed -e "s/^unsigned/static const unsigned/g" >$@) + +# Create the exported symbol table list from the derived *-thunk.S files + +$(SYMTAB): build + @$(CONTENT_DIR)/mksymtab.sh $(CONTENT_DIR) >$@ + +# Clean each subdirectory + +clean: $(foreach DIR, $(SUBDIRS), $(DIR)_clean) + @rm -f $(ROMFS_HDR) $(ROMFS_IMG) $(SYMTAB) + @rm -rf $(ROMFS_DIR) + @rm -f *~ .*.swp + + diff --git a/apps/examples/thttpd/content/hello/Makefile b/apps/examples/thttpd/content/hello/Makefile new file mode 100644 index 0000000000..e980f1c341 --- /dev/null +++ b/apps/examples/thttpd/content/hello/Makefile @@ -0,0 +1,78 @@ +############################################################################ +# examples/thttpd/content/hello/Makefile +# +# Copyright (C) 2009 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config # Current configuration +-include $(TOPDIR)/Make.defs # Basic make info + +BIN = hello + +R1SRCS = $(BIN).c +R1OBJS = $(R1SRCS:.c=.o) + +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) + +all: $(BIN) + +$(R1OBJS): %.o: %.c + @echo "CC: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(R2OBJ): %.o: %.S + @echo "AS: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(BIN).r1: $(R1OBJS) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS1) -o $@ $^ + +$(R2SRC): $(BIN).r1 + @echo "MK: $<" + @$(MKNXFLAT) -o $@ $^ + +$(BIN).r2: $(R2OBJ) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) + +$(BIN): $(BIN).r2 + @echo "LD: $<" + @$(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ + +clean: + @rm -f $(BIN) $(R2SRC) *.o *.r1 *.r2 *~ .*.swp core + +install: + @install -m 0755 -D $(BIN) $(CGI_DIR)/$(BIN) + diff --git a/apps/examples/thttpd/content/hello/hello.c b/apps/examples/thttpd/content/hello/hello.c new file mode 100644 index 0000000000..40f31a4548 --- /dev/null +++ b/apps/examples/thttpd/content/hello/hello.c @@ -0,0 +1,79 @@ +/**************************************************************************** + * examples/thttpd/content/hello/hello.c + * Manatory "Hello, World!" Example + * + * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int main(int argc, char *argv[]) +{ + fprintf(stderr, "Hello requested from: %s\n", getenv("REMOTE_ADDR")); + + puts( + "Content-type: text/html\r\n" + "Status: 200/html\r\n" + "\r\n" + "\r\n" + "\r\n" + "Hello!\r\n" + "\r\n" + "\r\n" + "\r\n" + "
\r\n" + "\r\n" + "\r\n" + "\r\n" + "\r\n" + "
\r\n" + "
\r\n" + "
\r\n"); + printf( + "

Hello, World!

Requested by: %s

\r\n", + getenv("REMOTE_ADDR")); + puts( + "\r\n" + "\r\n"); + return 0; +} diff --git a/apps/examples/thttpd/content/index.html b/apps/examples/thttpd/content/index.html new file mode 100644 index 0000000000..1fba1fbf6d --- /dev/null +++ b/apps/examples/thttpd/content/index.html @@ -0,0 +1,30 @@ + + + + NuttX examples/thttpd + + + + + + +
+

+ These web pages are served by a port of THTTPD + running on top of NuttX. + NuttX includes a port of the uIP embedded TCP/IP stack. +

+

+ Click on the links above to exercise THTTPD's CGI capability under NuttX. + Clicking the links will execute the CGI program from an + NXFLAT program residing + in a ROMFS file system. +

+ + diff --git a/apps/examples/thttpd/content/mksymtab.sh b/apps/examples/thttpd/content/mksymtab.sh new file mode 100755 index 0000000000..611d3a87a0 --- /dev/null +++ b/apps/examples/thttpd/content/mksymtab.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +usage="Usage: %0 " + +dir=$1 +if [ -z "$dir" ]; then + echo "ERROR: Missing " + echo "" + echo $usage + exit 1 +fi + +if [ ! -d "$dir" ]; then + echo "ERROR: Directory $dir does not exist" + echo "" + echo $usage + exit 1 +fi + +varlist=`find $dir -name "*-thunk.S"| xargs grep -h asciz | cut -f3 | sort | uniq` + +echo "#ifndef __EXAMPLES_NXFLAT_TESTS_SYMTAB_H" +echo "#define __EXAMPLES_NXFLAT_TESTS_SYMTAB_H" +echo "" +echo "#include " +echo "" +echo "static const struct symtab_s exports[] = " +echo "{" + +for string in $varlist; do + var=`echo $string | sed -e "s/\"//g"` + echo " {$string, $var}," +done + +echo "};" +echo "#define NEXPORTS (sizeof(exports)/sizeof(struct symtab_s))" +echo "" +echo "#endif /* __EXAMPLES_NXFLAT_TESTS_SYMTAB_H */" + diff --git a/apps/examples/thttpd/content/netstat/Makefile b/apps/examples/thttpd/content/netstat/Makefile new file mode 100644 index 0000000000..b12cbabc82 --- /dev/null +++ b/apps/examples/thttpd/content/netstat/Makefile @@ -0,0 +1,78 @@ +############################################################################ +# examples/thttpd/content/netstat/Makefile +# +# Copyright (C) 2009 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config # Current configuration +-include $(TOPDIR)/Make.defs # Basic make info + +BIN = netstat + +R1SRCS = $(BIN).c +R1OBJS = $(R1SRCS:.c=.o) + +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) + +all: $(BIN) + +$(R1OBJS): %.o: %.c + @echo "CC: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(R2OBJ): %.o: %.S + @echo "AS: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(BIN).r1: $(R1OBJS) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS1) -o $@ $^ + +$(R2SRC): $(BIN).r1 + @echo "MK: $<" + @$(MKNXFLAT) -o $@ $^ + +$(BIN).r2: $(R2OBJ) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) + +$(BIN): $(BIN).r2 + @echo "LD: $<" + @$(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ + +clean: + @rm -f $(BIN) $(R2SRC) *.o *.r1 *.r2 *~ .*.swp core + +install: + @install -m 0755 -D $(BIN) $(CGI_DIR)/$(BIN) + diff --git a/apps/examples/thttpd/content/netstat/netstat.c b/apps/examples/thttpd/content/netstat/netstat.c new file mode 100755 index 0000000000..6341462741 --- /dev/null +++ b/apps/examples/thttpd/content/netstat/netstat.c @@ -0,0 +1,134 @@ +/**************************************************************************** + * examples/thttpd/netstat/netstat.c + * + * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/* NOTEs: + * + * 1. One limitation in the use of NXFLAT is that functions that are + * referenced as a pointer-to-a-function must have global scope. Otherwise + * ARM GCC will generate some bad logic. + * 2. In general, when called back, there is no guarantee to that PIC registers + * will be valid and, unless you take special precautions, it could be + * dangerous to reference global variables in the callback function. + */ + +/* static */ int netdev_callback(FAR struct uip_driver_s *dev, void *arg) +{ + struct in_addr addr; + + printf("
%s\r\n", dev->d_ifname); +#ifdef CONFIG_NET_ETHERNET + printf("
HWaddr: %s
\r\n", ether_ntoa(&dev->d_mac)); +#endif + addr.s_addr = dev->d_ipaddr; + printf(" IPaddr: %s
\r\n", inet_ntoa(addr)); + addr.s_addr = dev->d_draddr; + printf(" DRaddr: %s
\r\n", inet_ntoa(addr)); + addr.s_addr = dev->d_netmask; + printf(" Mask: %s\r\n", inet_ntoa(addr)); + return OK; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int main(int argc, char *argv[]) +{ + puts( + "Content-type: text/html\r\n" + "Status: 200/html\r\n" + "\r\n" + "\r\n" + "\r\n" + "Network Status\r\n" + "\r\n" + "\r\n" + "\r\n" + "
\r\n" + "\r\n" + "\r\n" + "\r\n" + "\r\n" + "
\r\n" + "
\r\n" + "
\r\n" + "
\r\n"); + + netdev_foreach(netdev_callback, NULL); + + puts( + "
\r\n" + "\r\n" + "\r\n"); + return 0; +} diff --git a/apps/examples/thttpd/content/style.css b/apps/examples/thttpd/content/style.css new file mode 100644 index 0000000000..bfb0997a88 --- /dev/null +++ b/apps/examples/thttpd/content/style.css @@ -0,0 +1,80 @@ +h1 +{ + text-align: center; + font-size:14pt; + font-family:arial,helvetica; + font-weight:bold; + padding:10px; +} + +body +{ + background-color: #fffeec; + color:black; + font-size:8pt; + font-family:arial,helvetica; +} + +.menu +{ + margin: 4px; + width:60%; + padding:2px; + border: solid 1px; + background-color: #fffcd2; + text-align:left; + font-size:9pt; + font-family:arial,helvetica; +} + +div.menubox +{ + width: 25%; + border: 0; + float: left; + text-align: center; +} + +.contentblock +{ + margin: 4px; + width:60%; + padding:2px; + border: 1px dotted; + background-color: white; + font-size:8pt; + font-family:arial,helvetica; +} + +p.intro +{ + margin-left:20px; + margin-right:20px; + font-size:10pt; + font-family:arial,helvetica; +} + +p.clink +{ + font-size:12pt; + font-family:courier,monospace; + text-align:center; +} + +p.clink9 +{ + font-size:9pt; + font-family:courier,monospace; + text-align:center; +} + +p +{ + padding-left:10px; +} + +p.right +{ + text-align:right; +} + diff --git a/apps/examples/thttpd/content/tasks/Makefile b/apps/examples/thttpd/content/tasks/Makefile new file mode 100755 index 0000000000..2666e0b69f --- /dev/null +++ b/apps/examples/thttpd/content/tasks/Makefile @@ -0,0 +1,78 @@ +############################################################################ +# examples/thttpd/content/tasks/Makefile +# +# Copyright (C) 2009 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config # Current configuration +-include $(TOPDIR)/Make.defs # Basic make info + +BIN = tasks + +R1SRCS = $(BIN).c +R1OBJS = $(R1SRCS:.c=.o) + +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) + +all: $(BIN) + +$(R1OBJS): %.o: %.c + @echo "CC: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(R2OBJ): %.o: %.S + @echo "AS: $<" + @$(CC) -c $(CPICFLAGS) $< -o $@ + +$(BIN).r1: $(R1OBJS) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS1) -o $@ $^ + +$(R2SRC): $(BIN).r1 + @echo "MK: $<" + @$(MKNXFLAT) -o $@ $^ + +$(BIN).r2: $(R2OBJ) + @echo "LD: $<" + @$(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) + +$(BIN): $(BIN).r2 + @echo "LD: $<" + @$(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ + +clean: + @rm -f $(BIN) $(R2SRC) *.o *.r1 *.r2 *~ .*.swp core + +install: + @install -m 0755 -D $(BIN) $(CGI_DIR)/$(BIN) + diff --git a/apps/examples/thttpd/content/tasks/tasks.c b/apps/examples/thttpd/content/tasks/tasks.c new file mode 100755 index 0000000000..7805690903 --- /dev/null +++ b/apps/examples/thttpd/content/tasks/tasks.c @@ -0,0 +1,176 @@ +/**************************************************************************** + * examples/thttpd/tasks/tasks.c + * + * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const char *g_statenames[] = +{ + "INVALID ", + "PENDING ", + "READY ", + "RUNNING ", + "INACTIVE", + "WAITSEM ", +#ifndef CONFIG_DISABLE_MQUEUE + "WAITSIG ", +#endif +#ifndef CONFIG_DISABLE_MQUEUE + "MQNEMPTY", + "MQNFULL " +#endif +}; + +static const char *g_ttypenames[4] = +{ + "TASK ", + "PTHREAD", + "KTHREAD", + "--?-- " +}; + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/* NOTEs: + * + * 1. One limitation in the use of NXFLAT is that functions that are + * referenced as a pointer-to-a-function must have global scope. Otherwise + * ARM GCC will generate some bad logic. + * 2. In general, when called back, there is no guarantee to that PIC registers + * will be valid and, unless you take special precautions, it could be + * dangerous to reference global variables in the callback function. + */ + +/* static */ void show_task(FAR _TCB *tcb, FAR void *arg) +{ + int i; + + /* Show task status */ + + printf("%5d %3d %4s %7s%c%c %8s ", + tcb->pid, tcb->sched_priority, + tcb->flags & TCB_FLAG_ROUND_ROBIN ? "RR " : "FIFO", + g_ttypenames[(tcb->flags & TCB_FLAG_TTYPE_MASK) >> TCB_FLAG_TTYPE_SHIFT], + tcb->flags & TCB_FLAG_NONCANCELABLE ? 'N' : ' ', + tcb->flags & TCB_FLAG_CANCEL_PENDING ? 'P' : ' ', + g_statenames[tcb->task_state]); + + /* Show task name and arguments */ + + printf("%s(", tcb->argv[0]); + + /* Special case 1st argument (no comma) */ + + if (tcb->argv[1]) + { + printf("%p", tcb->argv[1]); + } + + /* Then any additional arguments */ + +#if CONFIG_MAX_TASK_ARGS > 2 + for (i = 2; i <= CONFIG_MAX_TASK_ARGS && tcb->argv[i]; i++) + { + printf(", %p", tcb->argv[i]); + } +#endif + printf(")\n"); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int main(int argc, char *argv[]) +{ + puts( + "Content-type: text/html\r\n" + "Status: 200/html\r\n" + "\r\n" + "\r\n" + "\r\n" + "NuttX Tasks\r\n" + "\r\n" + "\r\n" + "\r\n" + "
\r\n" + "\r\n" + "\r\n" + "\r\n" + "\r\n" + "
\r\n" + "
\r\n" + "
\r\n" + "
\r\n"
+        "PID   PRI SCHD TYPE   NP STATE    NAME\r\n");
+
+  sched_foreach(show_task, NULL);
+
+  puts(
+        "
\r\n" + "\r\n" + "\r\n"); + return 0; +} diff --git a/apps/examples/thttpd/main.c b/apps/examples/thttpd/main.c new file mode 100644 index 0000000000..be30876cbf --- /dev/null +++ b/apps/examples/thttpd/main.c @@ -0,0 +1,267 @@ +/**************************************************************************** + * examples/thttpd/main.c + * + * Copyright (C) 2009-2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include +#ifdef CONFIG_NET_SLIP +# include +#endif + +#include "content/romfs.h" +#include "content/symtab.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Check configuration. This is not all of the configuration settings that + * are required -- only the more obvious. + */ + +#if CONFIG_NFILE_DESCRIPTORS < 1 +# error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file" +#endif + +#ifndef CONFIG_NXFLAT +# error "You must select CONFIG_NXFLAT in your configuration file" +#endif + +#ifndef CONFIG_FS_ROMFS +# error "You must select CONFIG_FS_ROMFS in your configuration file" +#endif + +#ifdef CONFIG_DISABLE_MOUNTPOINT +# error "You must not disable mountpoints via CONFIG_DISABLE_MOUNTPOINT in your configuration file" +#endif + +#ifdef CONFIG_BINFMT_DISABLE +# error "You must not disable loadable modules via CONFIG_BINFMT_DISABLE in your configuration file" +#endif + +/* SLIP-specific configuration */ + +#ifdef CONFIG_NET_SLIP + + /* No MAC address operations */ + +# undef CONFIG_EXAMPLE_THTTPD_NOMAC + + /* TTY device to use */ + +# ifndef CONFIG_NET_SLIPTTY +# define CONFIG_NET_SLIPTTY "/dev/ttyS1" +# endif + +# define SLIP_DEVNO 0 +# define NET_DEVNAME "sl0" +#else + + /* Otherwise, use the standard ethernet device name */ + +# define NET_DEVNAME "eth0" +#endif + +/* Describe the ROMFS file system */ + +#define SECTORSIZE 512 +#define NSECTORS(b) (((b)+SECTORSIZE-1)/SECTORSIZE) +#define ROMFSDEV "/dev/ram0" +#define MOUNTPT CONFIG_THTTPD_PATH + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_DEBUG +# define message(...) lib_lowprintf(__VA_ARGS__) +# define msgflush() +# else +# define message(...) printf(__VA_ARGS__) +# define msgflush() fflush(stdout) +# endif +#else +# ifdef CONFIG_DEBUG +# define message lib_lowprintf +# define msgflush() +# else +# define message printf +# define msgflush() fflush(stdout) +# endif +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* These values must be provided by the user before the THTTPD task daemon + * is started: + * + * g_thttpdsymtab: A symbol table describing all of the symbols exported + * from the base system. These symbols are used to bind address references + * in CGI programs to NuttX. + * g_nsymbols: The number of symbols in g_thttpdsymtab[]. + */ + +FAR const struct symtab_s *g_thttpdsymtab; +int g_thttpdnsymbols; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + struct in_addr addr; +#ifdef CONFIG_EXAMPLE_THTTPD_NOMAC + uint8_t mac[IFHWADDRLEN]; +#endif + char *thttpd_argv = "thttpd"; + int ret; + + /* Configure SLIP */ + +#ifdef CONFIG_NET_SLIP + ret = slip_initialize(SLIP_DEVNO, CONFIG_NET_SLIPTTY); + if (ret < 0) + { + message("ERROR: SLIP initialization failed: %d\n", ret); + exit(1); + } +#endif + +/* Many embedded network interfaces must have a software assigned MAC */ + +#ifdef CONFIG_EXAMPLE_THTTPD_NOMAC + message("Assigning MAC\n"); + + mac[0] = 0x00; + mac[1] = 0xe0; + mac[2] = 0xb0; + mac[3] = 0x0b; + mac[4] = 0xba; + mac[5] = 0xbe; + uip_setmacaddr(NET_DEVNAME, mac); +#endif + + /* Set up our host address */ + + message("Setup network addresses\n"); + addr.s_addr = HTONL(CONFIG_THTTPD_IPADDR); + uip_sethostaddr(NET_DEVNAME, &addr); + + /* Set up the default router address */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_THTTPD_DRIPADDR); + uip_setdraddr(NET_DEVNAME, &addr); + + /* Setup the subnet mask */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_THTTPD_NETMASK); + uip_setnetmask(NET_DEVNAME, &addr); + + /* Initialize the NXFLAT binary loader */ + + message("Initializing the NXFLAT binary loader\n"); + ret = nxflat_initialize(); + if (ret < 0) + { + message("ERROR: Initialization of the NXFLAT loader failed: %d\n", ret); + exit(2); + } + + /* Create a ROM disk for the ROMFS filesystem */ + + message("Registering romdisk\n"); + ret = romdisk_register(0, (uint8_t*)romfs_img, NSECTORS(romfs_img_len), SECTORSIZE); + if (ret < 0) + { + message("ERROR: romdisk_register failed: %d\n", ret); + nxflat_uninitialize(); + exit(1); + } + + /* Mount the file system */ + + message("Mounting ROMFS filesystem at target=%s with source=%s\n", + MOUNTPT, ROMFSDEV); + + ret = mount(ROMFSDEV, MOUNTPT, "romfs", MS_RDONLY, NULL); + if (ret < 0) + { + message("ERROR: mount(%s,%s,romfs) failed: %s\n", + ROMFSDEV, MOUNTPT, errno); + nxflat_uninitialize(); + } + + /* Start THTTPD. At present, symbol table info is passed via global variables */ + + g_thttpdsymtab = exports; + g_thttpdnsymbols = NEXPORTS; + + message("Starting THTTPD\n"); + msgflush(); + thttpd_main(1, &thttpd_argv); + message("THTTPD terminated\n"); + msgflush(); + return 0; +} diff --git a/apps/examples/tiff/Makefile b/apps/examples/tiff/Makefile new file mode 100644 index 0000000000..045508d146 --- /dev/null +++ b/apps/examples/tiff/Makefile @@ -0,0 +1,106 @@ +############################################################################ +# apps/examples/tiff/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# TIFF Unit Test + +ASRCS = +CSRCS = tiff_main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# TIFF built-in application info + +APPNAME = tiff +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +.context: +ifeq ($(CONFIG_EXAMPLES_TIFF_BUILTIN),y) + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + @touch $@ +endif + +context: .context + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + @rm -f result.tif tmpfile1.dat tmpfile2.dat + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/tiff/tiff_main.c b/apps/examples/tiff/tiff_main.c new file mode 100644 index 0000000000..d59f42cb4c --- /dev/null +++ b/apps/examples/tiff/tiff_main.c @@ -0,0 +1,174 @@ +/**************************************************************************** + * apps/graphics/tiff/tiff_main.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include +#include + +#include + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ +/* Configuration ************************************************************/ +/* This is a simple unit test for the TIFF creation library at apps/graphic/tiff. + * It is configured to work in the Linux user-mode simulation and has not been + * tested in any other environment. Since the example also depends on some + * other logic to mount a file system, currently it will only work as an NSH + * built-on, i.e., if the following is defined: + * + * CONFIG_NSH_BUILTIN_APPS=y + * CONFIG_EXAMPLES_TIFF_BUILTIN=y + * + * Other configuration options: + * + * CONFIG_EXAMPLES_TIFF_OUTFILE - Name of the resulting TIFF file + * CONFIG_EXAMPLES_TIFF_TMPFILE1/2 - Names of two temporaries files that + * will be used in the file creation. + */ + +#ifndef CONFIG_EXAMPLES_TIFF_OUTFILE +# define CONFIG_EXAMPLES_TIFF_OUTFILE "/tmp/result.tif" +#endif + +#ifndef CONFIG_EXAMPLES_TIFF_TMPFILE1 +# define CONFIG_EXAMPLES_TIFF_TMPFILE1 "/tmp/tmpfile1.dat" +#endif + +#ifndef CONFIG_EXAMPLES_TIFF_TMPFILE2 +# define CONFIG_EXAMPLES_TIFF_TMPFILE2 "/tmp/tmpfile2.dat" +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: tiff_main/user_start + * + * Description: + * TIFF unit test. + * + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_TIFF_BUILTIN +# define MAIN_NAME tiff_main +#else +# define MAIN_NAME user_start +#endif + +int MAIN_NAME(int argc, char *argv[]) +{ + struct tiff_info_s info; + uint8_t strip[3*256]; + uint8_t *ptr; + int green; + int blue; + int ret; + + /* Configure the interface structure */ + + memset(&info, 0, sizeof(struct tiff_info_s)); + info.outfile = CONFIG_EXAMPLES_TIFF_OUTFILE; + info.tmpfile1 = CONFIG_EXAMPLES_TIFF_TMPFILE1; + info.tmpfile2 = CONFIG_EXAMPLES_TIFF_TMPFILE2; + info.colorfmt = FB_FMT_RGB24; + info.rps = 1; + info.imgwidth = 256; + info.imgheight = 256; + info.iobuffer = (uint8_t *)malloc(300); + info.iosize = 300; + + /* Initialize the TIFF library */ + + ret = tiff_initialize(&info); + if (ret < 0) + { + printf("tiff_initialize() failed: %d\n", ret); + exit(1); + } + + /* Add each strip to the TIFF file */ + + for (green = 0, ptr = strip; green < 256; green++) + { + ptr = strip; + for (blue = 0; blue < 256; blue++) + { + *ptr++ = (green + blue) >> 1; + *ptr++ = green; + *ptr++ = blue; + } + + ret = tiff_addstrip(&info, strip); + if (ret < 0) + { + printf("tiff_addstrip() #%d failed: %d\n", green, ret); + exit(1); + } + } + + /* Then finalize the TIFF file */ + + ret = tiff_finalize(&info); + if (ret < 0) + { + printf("tiff_finalize() failed: %d\n", ret); + exit(1); + } + return 0; +} diff --git a/apps/examples/touchscreen/Makefile b/apps/examples/touchscreen/Makefile new file mode 100644 index 0000000000..e53a52cf95 --- /dev/null +++ b/apps/examples/touchscreen/Makefile @@ -0,0 +1,105 @@ +############################################################################ +# apps/examples/touchscreen/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# NuttX NX Graphics Example. + +ASRCS = +CSRCS = tc_main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Touchscreen built-in application info + +APPNAME = tc +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +# Common build + +VPATH = + +all: .built +.PHONY: context clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +.context: +ifeq ($(CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN),y) + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + @touch $@ +endif + +context: .context + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/examples/touchscreen/tc.h b/apps/examples/touchscreen/tc.h new file mode 100644 index 0000000000..173ed491f5 --- /dev/null +++ b/apps/examples/touchscreen/tc.h @@ -0,0 +1,137 @@ +/**************************************************************************** + * examples/touchscreen/tc.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_EXAMPLES_TOUCHSCREEN_TC_H +#define __APPS_EXAMPLES_TOUCHSCREEN_TC_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + + +/**************************************************************************** + * Definitions + ****************************************************************************/ +/* Configuration ************************************************************/ +/* CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN - Build the touchscreen test as + * an NSH built-in function. Default: Built as a standalone problem + * CONFIG_EXAMPLES_TOUCHSCREEN_MINOR - The minor device number. Minor=N + * correspnds to touchscreen device /dev/input0. Note this value must + * with CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH. Default 0. + * CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH - The path to the touchscreen + * device. This must be consistent with CONFIG_EXAMPLES_TOUCHSCREEN_MINOR. + * Default: "/dev/input0" + * CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES - If CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN + * is defined, then the number of samples is provided on the command line + * and this value is ignored. Otherwise, this number of samples is + * collected and the program terminates. Default: Samples are collected + * indefinitely. + */ + +#ifndef CONFIG_INPUT +# error "Input device support is not enabled (CONFIG_INPUT)" +#endif + +#ifndef CONFIG_EXAMPLES_TOUCHSCREEN_MINOR +# undef CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH +# define CONFIG_EXAMPLES_TOUCHSCREEN_MINOR 0 +# define CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH "/dev/input0" +#endif + +#ifndef CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH +# undef CONFIG_EXAMPLES_TOUCHSCREEN_MINOR +# define CONFIG_EXAMPLES_TOUCHSCREEN_MINOR 0 +# define CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH "/dev/input0" +#endif + +/* Debug ********************************************************************/ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_DEBUG +# define message(...) lib_rawprintf(__VA_ARGS__) +# define msgflush() +# else +# define message(...) printf(__VA_ARGS__) +# define msgflush() fflush(stdout) +# endif +#else +# ifdef CONFIG_DEBUG +# define message lib_rawprintf +# define msgflush() +# else +# define message printf +# define msgflush() fflush(stdout) +# endif +#endif + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: arch_tcinitialize() + * + * Description: + * Perform architecuture-specific initialization of the touchscreen + * hardware. This interface must be provided by all configurations + * using apps/examples/touchscreen + * + ****************************************************************************/ + +int arch_tcinitialize(int minor); + +/**************************************************************************** + * Name: arch_tcuninitialize() + * + * Description: + * Perform architecuture-specific un-initialization of the touchscreen + * hardware. This interface must be provided by all configurations + * using apps/examples/touchscreen + * + ****************************************************************************/ + +void arch_tcuninitialize(void); + +#endif /* __APPS_EXAMPLES_TOUCHSCREEN_TC_H */ diff --git a/apps/examples/touchscreen/tc_main.c b/apps/examples/touchscreen/tc_main.c new file mode 100644 index 0000000000..6db6af992a --- /dev/null +++ b/apps/examples/touchscreen/tc_main.c @@ -0,0 +1,214 @@ +/**************************************************************************** + * examples/touchscreen/tc_main.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include "tc.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: user_start/nxhello_main + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN +# define MAIN_NAME tc_main +# define MAIN_STRING "tc_main: " +#else +# define MAIN_NAME user_start +# define MAIN_STRING "user_start: " +#endif + +int MAIN_NAME(int argc, char *argv[]) +{ + struct touch_sample_s sample; + ssize_t nbytes; +#if defined(CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN) || defined(CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES) + long nsamples; +#endif + int fd; + int errval = 0; + int ret; + + /* If this example is configured as an NX add-on, then limit the number of + * samples that we collect before returning. Otherwise, we never return + */ + +#if defined(CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN) + nsamples = 1; + if (argc > 1) + { + nsamples = strtol(argv[1], NULL, 10); + } + message(MAIN_STRING "nsamples: %d\n", nsamples); +#elif defined(CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES) + message(MAIN_STRING "nsamples: %d\n", CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES); +#endif + + /* Initialization of the touchscreen hardware is performed by logic + * external to this test. + */ + + message(MAIN_STRING "Initializing external touschscreen device\n"); + ret = arch_tcinitialize(CONFIG_EXAMPLES_TOUCHSCREEN_MINOR); + if (ret != OK) + { + message(MAIN_STRING "arch_tcinitialize failed: %d\n", ret); + errval = 1; + goto errout; + } + + /* Open the touchscreen device for reading */ + + fd = open(CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH, O_RDONLY); + if (fd < 0) + { + message(MAIN_STRING "open %s failed: %d\n", + CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH, errno); + errval = 2; + goto errout_with_tc; + } + + /* Now loop the appropriate number of times, displaying the collected + * touchscreen samples. + */ + +#if defined(CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN) + for (; nsamples > 0; nsamples--) +#elif defined(CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES) + for (nsamples = 0; nsamples < CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES; nsamples++) +#else + for (;;) +#endif + { + /* Flush any output before the loop entered or from the previous pass + * through the loop. + */ + + msgflush(); + + /* Read one sample */ + + nbytes = read(fd, &sample, sizeof(struct touch_sample_s)); + ivdbg("Bytes read: %d\n", nbytes); + + /* Handle unexpected return values */ + + if (nbytes < 0) + { + errval = errno; + if (errval != EINTR) + { + message(MAIN_STRING "read %s failed: %d\n", + CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH, errval); + errval = 3; + goto errout_with_dev; + } + + message(MAIN_STRING "Interrupted read...\n"); + } + else if (nbytes != sizeof(struct touch_sample_s)) + { + message(MAIN_STRING "Unexpected read size=%d, expected=%d, Ignoring\n", + nbytes, sizeof(struct touch_sample_s)); + } + + /* Print the sample data on successful return */ + + else + { + message("Sample :\n"); + message(" npoints : %d\n", sample.npoints); + message("Point 1 :\n"); + message(" id : %d\n", sample.point[0].id); + message(" flags : %02x\n", sample.point[0].flags); + message(" x : %d\n", sample.point[0].x); + message(" y : %d\n", sample.point[0].y); + message(" h : %d\n", sample.point[0].h); + message(" w : %d\n", sample.point[0].w); + message(" pressure : %d\n", sample.point[0].pressure); + } + } + +errout_with_dev: + close(fd); +errout_with_tc: + arch_tcuninitialize(); +errout: + message("Terminating!\n"); + msgflush(); + return errval; +} diff --git a/apps/examples/udp/Makefile b/apps/examples/udp/Makefile new file mode 100644 index 0000000000..a9361ba6e9 --- /dev/null +++ b/apps/examples/udp/Makefile @@ -0,0 +1,124 @@ +############################################################################ +# apps/examples/udp/Makefile +# +# Copyright (C) 2007-2008, 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# UDP Test + +TARG_ASRCS = + +TARG_CSRCS = target.c +ifeq ($(CONFIG_EXAMPLE_UDP_SERVER),y) +TARG_CSRCS += udp-server.c +else +TARG_CSRCS += udp-client.c +endif + +TARG_AOBJS = $(TARG_ASRCS:.S=$(OBJEXT)) +TARG_COBJS = $(TARG_CSRCS:.c=$(OBJEXT)) + +TARG_SRCS = $(TARG_ASRCS) $(TARG_CSRCS) +TARG_OBJS = $(TARG_AOBJS) $(TARG_COBJS) + +ifeq ($(WINTOOL),y) + TARG_BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + TARG_BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +HOSTCFLAGS += -DCONFIG_EXAMPLE_UDP_HOST=1 +ifeq ($(CONFIG_EXAMPLE_UDP_SERVER),y) +HOSTCFLAGS += -DCONFIG_EXAMPLE_UDP_SERVER=1 \ + -DCONFIG_EXAMPLE_UDP_SERVERIP="$(CONFIG_EXAMPLE_UDP_SERVERIP)" +endif + +HOST_SRCS = host.c +ifeq ($(CONFIG_EXAMPLE_UDP_SERVER),y) +HOST_SRCS += udp-client.c +else +HOST_SRCS += udp-server.c +endif + +HOST_OBJS = $(HOST_SRCS:.c=.o) +HOST_BIN = host + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend disclean + +$(TARG_AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(TARG_COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +"$(TARG_BIN)": $(TARG_OBJS) $(HOST_BIN) + @( for obj in $(TARG_OBJS) ; do \ + $(call ARCHIVE, $@, $${obj}); \ + done ; ) + +$(HOST_OBJS): %.o: %.c + $(HOSTCC) -c $(HOSTCFLAGS) $< -o $@ + +$(HOST_BIN): $(HOST_OBJS) + $(HOSTCC) $(HOSTLDFLAGS) $(HOST_OBJS) -o $@ + +.built: $(TARG_BIN) $(HOST_BIN) + @touch .built + +context: + +.depend: Makefile $(TARG_SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(TARG_SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f $(TARG_BIN) $(HOST_BIN) *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep + diff --git a/apps/examples/udp/host.c b/apps/examples/udp/host.c new file mode 100644 index 0000000000..34fd967655 --- /dev/null +++ b/apps/examples/udp/host.c @@ -0,0 +1,63 @@ +/**************************************************************************** + * examples/udp/host.c + * + * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "udp-internal.h" + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * main + ****************************************************************************/ + +int main(int argc, char **argv, char **envp) +{ +#ifdef CONFIG_EXAMPLE_UDP_SERVER + send_client(); +#else + recv_server(); +#endif + + return 0; +} diff --git a/apps/examples/udp/target.c b/apps/examples/udp/target.c new file mode 100644 index 0000000000..07fec0e750 --- /dev/null +++ b/apps/examples/udp/target.c @@ -0,0 +1,91 @@ +/**************************************************************************** + * examples/udp/nettest.c + * + * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include + +#include +#include + +#include "udp-internal.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + struct in_addr addr; + + /* Set up our host address */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_UDP_IPADDR); + uip_sethostaddr("eth0", &addr); + + /* Set up the default router address */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_UDP_DRIPADDR); + uip_setdraddr("eth0", &addr); + + /* Setup the subnet mask */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_UDP_NETMASK); + uip_setnetmask("eth0", &addr); + +#ifdef CONFIG_EXAMPLE_UDP_SERVER + recv_server(); +#else + send_client(); +#endif + + return 0; +} diff --git a/apps/examples/udp/udp-client.c b/apps/examples/udp/udp-client.c new file mode 100644 index 0000000000..545a3a6c34 --- /dev/null +++ b/apps/examples/udp/udp-client.c @@ -0,0 +1,133 @@ +/**************************************************************************** + * examples/udp/udp-client.c + * + * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "udp-internal.h" + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static inline void fill_buffer(unsigned char *buf, int offset) +{ + int ch; + int j; + + buf[0] = offset; + for (ch = 0x20, j = offset + 1; ch < 0x7f; ch++, j++) + { + if (j >= SENDSIZE) + { + j = 1; + } + buf[j] = ch; + } +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void send_client(void) +{ + struct sockaddr_in server; + unsigned char outbuf[SENDSIZE]; + int sockfd; + int nbytes; + int offset; + + /* Create a new TCP socket */ + + sockfd = socket(PF_INET, SOCK_DGRAM, 0); + if (sockfd < 0) + { + message("client socket failure %d\n", errno); + exit(1); + } + + /* Then send and receive 256 messages */ + + for (offset = 0; offset < 256; offset++) + { + /* Set up the output buffer */ + + fill_buffer(outbuf, offset); + + /* Send the message */ + + server.sin_family = AF_INET; + server.sin_port = HTONS(PORTNO); + server.sin_addr.s_addr = HTONL(CONFIG_EXAMPLE_UDP_SERVERIP); + + message("client: %d. Sending %d bytes\n", offset, SENDSIZE); + nbytes = sendto(sockfd, outbuf, SENDSIZE, 0, + (struct sockaddr*)&server, sizeof(struct sockaddr_in)); + message("client: %d. Sent %d bytes\n", offset, nbytes); + + if (nbytes < 0) + { + message("client: %d. sendto failed: %d\n", offset, errno); + close(sockfd); + exit(-1); + } + else if (nbytes != SENDSIZE) + { + message("client: %d. Bad send length: %d Expected: %d\n", + offset, nbytes, SENDSIZE); + close(sockfd); + exit(-1); + } + + /* Now, sleep a bit. No packets should be dropped due to overrunning + * the server. + */ + + sleep(2); + } + close(sockfd); +} diff --git a/apps/examples/udp/udp-internal.h b/apps/examples/udp/udp-internal.h new file mode 100644 index 0000000000..94fe1e4825 --- /dev/null +++ b/apps/examples/udp/udp-internal.h @@ -0,0 +1,90 @@ +/**************************************************************************** + * examples/udp/udp-internal.h + * + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __EXAMPLES_UIP_INTERNAL_H +#define __EXAMPLES_UIP_INTERNAL_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLE_UDP_HOST +#else +# include +#endif + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLE_UDP_HOST + /* HTONS/L macros are unique to uIP */ + +# define HTONS(a) htons(a) +# define HTONL(a) htonl(a) + + /* Used printf for debug output */ + +# define message(...) printf(__VA_ARGS__) + + /* Have SO_LINGER */ + +#else + + /* If debug is enabled, use the synchronous lib_lowprintf so that the + * program output does not get disassociated in the debug output. + */ + +# ifdef CONFIG_DEBUG +# define message(...) lib_lowprintf(__VA_ARGS__) +# else +# define message(...) printf(__VA_ARGS__) +# endif + +#endif + +#define PORTNO 5471 + +#define ASCIISIZE (0x7f - 0x20) +#define SENDSIZE (ASCIISIZE+1) + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +extern void send_client(void); +extern void recv_server(void); + +#endif /* __EXAMPLES_UIP_INTERNAL_H */ diff --git a/apps/examples/udp/udp-server.c b/apps/examples/udp/udp-server.c new file mode 100644 index 0000000000..495a713205 --- /dev/null +++ b/apps/examples/udp/udp-server.c @@ -0,0 +1,173 @@ +/**************************************************************************** + * examples/udp/udp-server.c + * + * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +#include +#include +#include +#include + +#include "udp-internal.h" + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static inline int check_buffer(unsigned char *buf) +{ + int ret = 1; + int offset; + int ch; + int j; + + offset = buf[0]; + for (ch = 0x20, j = offset + 1; ch < 0x7f; ch++, j++) + { + if (j >= SENDSIZE) + { + j = 1; + } + if (buf[j] != ch) + { + message("server: Buffer content error for offset=%d, index=%d\n", offset, j); + ret = 0; + } + } + return ret; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void recv_server(void) +{ + struct sockaddr_in server; + struct sockaddr_in client; + in_addr_t tmpaddr; + unsigned char inbuf[1024]; + int sockfd; + int nbytes; + int optval; + int offset; + socklen_t addrlen; + + /* Create a new UDP socket */ + + sockfd = socket(PF_INET, SOCK_DGRAM, 0); + if (sockfd < 0) + { + message("server: socket failure: %d\n", errno); + exit(1); + } + + /* Set socket to reuse address */ + + optval = 1; + if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, sizeof(int)) < 0) + { + message("server: setsockopt SO_REUSEADDR failure: %d\n", errno); + exit(1); + } + + /* Bind the socket to a local address */ + + server.sin_family = AF_INET; + server.sin_port = HTONS(PORTNO); + server.sin_addr.s_addr = HTONL(INADDR_ANY); + + if (bind(sockfd, (struct sockaddr*)&server, sizeof(struct sockaddr_in)) < 0) + { + message("server: bind failure: %d\n", errno); + exit(1); + } + + /* Then receive up to 256 packets of data */ + + for (offset = 0; offset < 256; offset++) + { + message("server: %d. Receiving up 1024 bytes\n", offset); + addrlen = sizeof(struct sockaddr_in); + nbytes = recvfrom(sockfd, inbuf, 1024, 0, + (struct sockaddr*)&client, &addrlen); + + tmpaddr = ntohl(client.sin_addr.s_addr); + message("server: %d. Received %d bytes from %d.%d.%d.%d:%d\n", + offset, nbytes, + tmpaddr >> 24, (tmpaddr >> 16) & 0xff, + (tmpaddr >> 8) & 0xff, tmpaddr & 0xff, + ntohs(client.sin_port)); + + if (nbytes < 0) + { + message("server: %d. recv failed: %d\n", offset, errno); + close(sockfd); + exit(-1); + } + + if (nbytes != SENDSIZE) + { + message("server: %d. recv size incorrect: %d vs %d\n", offset, nbytes, SENDSIZE); + close(sockfd); + exit(-1); + } + + if (offset < inbuf[0]) + { + message("server: %d. %d packets lost, resetting offset\n", offset, inbuf[0] - offset); + offset = inbuf[0]; + } + else if (offset > inbuf[0]) + { + message("server: %d. Bad offset in buffer: %d\n", offset, inbuf[0]); + close(sockfd); + exit(-1); + } + + if (!check_buffer(inbuf)) + { + message("server: %d. Bad buffer contents\n", offset); + close(sockfd); + exit(-1); + } + } + close(sockfd); +} diff --git a/apps/examples/uip/Makefile b/apps/examples/uip/Makefile new file mode 100644 index 0000000000..bf1d399174 --- /dev/null +++ b/apps/examples/uip/Makefile @@ -0,0 +1,94 @@ +############################################################################ +# apps/examples/uip/Makefile +# +# Copyright (C) 2007-2008, 2010-2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# uIP very tiny web server example + +ASRCS = +CSRCS = main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +epend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep + diff --git a/apps/examples/uip/main.c b/apps/examples/uip/main.c new file mode 100644 index 0000000000..fd2da4b8ea --- /dev/null +++ b/apps/examples/uip/main.c @@ -0,0 +1,207 @@ +/**************************************************************************** + * examples/uip/main.c + * + * Copyright (C) 2007, 2009-2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Based on uIP which also has a BSD style license: + * + * Copyright (c) 2001, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Adam Dunkels. + * 4. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#ifdef CONFIG_EXAMPLE_UIP_DHCPC +#include +#endif + +/* Here we include the header file for the application(s) we use in + * our project as defined in the config//defconfig file + */ + +/* DHCPC may be used in conjunction with any other feature (or not) */ + +#ifdef CONFIG_EXAMPLE_UIP_DHCPC +# include +# include +#endif + +/* Include uIP webserver definitions */ + +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_DEBUG +# define message(...) lib_lowprintf(__VA_ARGS__) +# else +# define message(...) printf(__VA_ARGS__) +# endif +#else +# ifdef CONFIG_DEBUG +# define message lib_lowprintf +# else +# define message (void) +# endif +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + struct in_addr addr; +#if defined(CONFIG_EXAMPLE_UIP_DHCPC) || defined(CONFIG_EXAMPLE_UIP_NOMAC) + uint8_t mac[IFHWADDRLEN]; +#endif +#ifdef CONFIG_EXAMPLE_UIP_DHCPC + void *handle; +#endif + +/* Many embedded network interfaces must have a software assigned MAC */ + +#ifdef CONFIG_EXAMPLE_UIP_NOMAC + mac[0] = 0x00; + mac[1] = 0xe0; + mac[2] = 0xb0; + mac[3] = 0x0b; + mac[4] = 0xba; + mac[5] = 0xbe; + uip_setmacaddr("eth0", mac); +#endif + + /* Set up our host address */ + +#ifdef CONFIG_EXAMPLE_UIP_DHCPC + addr.s_addr = 0; +#else + addr.s_addr = HTONL(CONFIG_EXAMPLE_UIP_IPADDR); +#endif + uip_sethostaddr("eth0", &addr); + + /* Set up the default router address */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_UIP_DRIPADDR); + uip_setdraddr("eth0", &addr); + + /* Setup the subnet mask */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_UIP_NETMASK); + uip_setnetmask("eth0", &addr); + +#ifdef CONFIG_EXAMPLE_UIP_DHCPC + /* Set up the resolver */ + + resolv_init(); + + /* Get the MAC address of the NIC */ + + uip_getmacaddr("eth0", mac); + + /* Set up the DHCPC modules */ + + handle = dhcpc_open(&mac, IFHWADDRLEN); + + /* Get an IP address. Note: there is no logic here for renewing the address in this + * example. The address should be renewed in ds.lease_time/2 seconds. + */ + + printf("Getting IP address\n"); + if (handle) + { + struct dhcpc_state ds; + (void)dhcpc_request(handle, &ds); + uip_sethostaddr("eth1", &ds.ipaddr); + if (ds.netmask.s_addr != 0) + { + uip_setnetmask("eth0", &ds.netmask); + } + if (ds.default_router.s_addr != 0) + { + uip_setdraddr("eth0", &ds.default_router); + } + if (ds.dnsaddr.s_addr != 0) + { + resolv_conf(&ds.dnsaddr); + } + dhcpc_close(handle); + printf("IP: %s\n", inet_ntoa(ds.ipaddr)); + } +#endif + +#ifdef CONFIG_NET_TCP + printf("Starting webserver\n"); + httpd_init(); + httpd_listen(); +#endif + + while(1) + { + sleep(3); + printf("main: Still running\n"); +#if CONFIG_NFILE_DESCRIPTORS > 0 + fflush(stdout); +#endif + } + return 0; +} diff --git a/apps/examples/usbserial/Makefile b/apps/examples/usbserial/Makefile new file mode 100644 index 0000000000..35c76ba896 --- /dev/null +++ b/apps/examples/usbserial/Makefile @@ -0,0 +1,95 @@ +############################################################################ +# apps/examples/usbserial/Makefile +# +# Copyright (C) 2008, 2010-2010 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# USB serial device example + +ASRCS = +CSRCS = main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + @$(MAKE) -f Makefile.host clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep + diff --git a/apps/examples/usbserial/Makefile.host b/apps/examples/usbserial/Makefile.host new file mode 100644 index 0000000000..cd9319ab37 --- /dev/null +++ b/apps/examples/usbserial/Makefile.host @@ -0,0 +1,67 @@ +############################################################################ +# apps/examples/usbserial/Makefile.host +# +# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# TOPDIR must be defined on the make command line + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs + +SRC = host.c +BIN = host$(EXEEXT) + +DEFINES = +ifeq ($(CONFIG_EXAMPLES_USBSERIAL_INONLY),y) +DEFINES += -DCONFIG_EXAMPLES_USBSERIAL_INONLY=1 +endif +ifeq ($(CONFIG_EXAMPLES_USBSERIAL_OUTONLY),y) +DEFINES += -DCONFIG_EXAMPLES_USBSERIAL_OUTONLY=1 +endif +ifeq ($(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL),y) +DEFINES += -DCONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=1 +endif +ifeq ($(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG),y) +DEFINES += -DCONFIG_EXAMPLES_USBSERIAL_ONLYBIG=1 +endif + +all: $(BIN) + +$(BIN): $(SRC) + @$(HOSTCC) $(HOSTCFLAGS) $(DEFINES) $^ -o $@ + +clean: + @rm -f $(BIN) *~ .*.swp *.o + $(call CLEAN) + + diff --git a/apps/examples/usbserial/host.c b/apps/examples/usbserial/host.c new file mode 100644 index 0000000000..751b7530c6 --- /dev/null +++ b/apps/examples/usbserial/host.c @@ -0,0 +1,293 @@ +/**************************************************************************** + * examples/usbserial/host.c + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#if defined(CONFIG_EXAMPLES_USBSERIAL_INONLY) && defined(CONFIG_EXAMPLES_USBSERIAL_OUTONLY) +# error "Cannot define both CONFIG_EXAMPLES_USBSERIAL_INONLY and _OUTONLY" +#endif +#if defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL) && defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) +# error "Cannot define both CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL and _ONLYBIG" +#endif + +#if !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) && !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL) +# ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY +# define COUNTER_NEEDED 1 +# endif +#endif + +#define DEFAULT_TTYDEV "/dev/ttyUSB0" +#define BUFFER_SIZE 1024 + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const char *g_ttydev = DEFAULT_TTYDEV; + +#ifndef CONFIG_EXAMPLES_USBSERIAL_ONLYBIG +static const char g_shortmsg[] = "Sure... You betcha!!\n"; +#endif + +#ifndef CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL +static const char g_longmsg[] = + "I am proud to come to this city as the guest of your distinguished Mayor, " + "who has symbolized throughout the world the fighting spirit of West Berlin. " + "And I am proud to visit the Federal Republic with your distinguished Chancellor " + "who for so many years has committed Germany to democracy and freedom and " + "progress, and to come here in the company of my fellow American, General Clay, " + "who has been in this city during its great moments of crisis and will come " + "again if ever needed.\n" + "Two thousand years ago the proudest boast was \"civis Romanus sum.\" Today, " + "in the world of freedom, the proudest boast is \"Ich bin ein Berliner.\"\r\"" + "I appreciate my interpreter translating my German!\n" + "There are many people in the world who really don't understand, or say they " + "don't, what is the great issue between the free world and the Communist world. " + "Let them come to Berlin. There are some who say that communism is the wave of " + "the future. Let them come to Berlin. And there are some who say in Europe and " + "elsewhere we can work with the Communists. Let them come to Berlin. And there " + "are even a few who say that it is true that communism is an evil system, but it " + "permits us to make economic progress. Lass' sie nach Berlin kommen. Let them " + "come to Berlin.\n" + "Freedom has many difficulties and democracy is not perfect, but we have never " + "had to put a wall up to keep our people in, to prevent them from leaving us. I " + "want to say, on behalf of my countrymen, who live many miles away on the other " + "side of the Atlantic, who are far distant from you, that they take the greatest " + "pride that they have been able to share with you, even from a distance, the " + "story of the last 18 years. I know of no town, no city, that has been besieged " + "for 18 years that still lives with the vitality and the force, and the hope and " + "the determination of the city of West Berlin. While the wall is the most obvious " + "and vivid demonstration of the failures of the Communist system, for all the " + "world to see, we take no satisfaction in it, for it is, as your Mayor has said, " + "an offense not only against history but an offense against humanity, separating " + "families, dividing husbands and wives and brothers and sisters, and dividing a " + "people who wish to be joined together.\n" + "What is true of this city is true of Germany--real, lasting peace in Europe can " + "never be assured as long as one German out of four is denied the elementary " + "right of free men, and that is to make a free choice. In 18 years of peace and " + "good faith, this generation of Germans has earned the right to be free, " + "including the right to unite their families and their nation in lasting peace, " + "with good will to all people. You live in a defended island of freedom, but " + "your life is part of the main. So let me ask you as I close, to lift your eyes " + "beyond the dangers of today, to the hopes of tomorrow, beyond the freedom merely " + "of this city of Berlin, or your country of Germany, to the advance of freedom " + "everywhere, beyond the wall to the day of peace with justice, beyond yourselves " + "and ourselves to all mankind.\n" + "Freedom is indivisible, and when one man is enslaved, all are not free. When all " + "are free, then we can look forward to that day when this city will be joined as " + "one and this country and this great Continent of Europe in a peaceful and hopeful " + "globe. When that day finally comes, as it will, the people of West Berlin can take " + "sober satisfaction in the fact that they were in the front lines for almost two " + "decades.\n" + "All free men, wherever they may live, are citizens of Berlin, and, therefore, " + "as a free man, I take pride in the words \"Ich bin ein Berliner.\"\n" + "President John F. Kennedy - June 26, 1963\n"; +#endif + +#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY +static char g_iobuffer[BUFFER_SIZE]; +#endif + +/**************************************************************************** + * show_usage + ****************************************************************************/ + +static void show_usage(const char *progname, int exitcode) +{ + fprintf(stderr, "USAGE: %s []\n", progname); + exit(exitcode); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * main + ****************************************************************************/ + +int main(int argc, char **argv, char **envp) +{ + struct termios tty; +#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY + ssize_t nbytes; +#endif +#ifdef COUNTER_NEEDED + int count = 0; +#endif + int fd; + int ret; + + /* Handle input parameters */ + + if (argc > 1) + { + if (argc > 2) + { + fprintf(stderr, "Too many arguments on command line\n"); + show_usage(argv[0], 1); + } + g_ttydev = argv[1]; + } + + /* Open the USB serial device for blocking read/write */ + + do + { + printf("main: Opening USB serial driver\n"); + fd = open(g_ttydev, O_RDWR); + if (fd < 0) + { + printf("main: ERROR: Failed to open %s: %s\n", g_ttydev, strerror(errno)); + printf("main: Assume not connected. Wait and try again.\n"); + printf("main: (Control-C to terminate).\n"); + sleep(5); + } + } + while (fd < 0); + printf("main: Successfully opened the serial driver\n"); + + /* Configure the serial port in raw mode (at least turn off echo) */ + + ret = tcgetattr(fd, &tty); + if (ret < 0) + { + printf("main: ERROR: Failed to get termios for %s: %s\n", g_ttydev, strerror(errno)); + close(fd); + return 1; + } + + tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); + tty.c_oflag &= ~OPOST; + tty.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); + tty.c_cflag &= ~(CSIZE|PARENB); + tty.c_cflag |= CS8; + + ret = tcsetattr(fd, TCSANOW, &tty); + if (ret < 0) + { + printf("main: ERROR: Failed to set termios for %s: %s\n", g_ttydev, strerror(errno)); + close(fd); + return 1; + } + + /* Wait for and/or send messages -- forever */ + + for (;;) + { + /* Test IN messages (device-to-host) */ + +#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY + printf("main: Reading from the serial driver\n"); + printf("main: ... (Control-C to terminate) ...\n"); + nbytes = read(fd, g_iobuffer, BUFFER_SIZE-1); + if (nbytes < 0) + { + printf("main: ERROR: Failed to read from %s: %s\n", g_ttydev, strerror(errno)); + close(fd); + return 2; + } + else if (nbytes == 0) + { + printf("main: End-of-file encountered\n"); + break; + } + + g_iobuffer[nbytes] = '\0'; + printf("main: Received %d bytes:\n", nbytes); + printf(" \"%s\"\n", g_iobuffer); +#else + printf("main: Waiting...\n"); + sleep(5); +#endif /* CONFIG_EXAMPLES_USBSERIAL_OUTONLY */ + + /* Test OUT messages (host-to-device) */ + +#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY +#if !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL) && !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) + count++; + if (count < 5) + { + printf("main: Sending %d bytes..\n", sizeof(g_shortmsg)); + nbytes = write(fd, g_shortmsg, sizeof(g_shortmsg)); + } + else + { + printf("main: Sending %d bytes..\n", sizeof(g_longmsg)); + nbytes = write(fd, g_longmsg, sizeof(g_longmsg)); + count = 0; + } +#elif !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL) + printf("main: Sending %d bytes..\n", sizeof(g_longmsg)); + nbytes = write(fd, g_longmsg, sizeof(g_longmsg)); +#else /* !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) */ + printf("main: Sending %d bytes..\n", sizeof(g_shortmsg)); + nbytes = write(fd, g_shortmsg, sizeof(g_shortmsg)); +#endif + + /* Test if write was successful */ + + if (nbytes < 0) + { + printf("main: ERROR: Failed to write to %s: %s\n", g_ttydev, strerror(errno)); + close(fd); + return 2; + } + printf("main: %d bytes sent\n", nbytes); +#endif /* CONFIG_EXAMPLES_USBSERIAL_INONLY */ + } + + close(fd); + return 0; +} + diff --git a/apps/examples/usbserial/main.c b/apps/examples/usbserial/main.c new file mode 100644 index 0000000000..d7bc4c56ab --- /dev/null +++ b/apps/examples/usbserial/main.c @@ -0,0 +1,461 @@ +/**************************************************************************** + * examples/usbserial/main.c + * + * Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#ifdef CONFIG_CDCSER +# include +#endif + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#if defined(CONFIG_EXAMPLES_USBSERIAL_INONLY) && defined(CONFIG_EXAMPLES_USBSERIAL_OUTONLY) +# error "Cannot define both CONFIG_EXAMPLES_USBSERIAL_INONLY and _OUTONLY" +#endif +#if defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL) && defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) +# error "Cannot define both CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL and _ONLYBIG" +#endif + +#if !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) && !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL) +# ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY +# define COUNTER_NEEDED 1 +# endif +#endif +#ifdef CONFIG_EXAMPLES_USBSERIAL_TRACEINIT +# define TRACE_INIT_BITS (TRACE_INIT_BIT) +#else +# define TRACE_INIT_BITS (0) +#endif + +#define TRACE_ERROR_BITS (TRACE_DEVERROR_BIT|TRACE_CLSERROR_BIT) + +#ifdef CONFIG_EXAMPLES_USBSERIAL_TRACECLASS +# define TRACE_CLASS_BITS (TRACE_CLASS_BIT|TRACE_CLASSAPI_BIT|TRACE_CLASSSTATE_BIT) +#else +# define TRACE_CLASS_BITS (0) +#endif + +#ifdef CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS +# define TRACE_TRANSFER_BITS (TRACE_OUTREQQUEUED_BIT|TRACE_INREQQUEUED_BIT|TRACE_READ_BIT|\ + TRACE_WRITE_BIT|TRACE_COMPLETE_BIT) +#else +# define TRACE_TRANSFER_BITS (0) +#endif + +#ifdef CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER +# define TRACE_CONTROLLER_BITS (TRACE_EP_BIT|TRACE_DEV_BIT) +#else +# define TRACE_CONTROLLER_BITS (0) +#endif + +#ifdef CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS +# define TRACE_INTERRUPT_BITS (TRACE_INTENTRY_BIT|TRACE_INTDECODE_BIT|TRACE_INTEXIT_BIT) +#else +# define TRACE_INTERRUPT_BITS (0) +#endif + +#define TRACE_BITSET (TRACE_INIT_BITS|TRACE_ERROR_BITS|TRACE_CLASS_BITS|\ + TRACE_TRANSFER_BITS|TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS) + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_DEBUG +# define message(...) lib_lowprintf(__VA_ARGS__) +# define trmessage lib_lowprintf +# else +# define message(...) printf(__VA_ARGS__) +# define trmessage printf +# endif +#else +# ifdef CONFIG_DEBUG +# define message lib_lowprintf +# define trmessage lib_lowprintf +# else +# define message printf +# define trmessage printf +# endif +#endif + +#define IOBUFFER_SIZE 256 + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +#ifndef CONFIG_EXAMPLES_USBSERIAL_ONLYBIG +static const char g_shortmsg[] = "Hello, World!!\n"; +#endif + +#ifndef CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL +static const char g_longmsg[] = + "The Spanish Armada a Speech by Queen Elizabeth I of England\n" + "Addressed to the English army at Tilbury Fort - 1588\n" + "My loving people, we have been persuaded by some, that are careful of our " + "safety, to take heed how we commit ourselves to armed multitudes, for fear " + "of treachery; but I assure you, I do not desire to live to distrust my " + "faithful and loving people.\n" + "Let tyrants fear; I have always so behaved myself that, under God, I have " + "placed my chiefest strength and safeguard in the loyal hearts and good will " + "of my subjects. And therefore I am come amongst you at this time, not as for " + "my recreation or sport, but being resolved, in the midst and heat of the " + "battle, to live or die amongst you all; to lay down, for my God, and for " + "my kingdom, and for my people, my honour and my blood, even the dust.\n" + "I know I have but the body of a weak and feeble woman; but I have the heart " + "of a king, and of a king of England, too; and think foul scorn that Parma " + "or Spain, or any prince of Europe, should dare to invade the borders of my " + "realms: to which, rather than any dishonour should grow by me, I myself will " + "take up arms; I myself will be your general, judge, and rewarder of every " + "one of your virtues in the field.\n" + "I know already, by your forwardness, that you have deserved rewards and " + "crowns; and we do assure you, on the word of a prince, they shall be duly " + "paid you. In the mean my lieutenant general shall be in my stead, than whom " + "never prince commanded a more noble and worthy subject; not doubting by " + "your obedience to my general, by your concord in the camp, and by your " + "valour in the field, we shall shortly have a famous victory over the enemies " + "of my God, of my kingdom, and of my people.\n"; +#endif + +#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY +static char g_iobuffer[IOBUFFER_SIZE]; +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +#ifdef CONFIG_USBDEV_TRACE +static int trace_callback(struct usbtrace_s *trace, void *arg) +{ + usbtrace_trprintf((trprintf_t)trmessage, trace->event, trace->value); + return 0; +} + +static void dumptrace(void) +{ + (void)usbtrace_enumerate(trace_callback, NULL); +} +#else +# define dumptrace() +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ +#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY + int infd; +#endif +#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY + int outfd; +#endif +#ifdef COUNTER_NEEDED + int count = 0; +#endif + ssize_t nbytes; +#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY + int i, j, k; +#endif + int ret; + + /* Initialize the USB serial driver */ + + message("user_start: Registering USB serial driver\n"); +#ifdef CONFIG_CDCSER + ret = cdcser_initialize(0); +#else + ret = usbdev_serialinitialize(0); +#endif + if (ret < 0) + { + message("user_start: ERROR: Failed to create the USB serial device: %d\n", -ret); + return 1; + } + message("user_start: Successfully registered the serial driver\n"); + +#if CONFIG_USBDEV_TRACE && CONFIG_USBDEV_TRACE_INITIALIDSET != 0 + /* If USB tracing is enabled and tracing of initial USB events is specified, + * then dump all collected trace data to stdout + */ + + sleep(5); + dumptrace(); +#endif + + /* Then, in any event, configure trace data collection as configured */ + + usbtrace_enable(TRACE_BITSET); + + /* Open the USB serial device for writing (blocking) */ + +#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY + do + { + message("user_start: Opening USB serial driver\n"); + outfd = open("/dev/ttyUSB0", O_WRONLY); + if (outfd < 0) + { + int errcode = errno; + message("user_start: ERROR: Failed to open /dev/ttyUSB0 for writing: %d\n", errcode); + + /* ENOTCONN means that the USB device is not yet connected */ + + if (errcode == ENOTCONN) + { + message("user_start: Not connected. Wait and try again.\n"); + sleep(5); + } + else + { + /* Give up on other errors */ + + message("user_start: Aborting\n"); + return 2; + } + } + + /* If USB tracing is enabled, then dump all collected trace data to stdout */ + + dumptrace(); + } + while (outfd < 0); +#endif + + /* Open the USB serial device for reading (non-blocking) */ + +#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY +#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY + infd = open("/dev/ttyUSB0", O_RDONLY|O_NONBLOCK); + if (infd < 0) + { + message("user_start: ERROR: Failed to open /dev/ttyUSB0 for reading: %d\n", errno); + close(outfd); + return 3; + } +#else + do + { + infd = open("/dev/ttyUSB0", O_RDONLY|O_NONBLOCK); + if (infd < 0) + { + int errcode = errno; + message("user_start: ERROR: Failed to open /dev/ttyUSB0 for reading: %d\n", errno); + + /* ENOTCONN means that the USB device is not yet connected */ + + if (errcode == ENOTCONN) + { + message("user_start: Not connected. Wait and try again.\n"); + sleep(5); + } + else + { + /* Give up on other errors */ + + message("user_start: Aborting\n"); + return 3; + } + } + + /* If USB tracing is enabled, then dump all collected trace data to stdout */ + + dumptrace(); + } + while (infd < 0); +#endif +#endif + + message("user_start: Successfully opened the serial driver\n"); + + /* Send messages and get responses -- forever */ + + for (;;) + { + /* Test IN (device-to-host) messages */ + +#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY +#if !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) && !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL) + if (count < 8) + { + message("user_start: Saying hello\n"); + nbytes = write(outfd, g_shortmsg, sizeof(g_shortmsg)); + count++; + } + else + { + message("user_start: Reciting QEI's speech of 1588\n"); + nbytes = write(outfd, g_longmsg, sizeof(g_longmsg)); + count = 0; + } +#elif !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL) + message("user_start: Reciting QEI's speech of 1588\n"); + nbytes = write(outfd, g_longmsg, sizeof(g_longmsg)); +#else /* !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) */ + message("user_start: Saying hello\n"); + nbytes = write(outfd, g_shortmsg, sizeof(g_shortmsg)); +#endif + + /* Test if the write was successful */ + + if (nbytes < 0) + { + message("user_start: ERROR: write failed: %d\n", errno); +#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY + close(infd); +#endif + close(outfd); + return 4; + } + message("user_start: %d bytes sent\n", nbytes); +#endif /* CONFIG_EXAMPLES_USBSERIAL_OUTONLY */ + + /* Test OUT (host-to-device) messages */ + +#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY + /* Poll for incoming messages */ + + message("user_start: Polling for OUT messages\n"); + for (i = 0; i < 5; i++) + { + memset(g_iobuffer, 'X', IOBUFFER_SIZE); + nbytes = read(infd, g_iobuffer, IOBUFFER_SIZE); + if (nbytes < 0) + { + int errorcode = errno; + if (errorcode != EAGAIN) + { + message("user_start: ERROR: read failed: %d\n", errno); + close(infd); +#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY + close(outfd); +#endif + return 6; + } + } + else + { + message("user_start: Received %d bytes:\n", nbytes); + if (nbytes > 0) + { + for (j = 0; j < nbytes; j += 16) + { + message("user_start: %03x: ", j); + for (k = 0; k < 16; k++) + { + if (k == 8) + { + message(" "); + } + if (j+k < nbytes) + { + message("%02x", g_iobuffer[j+k]); + } + else + { + message(" "); + } + } + message(" "); + for (k = 0; k < 16; k++) + { + if (k == 8) + { + message(" "); + } + if (j+k < nbytes) + { + if (g_iobuffer[j+k] >= 0x20 && g_iobuffer[j+k] < 0x7f) + { + message("%c", g_iobuffer[j+k]); + } + else + { + message("."); + } + } + else + { + message(" "); + } + } + message("\n"); + } + } + } + sleep(1); + } +#else /* CONFIG_EXAMPLES_USBSERIAL_INONLY */ + message("user_start: Waiting\n"); + sleep(5); +#endif /* CONFIG_EXAMPLES_USBSERIAL_INONLY */ + + /* If USB tracing is enabled, then dump all collected trace data to stdout */ + + dumptrace(); + } + + /* Won't get here, but if we did this what we would have to do */ + +#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY + close(infd); +#endif +#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY + close(outfd); +#endif + return 0; +} + diff --git a/apps/examples/usbstorage/Makefile b/apps/examples/usbstorage/Makefile new file mode 100644 index 0000000000..98181e0fd4 --- /dev/null +++ b/apps/examples/usbstorage/Makefile @@ -0,0 +1,111 @@ +############################################################################ +# apps/examples/usbstorage/Makefile +# +# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# USB device mass storage example + +ASRCS = +CSRCS = usbstrg_main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# USB storage built-in application info + +APPNAME1 = msconn +PRIORITY1 = SCHED_PRIORITY_DEFAULT +STACKSIZE1 = 2048 + +APPNAME2 = msdis +PRIORITY2 = SCHED_PRIORITY_DEFAULT +STACKSIZE2 = 2048 + +# Common build + +VPATH = + +all: .built +.PHONY: context clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +.context: +ifeq ($(CONFIG_EXAMPLES_USBSTRG_BUILTIN),y) + $(call REGISTER,$(APPNAME1),$(PRIORITY1),$(STACKSIZE1),$(APPNAME1)_main) + $(call REGISTER,$(APPNAME2),$(PRIORITY2),$(STACKSIZE2),$(APPNAME2)_main) + @touch $@ +endif + +context: .context + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep + diff --git a/apps/examples/usbstorage/usbstrg.h b/apps/examples/usbstorage/usbstrg.h new file mode 100644 index 0000000000..a179bc054e --- /dev/null +++ b/apps/examples/usbstorage/usbstrg.h @@ -0,0 +1,166 @@ +/**************************************************************************** + * examples/usbstorage/usbstrg.h + * + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __EXAMPLES_USBSTORAGE_USBSTRG_H +#define __EXAMPLES_USBSTORAGE_USBSTRG_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ + +#ifndef CONFIG_EXAMPLES_USBSTRG_NLUNS +# define CONFIG_EXAMPLES_USBSTRG_NLUNS 1 +#endif + +#ifndef CONFIG_EXAMPLES_USBSTRG_DEVMINOR1 +# define CONFIG_EXAMPLES_USBSTRG_DEVMINOR1 0 +#endif + +#ifndef CONFIG_EXAMPLES_USBSTRG_DEVPATH1 +# define CONFIG_EXAMPLES_USBSTRG_DEVPATH1 "/dev/mmcsd0" +#endif + +#if CONFIG_EXAMPLES_USBSTRG_NLUNS > 1 +# ifndef CONFIG_EXAMPLES_USBSTRG_DEVMINOR2 +# error "CONFIG_EXAMPLES_USBSTRG_DEVMINOR2 for LUN=2" +# endif +# ifndef CONFIG_EXAMPLES_USBSTRG_DEVPATH2 +# error "CONFIG_EXAMPLES_USBSTRG_DEVPATH2 for LUN=2" +# endif +# if CONFIG_EXAMPLES_USBSTRG_NLUNS > 2 +# ifndef CONFIG_EXAMPLES_USBSTRG_DEVMINOR3 +# error "CONFIG_EXAMPLES_USBSTRG_DEVMINOR2 for LUN=3" +# endif +# ifndef CONFIG_EXAMPLES_USBSTRG_DEVPATH2 +# error "CONFIG_EXAMPLES_USBSTRG_DEVPATH2 for LUN=3" +# endif +# if CONFIG_EXAMPLES_USBSTRG_NLUNS > 3 +# error "CONFIG_EXAMPLES_USBSTRG_NLUNS must be {1,2,3}" +# endif +# endif +#endif + +/* Debug ********************************************************************/ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_DEBUG +# define message(...) lib_lowprintf(__VA_ARGS__) +# define msgflush() +# else +# define message(...) printf(__VA_ARGS__) +# define msgflush() fflush(stdout) +# endif +#else +# ifdef CONFIG_DEBUG +# define message lib_lowprintf +# define msgflush() +# else +# define message printf +# define msgflush() fflush(stdout) +# endif +#endif + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* All global variables used by this example are packed into a structure in + * order to avoid name collisions. + */ + +#if defined(CONFIG_EXAMPLES_USBSTRG_BUILTIN) || defined(CONFIG_EXAMPLES_USBSTRG_DEBUGMM) +struct usbstrg_state_s +{ + /* This is the handle that references to this particular USB storage driver + * instance. It is only needed if the USB mass storage device example is + * built using CONFIG_EXAMPLES_USBSTRG_BUILTIN. In this case, the value + * of the driver handle must be remembered between the 'msconn' and 'msdis' + * commands. + */ + +#ifdef CONFIG_EXAMPLES_USBSTRG_BUILTIN + FAR void *mshandle; +#endif + + /* Heap usage samples. These are useful for checking USB storage memory + * usage and for tracking down memoryh leaks. + */ + +#ifdef CONFIG_EXAMPLES_USBSTRG_DEBUGMM + struct mallinfo mmstart; /* Memory usage before the connection */ + struct mallinfo mmprevious; /* The last memory usage sample */ + struct mallinfo mmcurrent; /* The current memory usage sample */ +#endif +}; +#endif + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* All global variables used by this example are packed into a structure in + * order to avoid name collisions. + */ + +#if defined(CONFIG_EXAMPLES_USBSTRG_BUILTIN) || defined(CONFIG_EXAMPLES_USBSTRG_DEBUGMM) +extern struct usbstrg_state_s g_usbstrg; +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: usbstrg_archinitialize + * + * Description: + * Perform architecture specific initialization. This function must + * configure the block device to export via USB. This function must be + * provided by architecture-specific logic in order to use this example. + * + ****************************************************************************/ + +extern int usbstrg_archinitialize(void); + +#endif /* __EXAMPLES_USBSTORAGE_USBSTRG_H */ diff --git a/apps/examples/usbstorage/usbstrg_main.c b/apps/examples/usbstorage/usbstrg_main.c new file mode 100644 index 0000000000..884a5929aa --- /dev/null +++ b/apps/examples/usbstorage/usbstrg_main.c @@ -0,0 +1,596 @@ +/**************************************************************************** + * examples/usbstorage/usbstrg_main.c + * + * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include "usbstrg.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_USBSTRG_TRACEINIT +# define TRACE_INIT_BITS (TRACE_INIT_BIT) +#else +# define TRACE_INIT_BITS (0) +#endif + +#define TRACE_ERROR_BITS (TRACE_DEVERROR_BIT|TRACE_CLSERROR_BIT) + +#ifdef CONFIG_EXAMPLES_USBSTRG_TRACECLASS +# define TRACE_CLASS_BITS (TRACE_CLASS_BIT|TRACE_CLASSAPI_BIT|TRACE_CLASSSTATE_BIT) +#else +# define TRACE_CLASS_BITS (0) +#endif + +#ifdef CONFIG_EXAMPLES_USBSTRG_TRACETRANSFERS +# define TRACE_TRANSFER_BITS (TRACE_OUTREQQUEUED_BIT|TRACE_INREQQUEUED_BIT|TRACE_READ_BIT|\ + TRACE_WRITE_BIT|TRACE_COMPLETE_BIT) +#else +# define TRACE_TRANSFER_BITS (0) +#endif + +#ifdef CONFIG_EXAMPLES_USBSTRG_TRACECONTROLLER +# define TRACE_CONTROLLER_BITS (TRACE_EP_BIT|TRACE_DEV_BIT) +#else +# define TRACE_CONTROLLER_BITS (0) +#endif + +#ifdef CONFIG_EXAMPLES_USBSTRG_TRACEINTERRUPTS +# define TRACE_INTERRUPT_BITS (TRACE_INTENTRY_BIT|TRACE_INTDECODE_BIT|TRACE_INTEXIT_BIT) +#else +# define TRACE_INTERRUPT_BITS (0) +#endif + +#define TRACE_BITSET (TRACE_INIT_BITS|TRACE_ERROR_BITS|TRACE_CLASS_BITS|\ + TRACE_TRANSFER_BITS|TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS) + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* All global variables used by this example are packed into a structure in + * order to avoid name collisions. + */ + +#if defined(CONFIG_EXAMPLES_USBSTRG_BUILTIN) || defined(CONFIG_EXAMPLES_USBSTRG_DEBUGMM) +struct usbstrg_state_s g_usbstrg; +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: show_memory_usage + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_USBSTRG_DEBUGMM +static void show_memory_usage(struct mallinfo *mmbefore, + struct mallinfo *mmafter) +{ + int diff; + + message(" total used free largest\n"); + message("Before:%11d%11d%11d%11d\n", + mmbefore->arena, mmbefore->uordblks, mmbefore->fordblks, mmbefore->mxordblk); + message("After: %11d%11d%11d%11d\n", + mmafter->arena, mmafter->uordblks, mmafter->fordblks, mmafter->mxordblk); + + diff = mmbefore->uordblks - mmafter->uordblks; + if (diff < 0) + { + message("Change:%11d allocated\n", -diff); + } + else if (diff > 0) + { + message("Change:%11d freed\n", diff); + } +} +#else +# define show_memory_usage(mm1, mm2) +#endif + +/**************************************************************************** + * Name: check_test_memory_usage + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_USBSTRG_DEBUGMM +static void check_test_memory_usage(FAR const char *msg) +{ + /* Get the current memory usage */ + +#ifdef CONFIG_CAN_PASS_STRUCTS + g_usbstrg.mmcurrent = mallinfo(); +#else + (void)mallinfo(&g_usbstrg.mmcurrent); +#endif + + /* Show the change from the previous time */ + + message("\%s:\n", msg); + show_memory_usage(&g_usbstrg.mmprevious, &g_usbstrg.mmcurrent); + + /* Set up for the next test */ + +#ifdef CONFIG_CAN_PASS_STRUCTS + g_usbstrg.mmprevious = g_usbstrg.mmcurrent; +#else + memcpy(&g_usbstrg.mmprevious, &g_usbstrg.mmcurrent, sizeof(struct mallinfo)); +#endif +} +#else +# define check_test_memory_usage(msg) +#endif + +/**************************************************************************** + * Name: check_test_memory_usage + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_USBSTRG_DEBUGMM +static void final_memory_usage(FAR const char *msg) +{ + /* Get the current memory usage */ + +#ifdef CONFIG_CAN_PASS_STRUCTS + g_usbstrg.mmcurrent = mallinfo(); +#else + (void)mallinfo(&g_usbstrg.mmcurrent); +#endif + + /* Show the change from the previous time */ + + message("\n%s:\n", msg); + show_memory_usage(&g_usbstrg.mmstart, &g_usbstrg.mmcurrent); +} +#else +# define final_memory_usage(msg) +#endif + +/**************************************************************************** + * Name: usbstrg_enumerate + ****************************************************************************/ + +#ifdef CONFIG_USBDEV_TRACE +static int usbstrg_enumerate(struct usbtrace_s *trace, void *arg) +{ + switch (trace->event) + { + case TRACE_DEVINIT: + message("USB controller initialization: %04x\n", trace->value); + break; + + case TRACE_DEVUNINIT: + message("USB controller un-initialization: %04x\n", trace->value); + break; + + case TRACE_DEVREGISTER: + message("usbdev_register(): %04x\n", trace->value); + break; + + case TRACE_DEVUNREGISTER: + message("usbdev_unregister(): %04x\n", trace->value); + break; + + case TRACE_EPCONFIGURE: + message("Endpoint configure(): %04x\n", trace->value); + break; + + case TRACE_EPDISABLE: + message("Endpoint disable(): %04x\n", trace->value); + break; + + case TRACE_EPALLOCREQ: + message("Endpoint allocreq(): %04x\n", trace->value); + break; + + case TRACE_EPFREEREQ: + message("Endpoint freereq(): %04x\n", trace->value); + break; + + case TRACE_EPALLOCBUFFER: + message("Endpoint allocbuffer(): %04x\n", trace->value); + break; + + case TRACE_EPFREEBUFFER: + message("Endpoint freebuffer(): %04x\n", trace->value); + break; + + case TRACE_EPSUBMIT: + message("Endpoint submit(): %04x\n", trace->value); + break; + + case TRACE_EPCANCEL: + message("Endpoint cancel(): %04x\n", trace->value); + break; + + case TRACE_EPSTALL: + message("Endpoint stall(true): %04x\n", trace->value); + break; + + case TRACE_EPRESUME: + message("Endpoint stall(false): %04x\n", trace->value); + break; + + case TRACE_DEVALLOCEP: + message("Device allocep(): %04x\n", trace->value); + break; + + case TRACE_DEVFREEEP: + message("Device freeep(): %04x\n", trace->value); + break; + + case TRACE_DEVGETFRAME: + message("Device getframe(): %04x\n", trace->value); + break; + + case TRACE_DEVWAKEUP: + message("Device wakeup(): %04x\n", trace->value); + break; + + case TRACE_DEVSELFPOWERED: + message("Device selfpowered(): %04x\n", trace->value); + break; + + case TRACE_DEVPULLUP: + message("Device pullup(): %04x\n", trace->value); + break; + + case TRACE_CLASSBIND: + message("Class bind(): %04x\n", trace->value); + break; + + case TRACE_CLASSUNBIND: + message("Class unbind(): %04x\n", trace->value); + break; + + case TRACE_CLASSDISCONNECT: + message("Class disconnect(): %04x\n", trace->value); + break; + + case TRACE_CLASSSETUP: + message("Class setup(): %04x\n", trace->value); + break; + + case TRACE_CLASSSUSPEND: + message("Class suspend(): %04x\n", trace->value); + break; + + case TRACE_CLASSRESUME: + message("Class resume(): %04x\n", trace->value); + break; + + case TRACE_CLASSRDCOMPLETE: + message("Class RD request complete: %04x\n", trace->value); + break; + + case TRACE_CLASSWRCOMPLETE: + message("Class WR request complete: %04x\n", trace->value); + break; + + default: + switch (TRACE_ID(trace->event)) + { + case TRACE_CLASSAPI_ID: /* Other class driver system API calls */ + message("Class API call %d: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_CLASSSTATE_ID: /* Track class driver state changes */ + message("Class state %d: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_INTENTRY_ID: /* Interrupt handler entry */ + message("Interrrupt %d entry: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_INTDECODE_ID: /* Decoded interrupt trace->event */ + message("Interrrupt decode %d: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_INTEXIT_ID: /* Interrupt handler exit */ + message("Interrrupt %d exit: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_OUTREQQUEUED_ID: /* Request queued for OUT endpoint */ + message("EP%d OUT request queued: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_INREQQUEUED_ID: /* Request queued for IN endpoint */ + message("EP%d IN request queued: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_READ_ID: /* Read (OUT) action */ + message("EP%d OUT read: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_WRITE_ID: /* Write (IN) action */ + message("EP%d IN write: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_COMPLETE_ID: /* Request completed */ + message("EP%d request complete: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_DEVERROR_ID: /* USB controller driver error event */ + message("Controller error: %02x:%04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_CLSERROR_ID: /* USB class driver error event */ + message("Class error: %02x:%04x\n", TRACE_DATA(trace->event), trace->value); + break; + + default: + message("Unrecognized event: %02x:%02x:%04x\n", + TRACE_ID(trace->event) >> 8, TRACE_DATA(trace->event), trace->value); + break; + } + } + return OK; +} +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * user_start/msconn_main + * + * Description: + * This is the main program that configures the USB mass storage device + * and exports the LUN(s). If CONFIG_EXAMPLES_USBSTRG_BUILTIN is defined + * in the NuttX configuration, then this program can be executed by + * entering the "msconn" command at the NSH console. + * + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_USBSTRG_BUILTIN +# define MAIN_NAME msconn_main +# define MAIN_NAME_STRING "msconn" +#else +# define MAIN_NAME user_start +# define MAIN_NAME_STRING "user_start" +#endif + +int MAIN_NAME(int argc, char *argv[]) +{ + FAR void *handle; + int ret; + + /* If this program is implemented as the NSH 'msconn' command, then we need to + * do a little error checking to assure that we are not being called re-entrantly. + */ + +#ifdef CONFIG_EXAMPLES_USBSTRG_BUILTIN + + /* Check if there is a non-NULL USB mass storage device handle (meaning that the + * USB mass storage device is already configured). + */ + + if (g_usbstrg.mshandle) + { + message(MAIN_NAME_STRING ": ERROR: Already connected\n"); + return 1; + } +#endif + +#ifdef CONFIG_EXAMPLES_USBSTRG_DEBUGMM +# ifdef CONFIG_CAN_PASS_STRUCTS + g_usbstrg.mmstart = mallinfo(); + g_usbstrg.mmprevious = g_usbstrg.mmstart; +# else + (void)mallinfo(&g_usbstrg.mmstart); + memcpy(&g_usbstrg.mmprevious, &g_usbstrg.mmstart, sizeof(struct mallinfo)); +# endif +#endif + + /* Initialize USB trace output IDs */ + + usbtrace_enable(TRACE_BITSET); + check_test_memory_usage("After usbtrace_enable()"); + + /* Register block drivers (architecture-specific) */ + + message(MAIN_NAME_STRING ": Creating block drivers\n"); + ret = usbstrg_archinitialize(); + if (ret < 0) + { + message(MAIN_NAME_STRING ": usbstrg_archinitialize failed: %d\n", -ret); + return 2; + } + check_test_memory_usage("After usbstrg_archinitialize()"); + + /* Then exports the LUN(s) */ + + message(MAIN_NAME_STRING ": Configuring with NLUNS=%d\n", CONFIG_EXAMPLES_USBSTRG_NLUNS); + ret = usbstrg_configure(CONFIG_EXAMPLES_USBSTRG_NLUNS, &handle); + if (ret < 0) + { + message(MAIN_NAME_STRING ": usbstrg_configure failed: %d\n", -ret); + usbstrg_uninitialize(handle); + return 3; + } + message(MAIN_NAME_STRING ": handle=%p\n", handle); + check_test_memory_usage("After usbstrg_configure()"); + + message(MAIN_NAME_STRING ": Bind LUN=0 to %s\n", CONFIG_EXAMPLES_USBSTRG_DEVPATH1); + ret = usbstrg_bindlun(handle, CONFIG_EXAMPLES_USBSTRG_DEVPATH1, 0, 0, 0, false); + if (ret < 0) + { + message(MAIN_NAME_STRING ": usbstrg_bindlun failed for LUN 1 using %s: %d\n", + CONFIG_EXAMPLES_USBSTRG_DEVPATH1, -ret); + usbstrg_uninitialize(handle); + return 4; + } + check_test_memory_usage("After usbstrg_bindlun()"); + +#if CONFIG_EXAMPLES_USBSTRG_NLUNS > 1 + + message(MAIN_NAME_STRING ": Bind LUN=1 to %s\n", CONFIG_EXAMPLES_USBSTRG_DEVPATH2); + ret = usbstrg_bindlun(handle, CONFIG_EXAMPLES_USBSTRG_DEVPATH2, 1, 0, 0, false); + if (ret < 0) + { + message(MAIN_NAME_STRING ": usbstrg_bindlun failed for LUN 2 using %s: %d\n", + CONFIG_EXAMPLES_USBSTRG_DEVPATH2, -ret); + usbstrg_uninitialize(handle); + return 5; + } + check_test_memory_usage("After usbstrg_bindlun() #2"); + +#if CONFIG_EXAMPLES_USBSTRG_NLUNS > 2 + + message(MAIN_NAME_STRING ": Bind LUN=2 to %s\n", CONFIG_EXAMPLES_USBSTRG_DEVPATH3); + ret = usbstrg_bindlun(handle, CONFIG_EXAMPLES_USBSTRG_DEVPATH3, 2, 0, 0, false); + if (ret < 0) + { + message(MAIN_NAME_STRING ": usbstrg_bindlun failed for LUN 3 using %s: %d\n", + CONFIG_EXAMPLES_USBSTRG_DEVPATH3, -ret); + usbstrg_uninitialize(handle); + return 6; + } + check_test_memory_usage("After usbstrg_bindlun() #3"); + +#endif +#endif + + ret = usbstrg_exportluns(handle); + if (ret < 0) + { + message(MAIN_NAME_STRING ": usbstrg_exportluns failed: %d\n", -ret); + usbstrg_uninitialize(handle); + return 7; + } + check_test_memory_usage("After usbstrg_exportluns()"); + + /* It this program was configued as an NSH command, then just exit now. + * Also, if signals are not enabled (and, hence, sleep() is not supported. + * then we have not real option but to exit now. + */ + +#if !defined(CONFIG_EXAMPLES_USBSTRG_BUILTIN) && !defined(CONFIG_DISABLE_SIGNALS) + + /* Otherwise, this thread will hang around and monitor the USB storage activity */ + + for (;;) + { + msgflush(); + sleep(5); + +# ifdef CONFIG_USBDEV_TRACE + message("\nuser_start: USB TRACE DATA:\n"); + ret = usbtrace_enumerate(usbstrg_enumerate, NULL); + if (ret < 0) + { + message(MAIN_NAME_STRING ": usbtrace_enumerate failed: %d\n", -ret); + usbstrg_uninitialize(handle); + return 8; + } + check_test_memory_usage("After usbtrace_enumerate()"); +# else + message(MAIN_NAME_STRING ": Still alive\n"); +# endif + } +#elif defined(CONFIG_EXAMPLES_USBSTRG_BUILTIN) + + /* Return the USB mass storage device handle so it can be used by the 'misconn' + * command. + */ + + message(MAIN_NAME_STRING ": Connected\n"); + g_usbstrg.mshandle = handle; + check_test_memory_usage("After MS connection"); + +#else /* defined(CONFIG_DISABLE_SIGNALS) */ + + /* Just exit */ + + message(MAIN_NAME_STRING ": Exiting\n"); + + /* Dump debug memory usage */ + + final_memory_usage("Final memory usage"); +#endif + return 0; +} + +/**************************************************************************** + * msdis_main + * + * Description: + * This is a program entry point that will disconnet the USB mass storage + * device. This program is only available if CONFIG_EXAMPLES_USBSTRG_BUILTIN + * is defined in the NuttX configuration. In that case, this program can + * be executed by entering the "msdis" command at the NSH console. + * + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_USBSTRG_BUILTIN +int msdis_main(int argc, char *argv[]) +{ + /* First check if the USB mass storage device is already connected */ + + if (!g_usbstrg.mshandle) + { + message("msdis: ERROR: Not connected\n"); + return 1; + } + check_test_memory_usage("Since MS connection"); + + /* Then disconnect the device and uninitialize the USB mass storage driver */ + + usbstrg_uninitialize(g_usbstrg.mshandle); + g_usbstrg.mshandle = NULL; + message("msdis: Disconnected\n"); + check_test_memory_usage("After usbstrg_uninitialize()"); + + /* Dump debug memory usage */ + + final_memory_usage("Final memory usage"); + return 0; +} +#endif diff --git a/apps/examples/usbterm/Makefile b/apps/examples/usbterm/Makefile new file mode 100644 index 0000000000..fe9b77fb84 --- /dev/null +++ b/apps/examples/usbterm/Makefile @@ -0,0 +1,106 @@ +############################################################################ +# apps/examples/usbterm/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# USB terminal example + +ASRCS = +CSRCS = usbterm_main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Built-in application info + +APPNAME = usbterm +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +.context: +ifeq ($(CONFIG_EXAMPLES_UBSTERM_BUILTIN),y) + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + @touch $@ +endif + +context: .context + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep + diff --git a/apps/examples/usbterm/usbterm.h b/apps/examples/usbterm/usbterm.h new file mode 100644 index 0000000000..97ccf54055 --- /dev/null +++ b/apps/examples/usbterm/usbterm.h @@ -0,0 +1,148 @@ +/**************************************************************************** + * examples/usbterm/usbterm.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_EXAMPLES_USBTERM_USBTERM_H +#define __APPS_EXAMPLES_USBTERM_USBTERM_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ +/* Configuration ************************************************************/ + +#ifndef CONFIG_EXAMPLES_USBTERM_BUFLEN +# define CONFIG_EXAMPLES_USBTERM_BUFLEN 256 +#endif + +#ifdef CONFIG_EXAMPLES_USBTERM_TRACEINIT +# define TRACE_INIT_BITS (TRACE_INIT_BIT) +#else +# define TRACE_INIT_BITS (0) +#endif + +#define TRACE_ERROR_BITS (TRACE_DEVERROR_BIT|TRACE_CLSERROR_BIT) + +#ifdef CONFIG_EXAMPLES_USBTERM_TRACECLASS +# define TRACE_CLASS_BITS (TRACE_CLASS_BIT|TRACE_CLASSAPI_BIT|TRACE_CLASSSTATE_BIT) +#else +# define TRACE_CLASS_BITS (0) +#endif + +#ifdef CONFIG_EXAMPLES_USBTERM_TRACETRANSFERS +# define TRACE_TRANSFER_BITS (TRACE_OUTREQQUEUED_BIT|TRACE_INREQQUEUED_BIT|TRACE_READ_BIT|\ + TRACE_WRITE_BIT|TRACE_COMPLETE_BIT) +#else +# define TRACE_TRANSFER_BITS (0) +#endif + +#ifdef CONFIG_EXAMPLES_USBTERM_TRACECONTROLLER +# define TRACE_CONTROLLER_BITS (TRACE_EP_BIT|TRACE_DEV_BIT) +#else +# define TRACE_CONTROLLER_BITS (0) +#endif + +#ifdef CONFIG_EXAMPLES_USBTERM_TRACEINTERRUPTS +# define TRACE_INTERRUPT_BITS (TRACE_INTENTRY_BIT|TRACE_INTDECODE_BIT|TRACE_INTEXIT_BIT) +#else +# define TRACE_INTERRUPT_BITS (0) +#endif + +#define TRACE_BITSET (TRACE_INIT_BITS|TRACE_ERROR_BITS|TRACE_CLASS_BITS|\ + TRACE_TRANSFER_BITS|TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS) + +/* Debug ********************************************************************/ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_DEBUG +# define message(...) lib_rawprintf(__VA_ARGS__) +# define trmessage lib_rawprintf +# else +# define message(...) printf(__VA_ARGS__) +# define trmessage printf +# endif +#else +# ifdef CONFIG_DEBUG +# define message lib_lowprintf +# define trmessage lib_lowprintf +# else +# define message printf +# define trmessage printf +# endif +#endif + +#define IOBUFFER_SIZE 256 + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* All USB terminal state data is packaged in a single structure to minimize + * name conflicts with other global symbols -- a poor man's name space. + */ + +struct usbterm_globals_s +{ + FILE *instream; /* Stream for incoming USB data */ + FILE *outstream; /* Stream for outgoing USB data */ + pthread_t listener; /* USB terminal listener thread */ + + /* Buffers for incoming and outgoing data */ + + char inbuffer[CONFIG_EXAMPLES_USBTERM_BUFLEN]; + char outbuffer[CONFIG_EXAMPLES_USBTERM_BUFLEN]; +}; + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/* USB terminal state data */ + +extern struct usbterm_globals_s g_usbterm; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#endif /* __APPS_EXAMPLES_USBTERM_USBTERM_H */ diff --git a/apps/examples/usbterm/usbterm_main.c b/apps/examples/usbterm/usbterm_main.c new file mode 100644 index 0000000000..092fd7a6f3 --- /dev/null +++ b/apps/examples/usbterm/usbterm_main.c @@ -0,0 +1,315 @@ +/**************************************************************************** + * examples/usbterm/usbterm_main.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#ifdef CONFIG_CDCSER +# include +#endif + +#include "usbterm.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* USB terminal state data */ + +struct usbterm_globals_s g_usbterm; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: trace_callback + * + * Description: + * Callback from USB trace instrumentation. + * + ****************************************************************************/ + +#ifdef CONFIG_USBDEV_TRACE +static int trace_callback(struct usbtrace_s *trace, void *arg) +{ + usbtrace_trprintf((trprintf_t)trmessage, trace->event, trace->value); + return 0; +} +#endif + +/**************************************************************************** + * Name: dumptrace + * + * Description: + * Dump collected trace data. + * + ****************************************************************************/ + +#ifdef CONFIG_USBDEV_TRACE +static void dumptrace(void) +{ + (void)usbtrace_enumerate(trace_callback, NULL); +} +#else +# define dumptrace() +#endif + +/**************************************************************************** + * Name: dumptrace + * + * Description: + * Entry point for the listener thread. + * + ****************************************************************************/ + +FAR void *usbterm_listener(FAR void *parameter) +{ + message("usbterm_listener: Waiting for remote input\n"); + for (;;) + { + /* Display the prompt string on the remote USB serial connection */ + + fputs("\rusbterm> ", g_usbterm.outstream); + fflush(g_usbterm.outstream); + + /* Get the next line of input from the remote USB serial connection */ + + if (fgets(g_usbterm.inbuffer, CONFIG_EXAMPLES_USBTERM_BUFLEN, g_usbterm.instream)) + { + /* Echo the line on the local stdout */ + + fputs(g_usbterm.inbuffer, stdout); + + /* Display the prompt string on stdout */ + + fputs("usbterm> ", stdout); + fflush(stdout); + } + + /* If USB tracing is enabled, then dump all collected trace data to stdout */ + + dumptrace(); + } + + /* Won't get here */ + + return NULL; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: term_main/user_start + * + * Description: + * Main entry point for the USB serial terminal example. + * + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_USBTERM_BUILTIN +# define MAIN_NAME term_main +# define MAIN_STRING "usbterm_main: " +#else +# define MAIN_NAME user_start +# define MAIN_STRING "user_start: " +#endif + +int MAIN_NAME(int argc, char *argv[]) +{ + pthread_attr_t attr; + int ret; + + /* Initialize the USB serial driver */ + + message(MAIN_STRING "Registering USB serial driver\n"); +#ifdef CONFIG_CDCSER + ret = cdcser_initialize(0); +#else + ret = usbdev_serialinitialize(0); +#endif + if (ret < 0) + { + message(MAIN_STRING "ERROR: Failed to create the USB serial device: %d\n", -ret); + goto errout; + } + message(MAIN_STRING "Successfully registered the serial driver\n"); + +#if CONFIG_USBDEV_TRACE && CONFIG_USBDEV_TRACE_INITIALIDSET != 0 + /* If USB tracing is enabled and tracing of initial USB events is specified, + * then dump all collected trace data to stdout + */ + + sleep(5); + dumptrace(); +#endif + + /* Then, in any event, configure trace data collection as configured */ + + usbtrace_enable(TRACE_BITSET); + + /* Open the USB serial device for writing */ + + do + { + message(MAIN_STRING "Opening USB serial driver\n"); + + g_usbterm.outstream = fopen("/dev/ttyUSB0", "w"); + if (g_usbterm.outstream == NULL) + { + int errcode = errno; + message(MAIN_STRING "ERROR: Failed to open /dev/ttyUSB0 for writing: %d\n", + errcode); + + /* ENOTCONN means that the USB device is not yet connected */ + + if (errcode == ENOTCONN) + { + message(MAIN_STRING " Not connected. Wait and try again.\n"); + sleep(5); + } + else + { + /* Give up on other errors */ + + goto errout; + } + } + + /* If USB tracing is enabled, then dump all collected trace data to stdout */ + + dumptrace(); + } + while (g_usbterm.outstream == NULL); + + /* Open the USB serial device for reading. Since we are already connected, this + * should not fail. + */ + + g_usbterm.instream = fopen("/dev/ttyUSB0", "r"); + if (g_usbterm.instream == NULL) + { + message(MAIN_STRING "ERROR: Failed to open /dev/ttyUSB0 for reading: %d\n", errno); + goto errout_with_outstream; + } + + message(MAIN_STRING "Successfully opened the serial driver\n"); + + /* Start the USB term listener thread */ + + message(MAIN_STRING "Starting the listener thread\n"); + + ret = pthread_attr_init(&attr); + if (ret != OK) + { + message(MAIN_STRING "pthread_attr_init failed: %d\n", ret); + goto errout_with_streams; + } + + ret = pthread_create(&g_usbterm.listener, &attr, + usbterm_listener, (pthread_addr_t)0); + if (ret != 0) + { + message(MAIN_STRING "Error in thread creation: %d\n", ret); + goto errout_with_streams; + } + + /* Send messages and get responses -- forever */ + + message(MAIN_STRING "Waiting for local input\n"); + for (;;) + { + /* Display the prompt string on stdout */ + + fputs("usbterm> ", stdout); + fflush(stdout); + + /* Get the next line of input from stdin */ + + if (fgets(g_usbterm.outbuffer, CONFIG_EXAMPLES_USBTERM_BUFLEN, stdin)) + { + /* Send the line of input via USB */ + + fputs(g_usbterm.outbuffer, g_usbterm.outstream); + + /* Display the prompt string on the remote USB serial connection */ + + fputs("\rusbterm> ", g_usbterm.outstream); + fflush(g_usbterm.outstream); + } + + /* If USB tracing is enabled, then dump all collected trace data to stdout */ + + dumptrace(); + } + + /* Error exits */ + +errout_with_streams: + fclose(g_usbterm.instream); +errout_with_outstream: + fclose(g_usbterm.outstream); +errout: + message(MAIN_STRING " Aborting\n"); + return 1; +} + diff --git a/apps/examples/wget/Makefile b/apps/examples/wget/Makefile new file mode 100644 index 0000000000..4141cc8328 --- /dev/null +++ b/apps/examples/wget/Makefile @@ -0,0 +1,95 @@ +############################################################################ +# apps/examples/wget/Makefile +# +# Copyright (C) 2009-2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# wget webclient example + +ASRCS = +CSRCS = target.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + @$(MAKE) -f Makefile.host clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep + diff --git a/apps/examples/wget/Makefile.host b/apps/examples/wget/Makefile.host new file mode 100644 index 0000000000..fd891afec5 --- /dev/null +++ b/apps/examples/wget/Makefile.host @@ -0,0 +1,77 @@ +############################################################################ +# apps/examples/wget/Makefile.host +# +# Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +WD = ${shell pwd} +TOPDIR = $(WD)/../.. +-include $(TOPDIR)/Make.defs + +OBJS = host.o1 webclient.o1 uip_parsehttpurl.o1 +BIN = wget + +HOSTCFLAGS += -DCONFIG_WEBCLIENT_HOST=1 +HOSTCFLAGS += -I. -include hostdefs.h +VPATH = $(TOPDIR)/netutils/webclient:$(TOPDIR)/netutils/uiplib:. + +all: $(BIN) +.PHONY: clean context clean_context distclean + +$(OBJS): %.o1: %.c + $(HOSTCC) -c $(HOSTCFLAGS) $< -o $@ + +apps/netutils: + @mkdir -p apps/netutils + +apps/netutils/webclient.h: apps/netutils $(TOPDIR)/include/apps/netutils/webclient.h + @cp -a $(TOPDIR)/include/apps/netutils/webclient.h apps/netutils/. + +apps/netutils/uiplib.h: apps/netutils $(TOPDIR)/include/apps/netutils/uiplib.h + @cp -a $(TOPDIR)/include/apps/netutils/uiplib.h apps/netutils/. + +nuttx: + @mkdir nuttx + +nuttx/config.h: nuttx + @touch nuttx/config.h + +headers: apps/netutils/webclient.h apps/netutils/uiplib.h nuttx/config.h + +$(BIN): headers $(OBJS) + $(HOSTCC) $(HOSTLDFLAGS) $(OBJS) -o $@ + +clean: + @rm -f $(BIN).* *.o1 *~ + @rm -rf net nuttx + + diff --git a/apps/examples/wget/host.c b/apps/examples/wget/host.c new file mode 100644 index 0000000000..a7b416db5a --- /dev/null +++ b/apps/examples/wget/host.c @@ -0,0 +1,100 @@ +/**************************************************************************** + * examples/wget/host.c + * + * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include +#include + +#include + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: callback + ****************************************************************************/ + +static void callback(FAR char **buffer, int offset, int datend, + FAR int *buflen, FAR void *arg) +{ + (void)write(1, &((*buffer)[offset]), datend - offset); +} + +/**************************************************************************** + * Name: show_usage + ****************************************************************************/ + +static void show_usage(const char *progname, int exitcode) +{ + fprintf(stderr, "USAGE: %s \n", progname); + exit(exitcode); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ +/**************************************************************************** + * Name: main + ****************************************************************************/ + +int main(int argc, char **argv, char **envp) +{ + char buffer[1024]; + int ret; + + if (argc != 2) + { + show_usage(argv[0], 1); + } + + printf("WGET: Getting %s\n", argv[1]); + ret = wget(argv[1], buffer, 1024, callback, NULL); + if (ret < 0) + { + fprintf(stderr, "WGET: wget failed: %s\n", strerror(errno)); + } + return 0; +} diff --git a/apps/examples/wget/hostdefs.h b/apps/examples/wget/hostdefs.h new file mode 100755 index 0000000000..da072d560a --- /dev/null +++ b/apps/examples/wget/hostdefs.h @@ -0,0 +1,69 @@ +/**************************************************************************** + * examples/wget/hostdefs.c + * + * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef __HOSTDEFS_H +#define __HOSTDEFS_H + +/**************************************************************************** + * Included Files + *****************************************************************************/ + +#include +#include +#include + +/**************************************************************************** + * Preprocessor Defintiions + *****************************************************************************/ + +#define HTONS(a) htons(a) +#define HTONL(a) htonl(a) +#define CONFIG_CPP_HAVE_WARNING 1 +#define CONFIG_HAVE_GETHOSTBYNAME 1 +#define FAR + +#define ndbg(...) printf(__VA_ARGS__) +#define nvdbg(...) printf(__VA_ARGS__) + +#define ERROR (-1) +#define OK (0) + +/**************************************************************************** + * Type Definitions + *****************************************************************************/ + +typedef void *(*pthread_startroutine_t)(void *); + +#endif /* __HOSTDEFS_H */ diff --git a/apps/examples/wget/target.c b/apps/examples/wget/target.c new file mode 100644 index 0000000000..9c55746b36 --- /dev/null +++ b/apps/examples/wget/target.c @@ -0,0 +1,150 @@ +/**************************************************************************** + * examples/wget/target.c + * + * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include + +/**************************************************************************** + * Preprocessor Definitions + ****************************************************************************/ + +/* Configuation Checks ******************************************************/ +/* BEWARE: + * There are other configuration settings needed in netutitls/wget/wgetc.s, + * but there are default values for those so we cannot check them here. + */ + +#ifndef CONFIG_EXAMPLE_WGET_IPADDR +# error "You must define CONFIG_EXAMPLE_WGET_IPADDR" +#endif + +#ifndef CONFIG_EXAMPLE_WGET_DRIPADDR +# error "You must define CONFIG_EXAMPLE_WGET_DRIPADDR" +#endif + +#ifndef CONFIG_EXAMPLE_WGET_NETMASK +# error "You must define CONFIG_EXAMPLE_WGET_NETMASK" +#endif + +#ifndef CONFIG_NET +# error "You must define CONFIG_NET" +#endif + +#ifndef CONFIG_NET_TCP +# error "You must define CONFIG_NET_TCP" +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static char g_iobuffer[512]; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ +/**************************************************************************** + * Name: callback + ****************************************************************************/ + +static void callback(FAR char **buffer, int offset, int datend, + FAR int *buflen, FAR void *arg) +{ + (void)write(1, &((*buffer)[offset]), datend - offset); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + struct in_addr addr; +#if defined(CONFIG_EXAMPLE_WGET_NOMAC) + uint8_t mac[IFHWADDRLEN]; +#endif + +/* Many embedded network interfaces must have a software assigned MAC */ + +#ifdef CONFIG_EXAMPLE_WGET_NOMAC + mac[0] = 0x00; + mac[1] = 0xe0; + mac[2] = 0xb0; + mac[3] = 0x0b; + mac[4] = 0xba; + mac[5] = 0xbe; + uip_setmacaddr("eth0", mac); +#endif + + /* Set up our host address */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_WGET_IPADDR); + uip_sethostaddr("eth0", &addr); + + /* Set up the default router address */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_WGET_DRIPADDR); + uip_setdraddr("eth0", &addr); + + /* Setup the subnet mask */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_WGET_NETMASK); + uip_setnetmask("eth0", &addr); + + /* Then start the server */ + + wget(CONFIG_EXAMPLE_WGET_URL, g_iobuffer, 512, callback, NULL); + return 0; +} diff --git a/apps/examples/wlan/Makefile b/apps/examples/wlan/Makefile new file mode 100755 index 0000000000..621d9a0aa0 --- /dev/null +++ b/apps/examples/wlan/Makefile @@ -0,0 +1,95 @@ +############################################################################ +# apps/examples/wlan/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Authors: Gregory Nutt +# Rafael Noronha +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# WLAN Test + +ASRCS = +CSRCS = wlan_main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep + diff --git a/apps/examples/wlan/wlan_main.c b/apps/examples/wlan/wlan_main.c new file mode 100755 index 0000000000..04210909a7 --- /dev/null +++ b/apps/examples/wlan/wlan_main.c @@ -0,0 +1,306 @@ +/**************************************************************************** + * examples/wlan/wlan_main.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Authors: Gregory Nutt + * Rafael Noronha + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include + +/* DHCPC may be used in conjunction with any other feature (or not) */ + +#ifdef CONFIG_EXAMPLE_WLAN_DHCPC +# include +# include +# include +#endif + +/**************************************************************************** + * Definitions + ****************************************************************************/ +/* Configuration ************************************************************/ + +/* Sanity checking */ + +#ifndef CONFIG_USBHOST +# error "CONFIG_USBHOST is not defined" +#endif + +#ifdef CONFIG_USBHOST_BULK_DISABLE +# error "Bulk endpoints are disabled (CONFIG_USBHOST_BULK_DISABLE)" +#endif + +#ifndef CONFIG_NFILE_DESCRIPTORS +# error "CONFIG_NFILE_DESCRIPTORS > 0 needed" +#endif + +/* Provide some default values for other configuration settings */ + +#ifndef CONFIG_EXAMPLES_WLAN_DEFPRIO +# define CONFIG_EXAMPLES_WLAN_DEFPRIO 50 +#endif + +#ifndef CONFIG_EXAMPLES_WLAN_STACKSIZE +# define CONFIG_EXAMPLES_WLAN_STACKSIZE 1024 +#endif + +#ifndef CONFIG_EXAMPLES_WLAN_DEVNAME +# define CONFIG_EXAMPLES_WLAN_DEVNAME "wlan0" +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static struct usbhost_driver_s *g_drvr; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: wlan_bringup + * + * Description: + * Wait for USB devices to be connected. + * + ****************************************************************************/ + +static inline void wlan_bringup(void) +{ +#if defined(CONFIG_EXAMPLE_WLAN_DHCPC) || defined(CONFIG_EXAMPLE_WLAN_NOMAC) + uint8_t mac[IFHWADDRLEN]; +#endif + struct in_addr addr; +#ifdef CONFIG_EXAMPLE_WLAN_DHCPC + void *handle; +#endif + + /* Many embedded network interfaces must have a software assigned + * MAC + */ + +#ifdef CONFIG_EXAMPLE_WLAN_NOMAC + mac[0] = 0x00; + mac[1] = 0xe0; + mac[2] = 0xb0; + mac[3] = 0x0b; + mac[4] = 0xba; + mac[5] = 0xbe; + uip_setmacaddr("eth0", mac); +#endif + + /* Set up the default router address */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_WLAN_DRIPADDR); + uip_setdraddr("eth0", &addr); + + /* Setup the subnet mask */ + + addr.s_addr = HTONL(CONFIG_EXAMPLE_WLAN_NETMASK); + uip_setnetmask("eth0", &addr); + + /* Set up our host address */ + +#ifdef CONFIG_EXAMPLE_WLAN_DHCPC + addr.s_addr = 0; +#else + addr.s_addr = HTONL(CONFIG_EXAMPLE_WLAN_IPADDR); +#endif + uip_sethostaddr("eth0", &addr); + +#ifdef CONFIG_EXAMPLE_WLAN_DHCPC + /* Set up the resolver */ + + resolv_init(); + + /* Get the MAC address of the NIC */ + + uip_getmacaddr("eth0", mac); + + /* Set up the DHCPC modules */ + + handle = dhcpc_open(&mac, IFHWADDRLEN); + + /* Get an IP address. Note: there is no logic here for renewing + * the address in this example. The address should be renewed in + * ds.lease_time/2 seconds. + */ + + printf("Getting IP address\n"); + if (handle) + { + struct dhcpc_state ds; + (void)dhcpc_request(handle, &ds); + uip_sethostaddr("eth1", &ds.ipaddr); + if (ds.netmask.s_addr != 0) + { + uip_setnetmask("eth0", &ds.netmask); + } + if (ds.default_router.s_addr != 0) + { + uip_setdraddr("eth0", &ds.default_router); + } + if (ds.dnsaddr.s_addr != 0) + { + resolv_conf(&ds.dnsaddr); + } + dhcpc_close(handle); + printf("IP: %s\n", inet_ntoa(ds.ipaddr)); + } +#endif +} + +/**************************************************************************** + * Name: wlan_waiter + * + * Description: + * Wait for USB devices to be connected. + * + ****************************************************************************/ + +static int wlan_waiter(int argc, char *argv[]) +{ + bool connected = false; + int ret; + + printf("wlan_waiter: Running\n"); + for (;;) + { + /* Wait for the device to change state */ + + ret = DRVR_WAIT(g_drvr, connected); + DEBUGASSERT(ret == OK); + + connected = !connected; + printf("wlan_waiter: %s\n", connected ? "connected" : "disconnected"); + + /* Did we just become connected? */ + + if (connected) + { + /* Yes.. enumerate the newly connected device */ + + ret = DRVR_ENUMERATE(g_drvr); + + /* If the enumeration was successful, then bring up the interface */ + + wlan_bringup(); + } + } + + /* Keep the compiler from complaining */ + + return 0; +} + +/**************************************************************************** + * Name: user_start + ****************************************************************************/ + +int user_start(int argc, char *argv[]) +{ + pid_t pid; + int ret; + + /* First, register all of the USB host Wireless LAN drivers */ + + printf("user_start: Register drivers\n"); + ret = usbhost_wlaninit(); + if (ret != OK) + { + printf("user_start: Failed to register the WLAN driver\n"); + } + + /* Then get an instance of the USB host interface */ + + printf("user_start: Initialize USB host WLAN driver\n"); + g_drvr = usbhost_initialize(0); + if (g_drvr) + { + /* Start a thread to handle device connection. */ + + printf("user_start: Start wlan_waiter\n"); + +#ifndef CONFIG_CUSTOM_STACK + pid = task_create("usbhost", CONFIG_EXAMPLES_WLAN_DEFPRIO, + CONFIG_EXAMPLES_WLAN_STACKSIZE, + (main_t)wlan_waiter, (const char **)NULL); +#else + pid = task_create("usbhost", CONFIG_EXAMPLES_WLAN_DEFPRIO, + (main_t)wlan_waiter, (const char **)NULL); +#endif + + /* Now just sleep. Eventually logic here will perform the device test. */ + + for (;;) + { + sleep(5); + printf("usert_start: Still alive\n"); + } + } + return 0; +} diff --git a/apps/graphics/Makefile b/apps/graphics/Makefile new file mode 100644 index 0000000000..01775a2e3b --- /dev/null +++ b/apps/graphics/Makefile @@ -0,0 +1,72 @@ +############################################################################ +# apps/graphics/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config # Current configuration + +# Sub-directories + +SUBDIRS = tiff + +# Sub-directories that might need context setup + +CNTXTDIRS = + +all: nothing +.PHONY: nothing context depend clean distclean + +nothing: + +context: + @for dir in $(CNTXTDIRS) ; do \ + $(MAKE) -C $$dir context TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done + +depend: + @for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done + +clean: + @for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done + +distclean: clean + @for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done + +-include Make.dep + diff --git a/apps/graphics/tiff/Makefile b/apps/graphics/tiff/Makefile new file mode 100644 index 0000000000..617717c65c --- /dev/null +++ b/apps/graphics/tiff/Makefile @@ -0,0 +1,93 @@ +############################################################################ +# apps/graphics/tiff/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# NuttX TIFF Creation Tool + +ASRCS = +CSRCS = tiff_addstrip.c tiff_finalize.c tiff_initialize.c tiff_utils.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: context clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/graphics/tiff/README.txt b/apps/graphics/tiff/README.txt new file mode 100644 index 0000000000..b414107ff5 --- /dev/null +++ b/apps/graphics/tiff/README.txt @@ -0,0 +1,15 @@ +README for the TIFF Creation Library +===================================== + +This directory contains a library that can be used to create TIFF image +files. This file was created for the purpose of supporting screen dumps +from an LCD. Howeve, the logic is general and could be used for most +any purpose. + +The only usage documentation is in the (rather extensive) comments in +the file apps/include/tiff.h + +Unit Test +========= + +See apps/examples/tiff diff --git a/apps/graphics/tiff/tiff_addstrip.c b/apps/graphics/tiff/tiff_addstrip.c new file mode 100644 index 0000000000..fa2a50e72a --- /dev/null +++ b/apps/graphics/tiff/tiff_addstrip.c @@ -0,0 +1,239 @@ +/**************************************************************************** + * apps/graphics/tiff/tiff_addstrip.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include + +#include "tiff_internal.h" + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: tiff_addstrip + * + * Description: + * Convert an RGB565 strip to an RGB888 strip and write it to tmpfile2. + * + * Add an image data strip. The size of the strip in pixels must be equal + * to the RowsPerStrip x ImageWidth values that were provided to + * tiff_initialize(). + * + * Input Parameters: + * info - A pointer to the caller allocated parameter passing/TIFF state instance. + * buffer - A buffer containing a single row of data. + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ****************************************************************************/ +int tiff_convstrip(FAR struct tiff_info_s *info, FAR const uint8_t *strip) +{ +#ifdef CONFIG_DEBUG_GRAPHICS + size_t ntotal; +#endif + size_t nbytes; + FAR uint16_t *src; + FAR uint8_t *dest; + uint16_t rgb565; + int ret; + int i; + + DEBUGASSERT(info->iobuffer != NULL); + + /* Convert each RGB565 pixel to RGB888 */ + + src = (FAR uint16_t *)strip; + dest = info->iobuffer; + nbytes = 0; +#ifdef CONFIG_DEBUG_GRAPHICS + ntotal = 0; +#endif + + for (i = 0; i < info->pps; i++) + { + /* Convert RGB565 to RGB888 */ + + rgb565 = *src++; + *dest++ = (rgb565 >> (11-3)) & 0xf8; /* Move bits 11-15 to 3-7 */ + *dest++ = (rgb565 >> ( 5-2)) & 0xfc; /* Move bits 5-10 to 2-7 */ + *dest++ = (rgb565 << ( 3)) & 0xf8; /* Move bits 0- 4 to 3-7 */ + + /* Update the byte count */ + + nbytes += 3; +#ifdef CONFIG_DEBUG_GRAPHICS + ntotal += 3; +#endif + + /* Flush the conversion buffer to tmpfile2 when it becomes full */ + + if (nbytes > (info->iosize-3)) + { + ret = tiff_write(info->tmp2fd, info->iobuffer, nbytes); + if (ret < 0) + { + return ret; + } + + /* Reset to refill the conversion buffer */ + + dest = info->iobuffer; + nbytes = 0; + } + } + + /* Flush any buffer data to tmpfile2 */ + + ret = tiff_write(info->tmp2fd, info->iobuffer, nbytes); +#ifdef CONFIG_DEBUG_GRAPHICS + ASSERT(ntotal == info->bps); +#endif + return ret; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: tiff_addstrip + * + * Description: + * Add an image data strip. The size of the strip in pixels must be equal + * to the RowsPerStrip x ImageWidth values that were provided to + * tiff_initialize(). + * + * Input Parameters: + * info - A pointer to the caller allocated parameter passing/TIFF state instance. + * buffer - A buffer containing a single row of data. + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ****************************************************************************/ + +int tiff_addstrip(FAR struct tiff_info_s *info, FAR const uint8_t *strip) +{ + ssize_t newsize; + int ret; + + /* Add the new strip based on the color format. For FB_FMT_RGB16_565, + * will have to perform a conversion to RGB888. + */ + + if (info->colorfmt == FB_FMT_RGB16_565) + { + ret = tiff_convstrip(info, strip); + } + + /* For other formats, it is a simple write using the number of bytes per strip */ + + else + { + ret = tiff_write(info->tmp2fd, strip, info->bps); + } + + if (ret < 0) + { + goto errout; + } + + /* Write the byte count to the outfile and the offset to tmpfile1 */ + + ret = tiff_putint32(info->outfd, info->bps); + if (ret < 0) + { + goto errout; + } + info->outsize += 4; + + ret = tiff_putint32(info->tmp1fd, info->tmp2size); + if (ret < 0) + { + goto errout; + } + info->tmp1size += 4; + + /* Increment the size of tmp2file. */ + + info->tmp2size += info->bps; + + /* Pad tmpfile2 as necessary achieve word alignment */ + + newsize = tiff_wordalign(info->tmp2fd, info->tmp2size); + if (newsize < 0) + { + ret = (int)newsize; + goto errout; + } + info->tmp2size = (size_t)newsize; + + /* Increment the number of strips in the TIFF file */ + + info->nstrips++; + return OK; + +errout: + tiff_abort(info); + return ret; +} + diff --git a/apps/graphics/tiff/tiff_finalize.c b/apps/graphics/tiff/tiff_finalize.c new file mode 100644 index 0000000000..0d7a222a56 --- /dev/null +++ b/apps/graphics/tiff/tiff_finalize.c @@ -0,0 +1,439 @@ +/**************************************************************************** + * apps/graphics/tiff/tiff_finalize.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include + +#include "tiff_internal.h" + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: tiff_readifdentry + * + * Description: + * Read the IFD entry at the specified offset. + * + * Input Parameters: + * fd - File descriptor to rad from + * offset - Offset to read from + * ifdentry - Location to read the data + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ****************************************************************************/ + +static int tiff_readifdentry(int fd, off_t offset, + FAR struct tiff_ifdentry_s *ifdentry) +{ + off_t newoffs; + ssize_t nbytes; + + /* Seek to the read position */ + + newoffs = lseek(fd, offset, SEEK_SET); + if (newoffs == (off_t)-1) + { + return -errno; + } + + /* Then read the IFD entry. Anything returned by tiff_read other than the + * size of the IFD entry would be an error. + */ + + nbytes = tiff_read(fd, ifdentry, SIZEOF_IFD_ENTRY); + return nbytes == SIZEOF_IFD_ENTRY ? OK : -ENOSPC; +} + +/**************************************************************************** + * Name: tiff_writeifdentry + * + * Description: + * Write the IFD entry at the specified offset. + * + * Input Parameters: + * fd - File descriptor to rad from + * offset - Offset to read from + * ifdentry - Location to read the data + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ****************************************************************************/ + +static int tiff_writeifdentry(int fd, off_t offset, + FAR struct tiff_ifdentry_s *ifdentry) +{ + off_t newoffs; + + /* Seek to the write position */ + + newoffs = lseek(fd, offset, SEEK_SET); + if (newoffs == (off_t)-1) + { + return -errno; + } + + /* Then write the IFD entry */ + + return tiff_write(fd, ifdentry, SIZEOF_IFD_ENTRY); +} + +/**************************************************************************** + * Name: tiff_cleanup + * + * Description: + * Normal clean-up after completion of the TIFF file creation + * + * Input Parameters: + * info - A pointer to the caller allocated parameter passing/TIFF + * state instance. + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void tiff_cleanup(FAR struct tiff_info_s *info) +{ + /* Close all opened files */ + + if (info->outfd >= 0) + { + (void)close(info->outfd); + } + info->outfd = -1; + + if (info->tmp1fd >= 0) + { + (void)close(info->tmp1fd); + } + info->tmp1fd = -1; + + if (info->tmp2fd >= 0) + { + (void)close(info->tmp2fd); + } + info->tmp2fd = -1; + + /* And remove the temporary files */ + + (void)unlink(info->tmpfile1); + (void)unlink(info->tmpfile2); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: tiff_finalize + * + * Description: + * Finalize the TIFF output file, completing the TIFF file creation steps. + * + * Input Parameters: + * info - A pointer to the caller allocated parameter passing/TIFF state + * instance. + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ****************************************************************************/ + +int tiff_finalize(FAR struct tiff_info_s *info) +{ + struct tiff_ifdentry_s ifdentry; + FAR uint8_t *ptr; + size_t maxoffsets; +#ifdef CONFIG_DEBUG_GRAPHICS + size_t total; +#endif + off_t offset; + int ret; + int i; + int j; + + /* Put all of the pieces together to create the final output file. There + * are three pieces: + * + * 1) outfile: The partial output file containing the header, IFD and strip + * counts. This includes the StripOffsets and StripByteCounts that need + * to be updated. Size=outsize; + * 2) tmpfile1: This contains the offsets into tmpfile3 for each strip. The + * size of this file is tmp1size. These offsets are relative to the + * beginning of tmpfile3 and need to be offset by outsize+tmp1size. + * 3) tmpfile3: The strip data. Size is tmp2size. This is raw image data; + * no fixups are required. + */ + + DEBUGASSERT(info && info->outfd >= 0 && info->tmp1fd >= 0 && info->tmp2fd >= 0); + DEBUGASSERT((info->outsize & 3) == 0 && (info->tmp1size & 3) == 0); + + /* Fix-up the count value in the StripByteCounts IFD entry in the outfile. + * The actual number of strips was unknown at the time that the IFD entry + * was written. + */ + + ret = tiff_readifdentry(info->outfd, info->filefmt->sbcifdoffset, &ifdentry); + if (ret < 0) + { + goto errout; + } + + tiff_put32(ifdentry.count, info->nstrips); + + ret = tiff_writeifdentry(info->outfd, info->filefmt->sbcifdoffset, &ifdentry); + if (ret < 0) + { + goto errout; + } + + /* Fix-up the count and offset values in the StripOffsets IFD entry in the + * outfile. The StripOffsets data will be stored immediately after the + * outfile, hence, the correct offset is outsize. + */ + + ret = tiff_readifdentry(info->outfd, info->filefmt->soifdoffset, &ifdentry); + if (ret < 0) + { + goto errout; + } + + tiff_put32(ifdentry.count, info->nstrips); + tiff_put32(ifdentry.offset, info->outsize); + + ret = tiff_writeifdentry(info->outfd, info->filefmt->soifdoffset, &ifdentry); + if (ret < 0) + { + goto errout; + } + + /* Rewind to the beginning of tmpfile1 */ + + offset = lseek(info->tmp1fd, 0, SEEK_SET); + if (offset == (off_t)-1) + { + ret = -errno; + goto errout; + } + + /* Seek to the end of the outfile */ + + ret = lseek(info->outfd, 0, SEEK_END); + if (offset == (off_t)-1) + { + ret = -errno; + goto errout; + } + + /* Now read strip offset data from tmpfile1, update the offsets, and write + * the updated offsets to the outfile. The strip data will begin at offset + * outsize + tmp1size; + */ + + maxoffsets = info->iosize >> 2; +#ifdef CONFIG_DEBUG_GRAPHICS + total = 0; +#endif + + for (i = 0; i < info->nstrips; ) + { + size_t noffsets; + ssize_t nbytes; + + /* Read a group of up to 32-bit values */ + + noffsets = info->nstrips - i; + if (noffsets > maxoffsets) + { + noffsets = maxoffsets; + } + + nbytes = tiff_read(info->tmp1fd, info->iobuffer, noffsets << 2); + + /* If an error occurs or we fail to read exactly this number of + * bytes, then something bad happened. + */ + + if (nbytes != noffsets << 2) + { + goto errout; + } + + /* Fix up the offsets */ + + for (j = 0, ptr = info->iobuffer; + j < noffsets; + j++, ptr += 4) + { + uint32_t stripoff = tiff_get32(ptr); + stripoff += (info->outsize + info->tmp1size); + tiff_put32(ptr, stripoff); + } + + /* Then write the corrected offsets to the outfile */ + + ret = tiff_write(info->outfd, info->iobuffer, nbytes); + if (ret < 0) + { + goto errout; + } + + /* Update the count of offsets written */ + + i += noffsets; +#ifdef CONFIG_DEBUG_GRAPHICS + total += nbytes; +#endif + } +#ifdef CONFIG_DEBUG_GRAPHICS + ASSERT(total == info->tmp1size); +#endif + + /* Rewind to the beginning of tmpfile2 */ + + offset = lseek(info->tmp2fd, 0, SEEK_SET); + if (offset == (off_t)-1) + { + ret = -errno; + goto errout; + } + + /* Finally, copy the tmpfile2 to the end of the outfile */ + +#ifdef CONFIG_DEBUG_GRAPHICS + total = 0; +#endif + for (;;) + { + ssize_t nbytes; + + /* Read a block of data from tmpfile2 */ + + nbytes = tiff_read(info->tmp2fd, info->iobuffer, info->iosize); + + /* Check for tead errors and for end-of-file */ + + if (nbytes < 0) + { + ret = (int)nbytes; + goto errout; + } + else if (nbytes == 0) + { + break; + } + + /* Then copy the data to the outfile */ + + ret = tiff_write(info->outfd, info->iobuffer, nbytes); + if (ret < 0) + { + goto errout; + } + +#ifdef CONFIG_DEBUG_GRAPHICS + total += nbytes; +#endif + } +#ifdef CONFIG_DEBUG_GRAPHICS + ASSERT(total == info->tmp2size); +#endif + + /* Close all files and return success */ + + tiff_cleanup(info); + return OK; + +errout: + tiff_abort(info); + return ret; +} + +/************************************************************************************ + * Name: tiff_abort + * + * Description: + * Abort the TIFF file creation and create-up resources. + * + * Input Parameters: + * info - A pointer to the caller allocated parameter passing/TIFF state instance. + * + * Returned Value: + * None + * + ************************************************************************************/ + +void tiff_abort(FAR struct tiff_info_s *info) +{ + /* Perform normal cleanup */ + + tiff_cleanup(info); + + /* But then delete the output file as well */ + + (void)unlink(info->outfile); +} + diff --git a/apps/graphics/tiff/tiff_initialize.c b/apps/graphics/tiff/tiff_initialize.c new file mode 100644 index 0000000000..0e5b3229ce --- /dev/null +++ b/apps/graphics/tiff/tiff_initialize.c @@ -0,0 +1,910 @@ +/**************************************************************************** + * apps/graphics/tiff/tiff_initialize.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "tiff_internal.h" + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ +/* Bi-level Images + * + * Offset Description Contents/Notes + * Header: 0 Byte Order "II" or "MM" + * 2 Magic Number 42 + * 4 1st IFD offset 10 + * 8 [2 bytes padding] + * IFD: 10 Number of Directory Entries 13 + * 12 NewSubfileType + * 24 ImageWidth Number of columns is a user parameter + * 36 ImageLength Number of rows is a user parameter + * 48 Compression Hard-coded no compression (for now) + * 60 PhotometricInterpretation Value is a user parameter + * 72 StripOffsets Offset and count determined as strips added + * 84 RowsPerStrip Value is a user parameter + * 96 StripByteCounts Offset and count determined as strips added + * 108 XResolution Value is a user parameter + * 120 YResolution Value is a user parameter + * 132 Resolution Unit Hard-coded to "inches" + * 144 Software + * 156 DateTime + * 168 Next IFD offset 0 + * 170 [2 bytes padding] + * Values: + * 172 XResolution Hard-coded to 300/1 + * 180 YResolution Hard-coded to 300/1 + * 188 "NuttX" Length = 6 (including NUL terminator) + * 194 "YYYY:MM:DD HH:MM:SS" Length = 20 (ncluding NUL terminator) + * 214 [2 bytes padding] + * 216 StripByteCounts Beginning of strip byte counts + * xxx StripOffsets Beginning of strip offsets + * xxx [Probably padding] + * xxx Data for strips Beginning of strip data + */ + +#define TIFF_IFD_OFFSET (SIZEOF_TIFF_HEADER+2) + +#define TIFF_BILEV_NIFDENTRIES 13 +#define TIFF_BILEV_STRIPIFDOFFS 72 +#define TIFF_BILEV_STRIPBCIFDOFFS 96 +#define TIFF_BILEV_VALOFFSET 172 +#define TIFF_BILEV_XRESOFFSET 172 +#define TIFF_BILEV_YRESOFFSET 180 +#define TIFF_BILEV_SWOFFSET 188 +#define TIFF_BILEV_DATEOFFSET 194 +#define TIFF_BILEV_STRIPBCOFFSET 216 + +#define TIFF_SOFTWARE_STRING "NuttX" +#define TIFF_SOFTWARE_STRLEN 6 + +#define TIFF_DATETIME_FORMAT "%Y:%m:%d %H:%M:%S" +#define TIFF_DATETIME_STRLEN 20 + +/* Greyscale Images have one additional IFD entry: BitsPerSample (4 or 8) + * + * Header: 0 Byte Order "II" or "MM" + * 2 Magic Number 42 + * 4 1st IFD offset 10 + * 8 [2 bytes padding] + * IFD: 10 Number of Directory Entries 14 + * 12 NewSubfileType + * 24 ImageWidth Number of columns is a user parameter + * 36 ImageLength Number of rows is a user parameter + * 48 BitsPerSample + * 60 Compression Hard-coded no compression (for now) + * 72 PhotometricInterpretation Value is a user parameter + * 84 StripOffsets Offset and count determined as strips added + * 96 RowsPerStrip Value is a user parameter + * 108 StripByteCounts Offset and count determined as strips added + * 120 XResolution Value is a user parameter + * 132 YResolution Value is a user parameter + * 144 Resolution Unit Hard-coded to "inches" + * 156 Software + * 168 DateTime + * 180 Next IFD offset 0 + * 182 [2 bytes padding] + * Values: + * 184 XResolution Hard-coded to 300/1 + * 192 YResolution Hard-coded to 300/1 + * 200 "NuttX" Length = 6 (including NUL terminator) + * 206 "YYYY:MM:DD HH:MM:SS" Length = 20 (ncluding NUL terminator) + * 226 [2 bytes padding] + * 228 StripByteCounts Beginning of strip byte counts + * xxx StripOffsets Beginning of strip offsets + * xxx [Probably padding] + * xxx Data for strips Beginning of strip data + */ + +#define TIFF_GREY_NIFDENTRIES 14 +#define TIFF_GREY_STRIPIFDOFFS 84 +#define TIFF_GREY_STRIPBCIFDOFFS 108 +#define TIFF_GREY_VALOFFSET 184 +#define TIFF_GREY_XRESOFFSET 184 +#define TIFF_GREY_YRESOFFSET 192 +#define TIFF_GREY_SWOFFSET 200 +#define TIFF_GREY_DATEOFFSET 206 +#define TIFF_GREY_STRIPBCOFFSET 228 + +/* RGB Images have two additional IFD entries: BitsPerSample (8,8,8) and + * SamplesPerPixel (3): + * + * Header: 0 Byte Order "II" or "MM" + * 2 Magic Number 42 + * 4 1st IFD offset 10 + * 8 [2 bytes padding] + * IFD: 10 Number of Directory Entries 15 + * 12 NewSubfileType + * 24 ImageWidth Number of columns is a user parameter + * 36 ImageLength Number of rows is a user parameter + * 48 BitsPerSample 8, 8, 8 + * 60 Compression Hard-coded no compression (for now) + * 72 PhotometricInterpretation Value is a user parameter + * 84 StripOffsets Offset and count determined as strips added + * 96 SamplesPerPixel Hard-coded to 3 + * 108 RowsPerStrip Value is a user parameter + * 120 StripByteCounts Offset and count determined as strips added + * 132 XResolution Value is a user parameter + * 144 YResolution Value is a user parameter + * 156 Resolution Unit Hard-coded to "inches" + * 168 Software + * 180 DateTime + * 192 Next IFD offset 0 + * 194 [2 bytes padding] + * Values: + * 196 XResolution Hard-coded to 300/1 + * 204 YResolution Hard-coded to 300/1 + * 212 BitsPerSample 8, 8, 8 + * 218 [2 bytes padding] + * 220 "NuttX" Length = 6 (including NUL terminator) + * 226 "YYYY:MM:DD HH:MM:SS" Length = 20 (ncluding NUL terminator) + * 246 [2 bytes padding] + * 248 StripByteCounts Beginning of strip byte counts + * xxx StripOffsets Beginning of strip offsets + * xxx [Probably padding] + * xxx Data for strips Beginning of strip data + */ + +#define TIFF_RGB_NIFDENTRIES 15 +#define TIFF_RGB_STRIPIFDOFFS 84 +#define TIFF_RGB_STRIPBCIFDOFFS 120 +#define TIFF_RGB_VALOFFSET 196 +#define TIFF_RGB_XRESOFFSET 196 +#define TIFF_RGB_YRESOFFSET 204 +#define TIFF_RGB_BPSOFFSET 212 +#define TIFF_RGB_SWOFFSET 220 +#define TIFF_RGB_DATEOFFSET 226 +#define TIFF_RGB_STRIPBCOFFSET 248 + +/* Debug *******************************************************************/ +/* CONFIG_DEBUG_TIFFOFFSETS may be defined (along with CONFIG_DEBUG and + * CONFIG_DEBUG_GRAPHICS) in order to verify the pre-determined TIFF file + * offsets. + */ + +#if !defined(CONFIG_DEBUG) || !defined(CONFIG_DEBUG_GRAPHICS) +# undef CONFIG_DEBUG_TIFFOFFSETS +#endif + +#ifdef CONFIG_DEBUG_TIFFOFFSETS +# define tiff_offset(o,l) (o) += (l) +# define tiff_checkoffs(o,x) ASSERT((o) == (x)) +#else +# define tiff_offset(o,l) +# define tiff_checkoffs(o,x) +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const struct tiff_filefmt_s g_bilevinfo = +{ + TIFF_BILEV_NIFDENTRIES, /* nifdentries, Number of IFD entries */ + TIFF_BILEV_STRIPIFDOFFS, /* soifdoffset, Offset to StripOffset IFD entry */ + TIFF_BILEV_STRIPBCIFDOFFS, /* sbcifdoffset, Offset to StripByteCount IFD entry */ + TIFF_BILEV_VALOFFSET, /* valoffset, Offset to first values */ + TIFF_BILEV_XRESOFFSET, /* xresoffset, Offset to XResolution values */ + TIFF_BILEV_YRESOFFSET, /* yresoffset, Offset to yResolution values */ + TIFF_BILEV_SWOFFSET, /* swoffset, Offset to Software string */ + TIFF_BILEV_DATEOFFSET, /* dateoffset, Offset to DateTime string */ + TIFF_BILEV_STRIPBCOFFSET /* sbcoffset, Offset to StripByteCount values */ +}; + +static const struct tiff_filefmt_s g_greyinfo = +{ + TIFF_GREY_NIFDENTRIES, /* nifdentries, Number of IFD entries */ + TIFF_GREY_STRIPIFDOFFS, /* soifdoffset, Offset to StripOffset IFD entry */ + TIFF_GREY_STRIPBCIFDOFFS, /* sbcifdoffset, Offset to StripByteCount IFD entry */ + TIFF_GREY_VALOFFSET, /* valoffset, Offset to first values */ + TIFF_GREY_XRESOFFSET, /* xresoffset, Offset to XResolution values */ + TIFF_GREY_YRESOFFSET, /* yresoffset, Offset to yResolution values */ + TIFF_GREY_SWOFFSET, /* swoffset, Offset to Software string */ + TIFF_GREY_DATEOFFSET, /* dateoffset, Offset to DateTime string */ + TIFF_GREY_STRIPBCOFFSET /* sbcoffset, Offset to StripByteCount values */ +}; + +static const struct tiff_filefmt_s g_rgbinfo = +{ + TIFF_RGB_NIFDENTRIES, /* nifdentries, Number of IFD entries */ + TIFF_RGB_STRIPIFDOFFS, /* soifdoffset, Offset to StripOffset IFD entry */ + TIFF_RGB_STRIPBCIFDOFFS, /* sbcifdoffset, Offset to StripByteCount IFD entry */ + TIFF_RGB_VALOFFSET, /* valoffset, Offset to first values */ + TIFF_RGB_XRESOFFSET, /* xresoffset, Offset to XResolution values */ + TIFF_RGB_YRESOFFSET, /* yresoffset, Offset to yResolution values */ + TIFF_RGB_SWOFFSET, /* swoffset, Offset to Software string */ + TIFF_RGB_DATEOFFSET, /* dateoffset, Offset to DateTime string */ + TIFF_RGB_STRIPBCOFFSET /* sbcoffset, Offset to StripByteCount values */ +}; + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: tiff_putheader + * + * Description: + * Setup to create a new TIFF file. + * + * Input Parameters: + * info - A pointer to the caller allocated parameter passing/TIFF state + * instance. + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ****************************************************************************/ + +static inline int tiff_putheader(FAR struct tiff_info_s *info) +{ + struct tiff_header_s hdr; + int ret; + + /* 0-1: Byte order */ + +#ifdef CONFIG_ENDIAN_BIG + hdr.order[0] = 'M'; /* "MM"=big endian */ + hdr.order[1] = 'M'; +#else + hdr.order[0] = 'I'; /* "II"=little endian */ + hdr.order[1] = 'I'; +#endif + + /* 2-3: 42 in appropriate byte order */ + + tiff_put16(hdr.magic, 42); + + /* 4-7: Offset to the first IFD */ + + tiff_put32(hdr.offset, TIFF_IFD_OFFSET); + + /* Write the header to the output file */ + + ret = tiff_write(info->outfd, &hdr, SIZEOF_TIFF_HEADER); + if (ret != OK) + { + return ret; + } + + /* Two pad bytes following the header */ + + ret = tiff_putint16(info->outfd, 0); + return ret; +} + +/**************************************************************************** + * Name: tiff_putifdentry + * + * Description: + * Write an IFD entry to outfile + * + * Input Parameters: + * info - A pointer to the caller allocated parameter passing/TIFF state + * instance. + * tag - The value for the IFD tag field + * type - The value for the IFD type field + * count - The value for the IFD count field + * offset - The value for the IFD offset field + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ****************************************************************************/ + +static int tiff_putifdentry(FAR struct tiff_info_s *info, uint16_t tag, + uint16_t type, uint32_t count, uint32_t offset) +{ + struct tiff_ifdentry_s ifd; + tiff_put16(ifd.tag, tag); + tiff_put16(ifd.type, type); + tiff_put32(ifd.count, count); + tiff_put32(ifd.offset, offset); + return tiff_write(info->outfd, &ifd, SIZEOF_IFD_ENTRY); +} + +/**************************************************************************** + * Name: tiff_putifdentry + * + * Description: + * Write an IFD with a 16-bit immediate value + * + * Input Parameters: + * info - A pointer to the caller allocated parameter passing/TIFF state + * instance. + * tag - The value for the IFD tag field + * type - The value for the IFD type field + * count - The value for the IFD count field + * value - The 16-bit immediate value + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ****************************************************************************/ + +static int tiff_putifdentry16(FAR struct tiff_info_s *info, uint16_t tag, + uint16_t type, uint32_t count, uint16_t value) +{ + union + { + uint8_t b[4]; + uint32_t w; + } u; + + u.w = 0; + tiff_put16(u.b, value); + return tiff_putifdentry(info, tag, type, count, u.w); +} + +/**************************************************************************** + * Name: tiff_datetime + * + * Description: + * Get the DateTime string + * + * Input Parameters: + * + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ****************************************************************************/ + +static int tiff_datetime(FAR char *timbuf, unsigned int buflen) +{ + struct timespec ts; + struct tm tm; + int ret; + + /* Get the current time */ + + ret = clock_gettime(CLOCK_REALTIME, &ts); + if (ret < 0) + { + gdbg("clock_gettime failed: %d\n", errno); + return ERROR; + } + + /* Break the current time up into the format needed by strftime */ + + (void)gmtime_r((FAR const time_t*)&ts.tv_sec, &tm); + + /* Comvert the current time in the TIFF format */ + + (void)strftime(timbuf, buflen, TIFF_DATETIME_FORMAT, &tm); + return OK; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: tiff_initialize + * + * Description: + * Setup to create a new TIFF file. + * + * Input Parameters: + * info - A pointer to the caller allocated parameter passing/TIFF state instance. + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ****************************************************************************/ + +int tiff_initialize(FAR struct tiff_info_s *info) +{ + uint16_t val16; +#if CONFIG_DEBUG_TIFFOFFSETS + off_t offset = 0; +#endif + char timbuf[TIFF_DATETIME_STRLEN + 8]; + int ret = -EINVAL; + + DEBUGASSERT(info && info->outfile && info->tmpfile1 && info->tmpfile2); + + /* Open all output files */ + + info->outfd = open(info->outfile, O_RDWR|O_CREAT|O_TRUNC, 0666); + if (info->outfd < 0) + { + gdbg("Failed to open %s for reading/writing: %d\n", info->outfile, errno); + goto errout; + } + + info->tmp1fd = open(info->tmpfile1, O_RDWR|O_CREAT|O_TRUNC, 0666); + if (info->tmp1fd < 0) + { + gdbg("Failed to open %s for reading/writing: %d\n", info->tmpfile1, errno); + goto errout; + } + + info->tmp2fd = open(info->tmpfile1, O_RDWR|O_CREAT|O_TRUNC, 0666); + if (info->tmp2fd < 0) + { + gdbg("Failed to open %s for reading/writing: %d\n", info->tmpfile1, errno); + goto errout; + } + + /* Make some decisions using the color format. Only the following are + * supported: + */ + + info->pps = info->imgwidth * info->rps; /* Pixels per strip */ + switch (info->colorfmt) + { + case FB_FMT_Y1: /* BPP=1, monochrome, 0=black */ + info->filefmt = &g_bilevinfo; /* Bi-level file image file info */ + info->imgflags = IMGFLAGS_FMT_Y1; /* Bit encoded image characteristics */ + info->bps = (info->pps + 7) >> 3; /* Bytes per strip */ + break; + + case FB_FMT_Y4: /* BPP=4, 4-bit greyscale, 0=black */ + info->filefmt = &g_greyinfo; /* Greyscale file image file info */ + info->imgflags = IMGFLAGS_FMT_Y4; /* Bit encoded image characteristics */ + info->bps = (info->pps + 1) >> 1; /* Bytes per strip */ + break; + + case FB_FMT_Y8: /* BPP=8, 8-bit greyscale, 0=black */ + info->filefmt = &g_greyinfo; /* Greyscale file image file info */ + info->imgflags = IMGFLAGS_FMT_Y8; /* Bit encoded image characteristics */ + info->bps = info->pps; /* Bytes per strip */ + break; + + case FB_FMT_RGB16_565: /* BPP=16 R=6, G=6, B=5 */ + info->filefmt = &g_rgbinfo; /* RGB file image file info */ + info->imgflags = IMGFLAGS_FMT_RGB16_565; /* Bit encoded image characteristics */ + info->bps = 3 * info->pps; /* Bytes per strip */ + break; + + case FB_FMT_RGB24: /* BPP=24 R=8, G=8, B=8 */ + info->filefmt = &g_rgbinfo; /* RGB file image file info */ + info->imgflags = IMGFLAGS_FMT_RGB24; /* Bit encoded image characteristics */ + info->bps = 3 *info->pps; /* Bytes per strip */ + break; + + default: + gdbg("Unsupported color format: %d\n", info->colorfmt); + return -EINVAL; + } + + /* Write the TIFF header data to the outfile: + * + * Header: 0 Byte Order "II" or "MM" + * 2 Magic Number 42 + * 4 1st IFD offset 10 + * 8 [2 bytes padding] + */ + + ret = tiff_putheader(info); + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, TIFF_IFD_OFFSET); + + /* Write the Number of directory entries + * + * All formats: Offset 10 Number of Directory Entries 12 + */ + + ret = tiff_putint16(info->outfd, info->filefmt->nifdentries); + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, 2); + + /* Write the NewSubfileType IFD entry + * + * All formats: Offset 12 NewSubfileType + */ + + ret = tiff_putifdentry16(info, IFD_TAG_NEWSUBFILETYPE, IFD_FIELD_LONG, 1, 0); + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, SIZEOF_IFD_ENTRY); + + /* Write ImageWidth and ImageLength + * + * All formats: Offset 24 ImageWidth Number of columns is a user parameter + * 36 ImageLength Number of rows is a user parameter + */ + + ret = tiff_putifdentry16(info, IFD_TAG_IMAGEWIDTH, IFD_FIELD_SHORT, 1, info->imgwidth); + if (ret == OK) + { + ret= tiff_putifdentry16(info, IFD_TAG_IMAGELENGTH, IFD_FIELD_SHORT, 1, info->imgheight); + } + + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, 2*SIZEOF_IFD_ENTRY); + + /* Write BitsPerSample + * + * Bi-level Images: None + * Greyscale: Offset 48 BitsPerSample (4 or 8) + * RGB: Offset 48 BitsPerSample (8,8,8) + */ + + tiff_checkoffs(offset, 48); + if (IMGFLAGS_ISGREY(info->imgflags)) + { + if (IMGFLAGS_ISGREY8(info->imgflags)) + { + val16 = 8; + } + else + { + val16 = 4; + } + + ret = tiff_putifdentry16(info, IFD_TAG_BITSPERSAMPLE, IFD_FIELD_SHORT, 1, val16); + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, SIZEOF_IFD_ENTRY); + } + else if (IMGFLAGS_ISRGB(info->imgflags)) + { + ret = tiff_putifdentry(info, IFD_TAG_BITSPERSAMPLE, IFD_FIELD_SHORT, 3, TIFF_RGB_BPSOFFSET); + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, SIZEOF_IFD_ENTRY); + } + + /* Write Compression: + * + * Bi-level Images: Offset 48 Hard-coded no compression (for now) + * Greyscale: Offset 60 " " " " "" " " " " " " + * RGB: Offset 60 " " " " "" " " " " " " + */ + + ret = tiff_putifdentry16(info, IFD_TAG_COMPRESSION, IFD_FIELD_SHORT, 1, TAG_COMP_NONE); + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, SIZEOF_IFD_ENTRY); + + /* Write PhotometricInterpretation: + * + * Bi-level Images: Offset 48 Hard-coded BlackIsZero + * Greyscale: Offset 72 Hard-coded BlackIsZero + * RGB: Offset 72 Hard-coded RGB + */ + + if (IMGFLAGS_ISRGB(info->imgflags)) + { + val16 = TAG_PMI_RGB; + } + else + { + val16 = TAG_PMI_BLACK; + } + + ret = tiff_putifdentry16(info, IFD_TAG_PMI, IFD_FIELD_SHORT, 1, val16); + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, SIZEOF_IFD_ENTRY); + + /* Write StripOffsets: + * + * Bi-level Images: Offset 72 Value determined by switch statement above + * Greyscale: Offset 84 Value determined by switch statement above + * RGB: Offset 84 Value determined by switch statement above + */ + + tiff_checkoffs(offset, info->filefmt->soifdoffset); + ret = tiff_putifdentry(info, IFD_TAG_STRIPOFFSETS, IFD_FIELD_LONG, 0, 0); + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, SIZEOF_IFD_ENTRY); + + /* Write SamplesPerPixel + * + * Bi-level Images: N/A + * Greyscale: N/A + * RGB: Offset 96 Hard-coded to 3 + */ + + if (IMGFLAGS_ISRGB(info->imgflags)) + { + ret = tiff_putifdentry16(info, IFD_TAG_SAMPLESPERPIXEL, IFD_FIELD_SHORT, 1, 3); + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, SIZEOF_IFD_ENTRY); + } + + /* Write RowsPerStrip: + * + * Bi-level Images: Offset 84 Value is a user parameter + * Greyscale: Offset 96 Value is a user parameter + * RGB: Offset 108 Value is a user parameter + */ + + ret = tiff_putifdentry16(info, IFD_TAG_ROWSPERSTRIP, IFD_FIELD_SHORT, 1, info->rps); + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, SIZEOF_IFD_ENTRY); + + /* Write StripByteCounts: + * + * Bi-level Images: Offset 96 Count determined as strips added, Value offset = 216 + * Greyscale: Offset 108 Count determined as strips added, Value offset = 228 + * RGB: Offset 120 Count determined as strips added, Value offset = 248 + */ + + tiff_checkoffs(offset, info->filefmt->sbcifdoffset); + ret = tiff_putifdentry(info, IFD_TAG_STRIPCOUNTS, IFD_FIELD_LONG, 0, info->filefmt->sbcoffset); + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, SIZEOF_IFD_ENTRY); + + /* Write XResolution and YResolution: + * + * Bi-level Images: Offset 108 and 120, Values are a user parameters + * Greyscale: Offset 120 and 132, Values are a user parameters + * RGB: Offset 132 and 144, Values are a user parameters + */ + + ret = tiff_putifdentry(info, IFD_TAG_XRESOLUTION, IFD_FIELD_RATIONAL, 1, info->filefmt->xresoffset); + if (ret == OK) + { + ret = tiff_putifdentry(info, IFD_TAG_YRESOLUTION, IFD_FIELD_RATIONAL, 1, info->filefmt->yresoffset); + } + + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, 2*SIZEOF_IFD_ENTRY); + + /* Write ResolutionUnit: + * + * Bi-level Images: Offset 132, Hard-coded to "inches" + * Greyscale: Offset 144, Hard-coded to "inches" + * RGB: Offset 156, Hard-coded to "inches" + */ + + ret = tiff_putifdentry16(info, IFD_TAG_RESUNIT, IFD_FIELD_SHORT, 1, TAG_RESUNIT_INCH); + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, SIZEOF_IFD_ENTRY); + + /* Write Software: + * + * Bi-level Images: Offset 144 Count, Hard-coded "NuttX" + * Greyscale: Offset 156 Count, Hard-coded "NuttX" + * RGB: Offset 168 Count, Hard-coded "NuttX" + */ + + ret = tiff_putifdentry(info, IFD_TAG_SOFTWARE, IFD_FIELD_ASCII, TIFF_SOFTWARE_STRLEN, info->filefmt->swoffset); + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, SIZEOF_IFD_ENTRY); + + /* Write DateTime: + * + * Bi-level Images: Offset 156 Count, Format "YYYY:MM:DD HH:MM:SS" + * Greyscale: Offset 168 Count, Format "YYYY:MM:DD HH:MM:SS" + * RGB: Offset 180 Count, Format "YYYY:MM:DD HH:MM:SS" + */ + + ret = tiff_putifdentry(info, IFD_TAG_DATETIME, IFD_FIELD_ASCII, TIFF_DATETIME_STRLEN, info->filefmt->dateoffset); + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, SIZEOF_IFD_ENTRY); + + /* Write Next IFD Offset and 2 bytes of padding: + * + * Bi-level Images: Offset 168, Next IFD offset + * Offset 170, [2 bytes padding] + * Greyscale: Offset 180, Next IFD offset + * Offset 182, [2 bytes padding] + * RGB: Offset 192, Next IFD offset + * Offset 194, [2 bytes padding] + */ + + ret = tiff_putint32(info->outfd, 0); + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, 4); + + /* Now we begin the value section of the file */ + + tiff_checkoffs(offset, info->filefmt->valoffset); + + /* Write the XResolution and YResolution data: + * + * Bi-level Images: Offset 172 Count, Hard-coded to 300/1 + * Offset 180 Count, Hard-coded to 300/1 + * Greyscale: Offset 184 Count, Hard-coded to 300/1 + * Offset 192 Count, Hard-coded to 300/1 + * RGB: Offset 196 Count, Hard-coded to 300/1 + * Offset 204 Count, Hard-coded to 300/1 + */ + + tiff_checkoffs(offset, info->filefmt->xresoffset); + ret = tiff_putint32(info->outfd, 300); + if (ret == OK) + { + ret = tiff_putint32(info->outfd, 1); + } + + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, 8); + + tiff_checkoffs(offset, info->filefmt->yresoffset); + ret = tiff_putint32(info->outfd, 300); + if (ret == OK) + { + ret = tiff_putint32(info->outfd, 1); + } + + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, 8); + + /* Write RGB BitsPerSample Data: + * + * Bi-level Images: N/A + * Greyscale: N/A + * RGB: Offset 212 BitsPerSample (8,8,8) + * Offset 218 [2 bytes padding] + */ + + if (IMGFLAGS_ISRGB(info->imgflags)) + { + tiff_checkoffs(offset, TIFF_RGB_BPSOFFSET); + tiff_putint16(info->outfd, 8); + tiff_putint16(info->outfd, 8); + tiff_putint16(info->outfd, 8); + tiff_putint16(info->outfd, 0); + tiff_offset(offset, 8); + } + + /* Write the Software string: + * + * + * Bi-level Images: Offset 188, Hard-coded "NuttX" + * Greyscale: Offset 200, Hard-coded "NuttX" + * RGB: Offset 220, Hard-coded "NuttX" + */ + + tiff_checkoffs(offset, info->filefmt->swoffset); + ret = tiff_putstring(info->outfd, TIFF_SOFTWARE_STRING, TIFF_SOFTWARE_STRLEN); + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, TIFF_SOFTWARE_STRLEN); + + /* Write the DateTime string: + * + * + * Bi-level Images: Offset 188, Format "YYYY:MM:DD HH:MM:SSS" + * Greyscale: Offset 200, Hard-coded "NuttX" + * RGB: Offset 220, Hard-coded "NuttX" + */ + + tiff_checkoffs(offset, info->filefmt->dateoffset); + ret = tiff_datetime(timbuf, TIFF_DATETIME_STRLEN + 8); + if (ret < 0) + { + goto errout; + } + + ret = tiff_putstring(info->outfd, timbuf, TIFF_DATETIME_STRLEN); + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, TIFF_DATETIME_STRLEN); + + /* Add two bytes of padding */ + + ret = tiff_putint16(info->outfd, 0); + if (ret < 0) + { + goto errout; + } + tiff_offset(offset, 2); + + /* And that should do it! */ + + tiff_checkoffs(offset, info->filefmt->sbcoffset); + info->outsize = info->filefmt->sbcoffset; + return OK; + +errout: + tiff_abort(info); + return ret; +} + diff --git a/apps/graphics/tiff/tiff_internal.h b/apps/graphics/tiff/tiff_internal.h new file mode 100644 index 0000000000..5596122fa3 --- /dev/null +++ b/apps/graphics/tiff/tiff_internal.h @@ -0,0 +1,211 @@ +/**************************************************************************** + * apps/graphics/tiff/tiff_internal.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_GRAPHICS_TIFF_TIFF_INTERNAL_H +#define __APPS_GRAPHICS_TIFF_TIFF_INTERNAL_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include +#include + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ +/* Image Type ***************************************************************/ + +#define IMGFLAGS_BILEV_BIT (1 << 0) +#define IMGFLAGS_GREY_BIT (1 << 1) +#define IMGFLAGS_GREY8_BIT (1 << 2) +#define IMGFLAGS_RGB_BIT (1 << 3) +#define IMGFLAGS_RGB565_BIT (1 << 4) + +#define IMGFLAGS_FMT_Y1 (IMGFLAGS_BILEV_BIT) +#define IMGFLAGS_FMT_Y4 (IMGFLAGS_GREY_BIT) +#define IMGFLAGS_FMT_Y8 (IMGFLAGS_GREY_BIT|IMGFLAGS_GREY8_BIT) +#define IMGFLAGS_FMT_RGB16_565 (IMGFLAGS_RGB_BIT) +#define IMGFLAGS_FMT_RGB24 (IMGFLAGS_RGB_BIT|IMGFLAGS_RGB565_BIT) + +#define IMGFLAGS_ISBILEV(f) \ + (((f) & IMGFLAGS_BILEV_BIT) != 0) +#define IMGFLAGS_ISGREY(f) \ + (((f) & IMGFLAGS_GREY_BIT) != 0) +#define IMGFLAGS_ISGREY4(f) \ + (((f) & (IMGFLAGS_GREY_BIT|IMGFLAGS_GREY8_BIT)) == IMGFLAGS_GREY_BIT) +#define IMGFLAGS_ISGREY8(f) \ + (((f) & (IMGFLAGS_GREY_BIT|IMGFLAGS_GREY8_BIT)) == (IMGFLAGS_GREY_BIT|IMGFLAGS_GREY8_BIT)) +#define IMGFLAGS_ISRGB(f) \ + (((f) & IMGFLAGS_FMT_RGB24) != 0) + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: tiff_read + * + * Description: + * Read TIFF data from the specified file + * + * Input Parameters: + * fd - Open file descriptor to read from + * buffer - Read-only buffer containing the data to be written + * count - The number of bytes to write + * + * Returned Value: + * On success, then number of bytes read; Zero is returned on EOF. + * Otherwise, a negated errno value on failure. + * + ****************************************************************************/ + +EXTERN ssize_t tiff_read(int fd, FAR void *buffer, size_t count); + +/**************************************************************************** + * Name: tiff_write + * + * Description: + * Write TIFF data to the specified file + * + * Input Parameters: + * fd - Open file descriptor to write to + * buffer - Read-only buffer containing the data to be written + * count - The number of bytes to write + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ****************************************************************************/ + +EXTERN int tiff_write(int fd, FAR const void *buffer, size_t count); + +/**************************************************************************** + * Name: tiff_putint16 + * + * Description: + * Write two bytes to the outfile. + * + * Input Parameters: + * fd - File descriptor to be used. + * value - The 2-byte, uint16_t value to write + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ****************************************************************************/ + +EXTERN int tiff_putint16(int fd, uint16_t value); + +/**************************************************************************** + * Name: tiff_putint32 + * + * Description: + * Write four bytes to the outfile. + * + * Input Parameters: + * fd - File descriptor to be used. + * value - The 4-byte, uint32_t value to write + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ****************************************************************************/ + +EXTERN int tiff_putint32(int fd, uint32_t value); + +/**************************************************************************** + * Name: tiff_putstring + * + * Description: + * Write a string of fixed length to the outfile. + * + * Input Parameters: + * fd - File descriptor to be used. + * string - A pointer to the memory containing the string + * len - The length of the string (including the NUL terminator) + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ****************************************************************************/ + +EXTERN int tiff_putstring(int fd, FAR const char *string, int len); + +/**************************************************************************** + * Name: tiff_wordalign + * + * Description: + * Pad a file with zeros as necessary to achieve word alignament. + * + * Input Parameters: + * fd - File descriptor to be used. + * size - The current size of the file + * + * Returned Value: + * The new size of the file on success. A negated errno value on failure. + * + ****************************************************************************/ + +EXTERN ssize_t tiff_wordalign(int fd, size_t size); + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __APPS_GRAPHICS_TIFF_TIFF_INTERNAL_H */ + diff --git a/apps/graphics/tiff/tiff_utils.c b/apps/graphics/tiff/tiff_utils.c new file mode 100644 index 0000000000..c326d0274b --- /dev/null +++ b/apps/graphics/tiff/tiff_utils.c @@ -0,0 +1,381 @@ +/**************************************************************************** + * apps/graphics/tiff/tiff_utils.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include + +#include "tiff_internal.h" + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: tiff_put/get16/32 + * + * Description: + * Put and get 16 and 32 values in the correct byte order at the specified + * position. + * + * Input Parameters: + * dest - The location to store the multi-byte data (put only) + * src - The location to get the multi-byte data (get only) + * value - The value to be stored (put only) + * + * Returned Value: + * None (put) + * The extracted value (get) + * + ****************************************************************************/ + +void tiff_put16(FAR uint8_t *dest, uint16_t value) +{ +#ifdef CONFIG_ENDIAN_BIG + *dest++ = (uint8_t)(value >> 8); + *dest = (uint8_t)(value & 0xff); +#else + *dest++ = (uint8_t)(value & 0xff); + *dest = (uint8_t)(value >> 8); +#endif +} + +void tiff_put32(FAR uint8_t *dest, uint32_t value) +{ +#ifdef CONFIG_ENDIAN_BIG + tiff_put16(dest, (uint16_t)(value >> 16)); + tiff_put16(dest+2, (uint16_t)(value & 0xffff)); +#else + tiff_put16(dest, (uint16_t)(value & 0xffff)); + tiff_put16(dest+2, (uint16_t)(value >> 16)); +#endif +} + +uint16_t tiff_get16(FAR uint8_t *src) +{ +#ifdef CONFIG_ENDIAN_BIG + return (uint16_t)src[0] << 8 | (uint16_t)src[1]; +#else + return (uint16_t)src[1] << 8 | (uint16_t)src[0]; +#endif +} + +uint32_t tiff_get32(FAR uint8_t *src) +{ +#ifdef CONFIG_ENDIAN_BIG + return (uint32_t)tiff_get16(src) << 16 | (uint32_t)tiff_get16(src+2); +#else + return (uint32_t)tiff_get16(src+2) << 16 | (uint32_t)tiff_get16(src); +#endif + +} + +/**************************************************************************** + * Name: tiff_read + * + * Description: + * Read TIFF data from the specified file + * + * Input Parameters: + * fd - Open file descriptor to read from + * buffer - Read-only buffer containing the data to be written + * count - The number of bytes to write + * + * Returned Value: + * On success, then number of bytes read; Zero is returned on EOF. + * Otherwise, a negated errno value on failure. + * + ****************************************************************************/ + +ssize_t tiff_read(int fd, FAR void *buffer, size_t count) +{ + size_t ntotal; + ssize_t nbytes; + int errval; + + /* This loop retries the write until either: (1) it completes successfully, + * or (2) until an irrecoverble error occurs. + */ + + for (ntotal = 0; ntotal < count; ) + { + /* Do the read. The number of bytes left to read is the total + * requested size (count) minus the amount that we have alread read + * (ntotal). + */ + + nbytes = read(fd, buffer, count-ntotal); + + /* Check for an error */ + + if (nbytes < 0) + { + /* EINTR is not an error.. this just means that the write was + * interrupted by a signal. + */ + + errval = errno; + if (errval != EINTR) + { + /* Other errors are bad news and we will break out with an error */ + + return -errval; + } + } + + /* Zero is a special case and means that the end of file was encountered. */ + + else if (nbytes == 0) + { + break; + } + + /* What if read returns some number of bytes other than the requested number? + * This probably means that the end-of-file will be encountered the next time + * that we call read(). + */ + + else + { + buffer += nbytes; + ntotal += nbytes; + } + } + + return ntotal; +} + +/**************************************************************************** + * Name: tiff_write + * + * Description: + * Write TIFF data to the specified file + * + * Input Parameters: + * fd - Open file descriptor to write to + * buffer - Read-only buffer containing the data to be written + * count - The number of bytes to write + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ****************************************************************************/ + +int tiff_write(int fd, FAR const void *buffer, size_t count) +{ + ssize_t nbytes; + int errval; + + /* This loop retries the write until either: (1) it completes successfully, + * or (2) until an irrecoverble error occurs. + */ + + while (count > 0) + { + /* Do the write */ + + nbytes = write(fd, buffer, count); + + /* Check for an error */ + + if (nbytes < 0) + { + /* EINTR is not an error.. this just means that the write was + * interrupted by a signal. + */ + + errval = errno; + if (errval != EINTR) + { + /* Other errors are bad news and we will break out with an error */ + + return -errval; + } + } + + /* What if write returns some number of bytes other than the requested number? */ + + else + { + DEBUGASSERT(nbytes == count); + buffer += nbytes; + count -= nbytes; + } + } + + return OK; +} + +/**************************************************************************** + * Name: tiff_putint16 + * + * Description: + * Write two bytes to the outfile. + * + * Input Parameters: + * fd - File descriptor to be used. + * value - The 2-byte, uint16_t value to write + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ****************************************************************************/ + +int tiff_putint16(int fd, uint16_t value) +{ + uint8_t bytes[2]; + + /* Write the two bytes to the output file */ + + tiff_put16(bytes, value); + return tiff_write(fd, bytes, 2); +} + +/**************************************************************************** + * Name: tiff_putint32 + * + * Description: + * Write four bytes to the outfile. + * + * Input Parameters: + * fd - File descriptor to be used. + * value - The 4-byte, uint32_t value to write + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ****************************************************************************/ + +int tiff_putint32(int fd, uint32_t value) +{ + uint8_t bytes[4]; + + /* Write the four bytes to the output file */ + + tiff_put32(bytes, value); + return tiff_write(fd, bytes, 4); +} + +/**************************************************************************** + * Name: tiff_putstring + * + * Description: + * Write a string of fixed length to the outfile. + * + * Input Parameters: + * fd - File descriptor to be used. + * string - A pointer to the memory containing the string + * len - The length of the string (including the NUL terminator) + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ****************************************************************************/ + +int tiff_putstring(int fd, FAR const char *string, int len) +{ +#ifdef CONFIG_DEBUG_GRAPHICS + int actual = strlen(string); + + ASSERT(len = actual+1); +#endif + return tiff_write(fd, string, len); +} + +/**************************************************************************** + * Name: tiff_wordalign + * + * Description: + * Pad a file with zeros as necessary to achieve word alignament. + * + * Input Parameters: + * fd - File descriptor to be used. + * size - The current size of the file + * + * Returned Value: + * The new size of the file on success. A negated errno value on failure. + * + ****************************************************************************/ + +ssize_t tiff_wordalign(int fd, size_t size) +{ + unsigned int remainder; + int ret; + + remainder = size & 3; + if (remainder > 0) + { + unsigned int nbytes = 4 - remainder; + uint32_t value = 0; + + ret = tiff_write(fd, &value, nbytes); + if (ret < 0) + { + return (ssize_t)ret; + } + size += nbytes; + } + return size; +} diff --git a/apps/include/apps.h b/apps/include/apps.h new file mode 100644 index 0000000000..d494500d13 --- /dev/null +++ b/apps/include/apps.h @@ -0,0 +1,148 @@ +/**************************************************************************** + * include/apps/apps.h + * + * Copyright(C) 2011 Uros Platise. All rights reserved. + * Author: Uros Platise + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __INCLUDE_APPS_APPS_H +#define __INCLUDE_APPS_APPS_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +struct namedapp_s +{ + const char *name; /* Invocation name and as seen under /sbin/ */ + int priority; /* Use: SCHED_PRIORITY_DEFAULT */ + int stacksize; /* Desired stack size */ + main_t main; /* Entry point: main(int argc, char *argv[]) */ +}; + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* The "bindir" is file system that supports access to the named applications. + * It is typically mounted under /bin. + */ + +#ifdef CONFIG_APPS_BINDIR +struct mountpt_operations; +extern const struct mountpt_operations binfs_operations; +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Name: namedapp_isavail + * + * Description: + * Checks for availabiliy of application registerred during compile time. + * + * Input Parameter: + * filename - Name of the linked-in binary to be started. + * + * Returned Value: + * This is an end-user function, so it follows the normal convention: + * Returns index of builtin application. If it is not found then it + * returns -1 (ERROR) and sets errno appropriately. + * + ****************************************************************************/ + +EXTERN int namedapp_isavail(FAR const char *appname); + +/**************************************************************************** + * Name: namedapp_getname + * + * Description: + * Returns pointer to a name of built-in application pointed by the + * index. + * + * Input Parameter: + * index, from 0 and on ... + * + * Returned Value: + * Returns valid pointer pointing to the app name if index is valid. + * Otherwise NULL is returned. + * + ****************************************************************************/ + +EXTERN const char *namedapp_getname(int index); + +/**************************************************************************** + * Name: exec_namedapp + * + * Description: + * Executes builtin named application registered during compile time. + * New application is run in a separate task context (and thread). + * + * Input Parameter: + * filename - Name of the linked-in binary to be started. + * argv - Argument list + * + * Returned Value: + * This is an end-user function, so it follows the normal convention: + * Returns the PID of the exec'ed module. On failure, it.returns + * -1 (ERROR) and sets errno appropriately. + * + ****************************************************************************/ + +EXTERN int exec_namedapp(FAR const char *appname, FAR const char **argv); + +#undef EXTERN +#if defined(__cplusplus) +} +#endif +#endif /* __INCLUDE_APPS_APPS_H */ diff --git a/apps/include/ftpc.h b/apps/include/ftpc.h new file mode 100644 index 0000000000..ed5e3fab99 --- /dev/null +++ b/apps/include/ftpc.h @@ -0,0 +1,224 @@ +/**************************************************************************** + * apps/include/ftpc.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_INCLUDE_FTPC_H +#define __APPS_INCLUDE_FTPC_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* Configuration ************************************************************/ + +#ifndef CONFIG_FTP_DEFTIMEO +# define CONFIG_FTP_DEFTIMEO 30 +#endif + +#ifndef CONFIG_FTP_ANONPWD +# define CONFIG_FTP_ANONPWD "" +#endif + +#ifndef CONFIG_FTP_DEFPORT +# define CONFIG_FTP_DEFPORT 21 +#endif + +#ifndef CONFIG_FTP_MAXREPLY +# define CONFIG_FTP_MAXREPLY 256 +#endif + +#ifndef CONFIG_FTP_TMPDIR +# define CONFIG_FTP_TMPDIR "/tmp" +#endif + +#ifndef CONFIG_FTP_BUFSIZE +# define CONFIG_FTP_BUFSIZE 1024 +#endif + +#ifndef CONFIG_FTP_MAXPATH +# define CONFIG_FTP_MAXPATH 256 +#endif + +#ifndef CONFIG_FTP_SIGNAL +# define CONFIG_FTP_SIGNAL SIGUSR1 +#endif + +/* Interface arguments ******************************************************/ +/* These definitions describe how a put operation should be performed */ + +#define FTPC_PUT_NORMAL 0 /* Just PUT the file on the server */ +#define FTPC_PUT_APPEND 1 /* Append file to an existing file on the server */ +#define FTPC_PUT_UNIQUE 2 /* Create a uniquely named file on the server */ +#define FTPC_PUT_RESUME 3 /* Resume a previously started PUT transfer */ + +/* These definitions describe how a get operation should be performed */ + +#define FTPC_GET_NORMAL 0 /* Just GET the file from the server */ +#define FTPC_GET_APPEND 1 /* Append new file to an existing file */ +#define FTPC_GET_RESUME 3 /* Resume a previously started GET transfer */ + +/* Transfer mode encoding */ + +#define FTPC_XFRMODE_UNKNOWN 0 /* Nothing has been transferred yet */ +#define FTPC_XFRMODE_ASCII 1 /* Last transfer was ASCII mode */ +#define FTPC_XFRMODE_BINARY 2 /* Last transfer was binary mode */ + +/**************************************************************************** + * Public Types + ****************************************************************************/ +/* This "handle" describes the FTP session */ + +typedef FAR void *SESSION; + +/* This structure provides information to connect to a host FTP server. + * + * addr - The IPv4 address of the FTP server (or the proxy) for the FTP + * server. + * port - The port number on the FTP server to connect to (in host byte + * order). This is usually port 21 for FTP. You may set this + * value to zero to let FTPC select the default port number for + * you (it will use CONFIG_FTP_DEFPORT). + */ + +struct ftpc_connect_s +{ + struct in_addr addr; /* Server/proxy IP address */ + uint16_t port; /* Server/proxy port number (usually 21) in network order */ +}; + +/* This structure provides FTP login information */ + +struct ftpc_login_s +{ + FAR const char *uname; /* Login uname */ + FAR const char *pwd; /* Login pwd */ + FAR const char *rdir; /* Initial remote directory */ + bool pasv; /* true: passive connection mode */ +}; + +/* This structure describes one simple directory listing. The directory + * list container as well the individual filename strings are allocated. + * The number of names in tha actual allocated array is variable, given + * by the nnames field. + * + * Since the structure and file names are allocated, they must be freed + * by calling ftpc_dirfree() when they are no longer needed. Allocated + * name strings maby be "stolen" from the array but the pointer int the + * array should be nullified so that the string is not freed by + * ftpc_dirfree(). + */ + +struct ftpc_dirlist_s +{ + unsigned int nnames; /* Number of entries in name[] array */ + FAR char *name[1]; /* Filename with absolute path */ +}; + +#define SIZEOF_FTPC_DIRLIST(n) \ + (sizeof(struct ftpc_dirlist_s) + ((n)-1)*sizeof(FAR char *)) + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ +/* Connection management ****************************************************/ + +EXTERN SESSION ftpc_connect(FAR struct ftpc_connect_s *server); +EXTERN void ftpc_disconnect(SESSION handle); + +/* FTP commands *************************************************************/ + +EXTERN int ftpc_login(SESSION handle, FAR struct ftpc_login_s *login); +EXTERN int ftpc_quit(SESSION handle); + +EXTERN int ftpc_chdir(SESSION handle, FAR const char *path); +EXTERN FAR char *ftpc_rpwd(SESSION handle); +EXTERN int ftpc_cdup(SESSION handle); +EXTERN int ftpc_mkdir(SESSION handle, FAR const char *path); +EXTERN int ftpc_rmdir(SESSION handle, FAR const char *path); + +EXTERN int ftpc_unlink(SESSION handle, FAR const char *path); +EXTERN int ftpc_chmod(SESSION handle, FAR const char *path, FAR const char *mode); +EXTERN int ftpc_rename(SESSION handle, FAR const char *oldname, FAR const char *newname); +EXTERN off_t ftpc_filesize(SESSION handle, FAR const char *path); +EXTERN time_t ftpc_filetime(SESSION handle, FAR const char *filename); + +EXTERN int ftpc_idle(SESSION handle, unsigned int idletime); +EXTERN int ftpc_noop(SESSION handle); +EXTERN int ftpc_help(SESSION handle, FAR const char *arg); + +/* Directory listings *******************************************************/ + +EXTERN FAR struct ftpc_dirlist_s *ftpc_listdir(SESSION handle, + FAR const char *dirpath); +EXTERN void ftpc_dirfree(FAR struct ftpc_dirlist_s *dirlist); + +/* File transfers ***********************************************************/ + +EXTERN int ftpc_getfile(SESSION handle, FAR const char *rname, + FAR const char *lname, uint8_t how, uint8_t xfrmode); +EXTERN int ftp_putfile(SESSION handle, FAR const char *lname, + FAR const char *rname, uint8_t how, uint8_t xfrmode); + +/* FTP response *************************************************************/ + +EXTERN FAR char *ftpc_response(SESSION handle); + +#undef EXTERN +#ifdef __cplusplus +} +#endif +#endif /* __APPS_INCLUDE_FTPC_H */ diff --git a/apps/include/netutils/dhcpc.h b/apps/include/netutils/dhcpc.h new file mode 100644 index 0000000000..994a6713ee --- /dev/null +++ b/apps/include/netutils/dhcpc.h @@ -0,0 +1,85 @@ +/**************************************************************************** + * apps/netutils/dhcpc.n + * + * Copyright (C) 2007, 2009-2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * This logic was leveraged from uIP which also has a BSD-style license: + * + * Copyright (c) 2005, Swedish Institute of Computer Science + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef __APPS_NETUTILS_DHCPC_H +#define __APPS_NETUTILS_DHCPC_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +struct dhcpc_state +{ + struct in_addr serverid; + struct in_addr ipaddr; + struct in_addr netmask; + struct in_addr dnsaddr; + struct in_addr default_router; + uint32_t lease_time; /* Lease expires in this number of seconds */ +}; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +EXTERN void *dhcpc_open(const void *mac_addr, int mac_len); +EXTERN int dhcpc_request(void *handle, struct dhcpc_state *presult); +EXTERN void dhcpc_close(void *handle); + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __APPS_NETUTILS_DHCPC_H */ diff --git a/apps/include/netutils/dhcpd.h b/apps/include/netutils/dhcpd.h new file mode 100644 index 0000000000..b03415b206 --- /dev/null +++ b/apps/include/netutils/dhcpd.h @@ -0,0 +1,71 @@ +/**************************************************************************** + * apps/netutils/dhcpd.h + * + * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * This logic was leveraged from uIP which also has a BSD-style license: + * + * Copyright (c) 2005, Swedish Institute of Computer Science + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef __APPS_NETUTILS_DHCPD_H +#define __APPS_NETUTILS_DHCPD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +EXTERN int dhcpd_run(void); + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __APPS_NETUTILS_DHCPD_H */ diff --git a/apps/include/netutils/httpd.h b/apps/include/netutils/httpd.h new file mode 100644 index 0000000000..12f2a15111 --- /dev/null +++ b/apps/include/netutils/httpd.h @@ -0,0 +1,54 @@ +/**************************************************************************** + * apps/netutils/httpd.h + * + * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Based on uIP which also has a BSD style license: + * + * Author: Adam Dunkels + * Copyright (c) 2001-2005, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_NETUTILS_HTTPD_H +#define __APPS_NETUTILS_HTTPD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +extern void httpd_init(void); +extern int httpd_listen(void); + +#endif /* __APPS_NETUTILS_HTTPD_H */ diff --git a/apps/include/netutils/ipmsfilter.h b/apps/include/netutils/ipmsfilter.h new file mode 100755 index 0000000000..56088eca7f --- /dev/null +++ b/apps/include/netutils/ipmsfilter.h @@ -0,0 +1,101 @@ +/**************************************************************************** + * apps/netutils/ipmsfilter.h + * User interface to add/remove IP multicast address + * + * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_NETUTILS_IPMSFILTER_H +#define __APPS_NETUTILS_IPMSFILTER_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +#ifdef CONFIG_NET_IGMP + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifdef CONFIG_NET_IPv6 +# error "IGMP for IPv6 not supported" +#endif + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: ipmsfilter + * + * Description: + * Add or remove an IP address from a multicast filter set. + * (See netutils/uiplib/uip_ipmsfilter.c) + * + * Parameters: + * ifname The name of the interface to use, size must less than IMSFNAMSIZ + * multiaddr Multicast group address to add/remove + * fmode MCAST_INCLUDE: Add multicast address + * MCAST_EXCLUDE: Remove multicast address + * + * Return: + * 0 on sucess; Negated errno on failure + * + ****************************************************************************/ + +EXTERN int ipmsfilter(FAR const char *ifname, + FAR const struct in_addr *multiaddr, + uint32_t fmode); + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* CONFIG_NET_IGMP */ +#endif /* __APPS_NETUTILS_IPMSFILTER_H */ diff --git a/apps/include/netutils/resolv.h b/apps/include/netutils/resolv.h new file mode 100644 index 0000000000..a427c53949 --- /dev/null +++ b/apps/include/netutils/resolv.h @@ -0,0 +1,65 @@ +/* includes/apps/netutils/resolv.h + * DNS resolver code header file. + * Authtor Adam Dunkels + * + * Copyright (c) 2002-2003, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __APPS_NETUTILS_RESOLVE_H +#define __APPS_NETUTILS_RESOLVE_H + +#include + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +/* Functions. */ + +EXTERN int resolv_init(void); + +#ifdef CONFIG_NET_IPv6 +EXTERN void resolv_conf(const struct in6_addr *dnsserver); +EXTERN void resolv_getserver(const struct in_addr *dnsserver); +EXTERN int resolv_query(const char *name, struct sockaddr_in6 *addr); +#else +EXTERN void resolv_conf(const struct in_addr *dnsserver); +EXTERN void resolv_getserver(struct in_addr *dnsserver); +EXTERN int resolv_query(const char *name, struct sockaddr_in *addr); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __APPS_NETUTILS_RESOLVE_H */ diff --git a/apps/include/netutils/smtp.h b/apps/include/netutils/smtp.h new file mode 100644 index 0000000000..d1ea0c5d94 --- /dev/null +++ b/apps/include/netutils/smtp.h @@ -0,0 +1,66 @@ +/**************************************************************************** + * include/apps/netutils/smtp.h + * SMTP header file + * + * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Heavily leveraged from uIP 1.0 which also has a BSD-like license: + * + * Author: Adam Dunkels + * Copyright (c) 2002, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_NETUTILS_SMTP_H +#define __APPS_NETUTILS_SMTP_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Type Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +extern void *smtp_open(void); +extern void smtp_configure(void *handle, const char *localhostname, + const uip_ipaddr_t *paddr); +extern int smtp_send(void *handle, const char *to, const char *cc, + const char *from, const char *subject, + const char *msg, int msglen); +extern void smtp_close(void *handle); + +#endif /* __APPS_NETUTILS_SMTP_H */ diff --git a/apps/include/netutils/telnetd.h b/apps/include/netutils/telnetd.h new file mode 100644 index 0000000000..9d3d6feaf0 --- /dev/null +++ b/apps/include/netutils/telnetd.h @@ -0,0 +1,70 @@ +/**************************************************************************** + * include/apps/netutils/telnetd.h + * + * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * This is a leverage of similar logic from uIP: + * + * Author: Adam Dunkels + * Copyright (c) 2003, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + ****************************************************************************/ + +#ifndef __APPS_NETUTILS_TELNETD_H +#define __APPS_NETUTILS_TELNETD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +/* Start the telnet server -- does not return unless an error occurs */ + +EXTERN void telnetd_init(void); + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __APPS_NETUTILS_TELNETD_H */ diff --git a/apps/include/netutils/tftp.h b/apps/include/netutils/tftp.h new file mode 100644 index 0000000000..c00e37c72f --- /dev/null +++ b/apps/include/netutils/tftp.h @@ -0,0 +1,73 @@ +/**************************************************************************** + * include/apps/netutils/tftp.h + * + * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_NETUTILS_TFTP_H +#define __APPS_NETUTILS_TFTP_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Type Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +EXTERN int tftpget(const char *remote, const char *local, in_addr_t addr, bool binary); +EXTERN int tftpput(const char *local, const char *remote, in_addr_t addr, bool binary); + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __APPS_NETUTILS_TFTP_H */ \ No newline at end of file diff --git a/apps/include/netutils/thttpd.h b/apps/include/netutils/thttpd.h new file mode 100644 index 0000000000..959177219e --- /dev/null +++ b/apps/include/netutils/thttpd.h @@ -0,0 +1,101 @@ +/**************************************************************************** + * apps/netutils/thttpd.h + * + * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_NETUTILS_THTTPD_H +#define __APPS_NETUTILS_THTTPD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +/* These values must be provided by the user before the THTTPD task daemon + * is started: + * + * g_thttpdsymtab: A symbol table describing all of the symbols exported + * from the base system. These symbols are used to bind address references + * in CGI programs to NuttX. + * g_nsymbols: The number of symbols in g_thttpdsymtab[]. + * + * (See examples/nxflat and examples/thttpd for examples of how such a symbol + * table may be created.) + */ + +EXTERN FAR const struct symtab_s *g_thttpdsymtab; +EXTERN int g_thttpdnsymbols; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Function: thttpd_main + * + * Description: + * This function is the entrypoint into the THTTPD server. It does not + * return. It may be called, the normal mechanism for starting the server + * is: + * + * 1) Set is g_thttpdsymtab and g_thttpdnsymbols. The user is required + * to provide a symbol table to use for binding CGI programs (if CGI + * is enabled. See examples/nxflat and examples/thttpd for examples of + * how such a symbol table may be created.) + * 2) Call task_create() to start thttpd_main() + * + ****************************************************************************/ + +EXTERN int thttpd_main(int argc, char **argv); + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __APPS_NETUTILS_THTTPD_H */ diff --git a/apps/include/netutils/uiplib.h b/apps/include/netutils/uiplib.h new file mode 100644 index 0000000000..a149de63b2 --- /dev/null +++ b/apps/include/netutils/uiplib.h @@ -0,0 +1,129 @@ +/**************************************************************************** + * apps/netutils/uiplib.h + * Various non-standard APIs to support netutils. All non-standard and + * intended only for internal use. + * + * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Some of these APIs derive from uIP but all of them use the uip_ prefix + * to identify them as members of this library. uIP also has a BSD style + * license: + * + * Author: Adam Dunkels + * Copyright (c) 2002, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_NETUTILS_UIPLIB_H +#define __APPS_NETUTILS_UIPLIB_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* SOCK_DGRAM is the preferred socket type to use when we just want a + * socket for performing drive ioctls. However, we can't use SOCK_DRAM + * if UDP is disabled. + */ + +#ifdef CONFIG_NET_UDP +# define UIPLIB_SOCK_IOCTL SOCK_DGRAM +#else +# define UIPLIB_SOCK_IOCTL SOCK_STREAM +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/* Convert a textual representation of an IP address to a numerical representation. + * + * This function takes a textual representation of an IP address in + * the form a.b.c.d and converts it into a 4-byte array that can be + * used by other uIP functions. + * + * addrstr A pointer to a string containing the IP address in + * textual form. + * + * addr A pointer to a 4-byte array that will be filled in with + * the numerical representation of the address. + * + * Return: 0 If the IP address could not be parsed. + * Return: Non-zero If the IP address was parsed. + */ + +extern bool uiplib_ipaddrconv(const char *addrstr, uint8_t *addr); + +/* Get and set IP/MAC addresses (Ethernet L2 only) */ + +#ifdef CONFIG_NET_ETHERNET +extern int uip_setmacaddr(const char *ifname, const uint8_t *macaddr); +extern int uip_getmacaddr(const char *ifname, uint8_t *macaddr); +#endif + +/* IP address support */ + +#ifdef CONFIG_NET_IPv6 +extern int uip_gethostaddr(const char *ifname, struct in6_addr *addr); +extern int uip_sethostaddr(const char *ifname, const struct in6_addr *addr); +extern int uip_setdraddr(const char *ifname, const struct in6_addr *addr); +extern int uip_setnetmask(const char *ifname, const struct in6_addr *addr); +#else +extern int uip_gethostaddr(const char *ifname, struct in_addr *addr); +extern int uip_sethostaddr(const char *ifname, const struct in_addr *addr); +extern int uip_setdraddr(const char *ifname, const struct in_addr *addr); +extern int uip_setnetmask(const char *ifname, const struct in_addr *addr); +#endif + +/* HTTP support */ + +extern int uip_parsehttpurl(const char *url, uint16_t *port, + char *hostname, int hostlen, + char *filename, int namelen); + +/* Generic server logic */ + +extern void uip_server(uint16_t portno, pthread_startroutine_t handler, int stacksize); + +#endif /* __APPS_NETUTILS_UIPLIB_H */ diff --git a/apps/include/netutils/webclient.h b/apps/include/netutils/webclient.h new file mode 100644 index 0000000000..c80626e3bc --- /dev/null +++ b/apps/include/netutils/webclient.h @@ -0,0 +1,149 @@ +/**************************************************************************** + * include/apps/netutils/webclient.h + * Header file for the HTTP client + * + * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Based remotely on the uIP webclient which also has a BSD style license: + * + * Author: Adam Dunkels + * Copyright (c) 2002, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_NETUTILS_WEBCLIENT_H +#define __APPS_NETUTILS_WEBCLIENT_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#ifndef CONFIG_WEBCLIENT_HOST +# include +#endif +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef CONFIG_WEBCLIENT_MAXHTTPLINE +# define CONFIG_WEBCLIENT_MAXHTTPLINE 200 +#endif + +#ifndef CONFIG_WEBCLIENT_MAXMIMESIZE +# define CONFIG_WEBCLIENT_MAXMIMESIZE 32 +#endif + +#ifndef CONFIG_WEBCLIENT_MAXHOSTNAME +# define CONFIG_WEBCLIENT_MAXHOSTNAME 40 +#endif + +#ifndef CONFIG_WEBCLIENT_MAXFILENAME +# define CONFIG_WEBCLIENT_MAXFILENAME 100 +#endif + +/**************************************************************************** + * Public types + ****************************************************************************/ + +/* wget calls a user provided function of the follwoing type to process + * each received chuck of the incoming file data. If the system has a file + * system, then it may just write the data to a file. Or it may buffer the + * file in memory. To facilitate this latter case, the caller may modify + * the buffer address in this callback by writing to buffer and buflen. This + * may be used, for example, to implement double buffering. + * + * Input Parameters: + * buffer - A pointer to a pointer to a buffer. If the callee wishes to + * change the buffer address, it may do so in the callback by writing + * to buffer. + * offset - Offset to the beginning of valid data in the buffer. Offset + * is used to skip over any HTTP header info that may be at the + * beginning of the buffer. + * datend - The end+1 offset of valid data in the buffer. The total number + * of valid bytes is datend - offset. + * buflen - A pointer to the length of the buffer. If the callee wishes + * to change the size of the buffer, it may write to buflen. + */ + +typedef void (*wget_callback_t)(FAR char **buffer, int offset, + int datend, FAR int *buflen, FAR void *arg); + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Name: wget + * + * Description: + * Obtain the requested file from an HTTP server using the GET method. + * + * Note: If the function is passed a host name, it must already be in + * the resolver cache in order for the function to connect to the web + * server. It is therefore up to the calling module to implement the + * resolver calls and the signal handler used for reporting a resolv + * query answer. + * + * Input Parameters + * url - A pointer to a string containing either the full URL to + * the file to get (e.g., http://www.nutt.org/index.html, or + * http://192.168.23.1:80/index.html). + * buffer - A user provided buffer to receive the file data (also + * used for the outgoing GET request + * buflen - The size of the user provided buffer + * callback - As data is obtained from the host, this function is + * to dispose of each block of file data as it is received. + * arg - User argument passed to callback. + * + * Returned Value: + * 0: if the GET operation completed successfully; + * -1: On a failure with errno set appropriately + * + ****************************************************************************/ + +EXTERN int wget(FAR const char *url, FAR char *buffer, int buflen, + wget_callback_t callback, FAR void *arg); + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __APPS_NETUTILS_WEBCLIENT_H */ diff --git a/apps/include/nsh.h b/apps/include/nsh.h new file mode 100644 index 0000000000..6977e44bd6 --- /dev/null +++ b/apps/include/nsh.h @@ -0,0 +1,97 @@ +/**************************************************************************** + * include/apps/nsh.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __INCLUDE_APPS_NSHLIB_H +#define __INCLUDE_APPS_NSHLIB_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ + +#if CONFIG_RR_INTERVAL > 0 +# define SCHED_NSH SCHED_RR +#else +# define SCHED_NSH SCHED_FIFO +#endif + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/* Interfaces needed to initialize and execute the NuttShell (NSH). + * + * nsh_initialize() - This function function should be called one during + * application start-up prior to executing nsh_consolemain() or + * nsh_telnetmain(). + */ + +EXTERN void nsh_initialize(void); + +/* The following interfaces maybe to called or started with task_start to + * start an NSH instance. + * + * nsh_consolemain() starts NSH on the console (/dev/console). + * nsh_telnetmain() starts a telnet daemon that will allow multiple + * connections via telnet. + * + * These functions do not return. + */ + +EXTERN int nsh_consolemain(int argc, char *argv[]); +EXTERN int nsh_telnetmain(int argc, char *argv[]); + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __INCLUDE_APPS_NSHLIB_H */ diff --git a/apps/include/tiff.h b/apps/include/tiff.h new file mode 100644 index 0000000000..3530055992 --- /dev/null +++ b/apps/include/tiff.h @@ -0,0 +1,465 @@ +/************************************************************************************ + * apps/include/tiff.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Reference: + * "TIFF, Revision 6.0, Final," June 3, 1992, Adobe Developers Association. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ************************************************************************************/ + +#ifndef __APPS_INCLUDE_TIFF_H +#define __APPS_INCLUDE_TIFF_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include +#include +#include + +/************************************************************************************ + * Pre-Processor Definitions + ************************************************************************************/ +/* Configuration ********************************************************************/ + +/* TIFF File Format Definitions *****************************************************/ +/* Values for the IFD field type */ + +#define IFD_FIELD_BYTE 1 /* 8-bit unsigned integer */ +#define IFD_FIELD_ASCII 2 /* 8-bit byte that contains a 7-bit ASCII code. + * The last byte must be NUL */ +#define IFD_FIELD_SHORT 3 /* 16-bit (2-byte) unsigned integer */ +#define IFD_FIELD_LONG 4 /* 32-bit (4-byte) unsigned integer */ +#define IFD_FIELD_RATIONAL 5 /* Two LONGs: the first represents the + * numerator of a fraction, the second the + * denominator */ +#define IFD_FIELD_SBYTE 6 /* An 8-bit signed (twos-complement) integer */ +#define IFD_FIELD_UNDEFINED 7 /* An 8-bit byte that may contain anything, + * depending on the definition of the field */ +#define IFD_FIELD_SSHORT 8 /* A 16-bit (2-byte) signed (twos-complement) + * integer */ +#define IFD_FIELD_SLONG 9 /* A 32-bit (4-byte) signed (twos-complement) + * integer */ +#define IFD_FIELD_SRATIONAL 10 /* Two SLONG’s: the first represents the + * numerator of a fraction, the second the + * denominator */ +#define IFD_FIELD_FLOAT 11 /* Single precision (4-byte) IEEE format */ +#define IFD_FIELD_DOUBLE 12 /* Double precision (8-byte) IEEE format */ + +/* Values for the IFD tag type */ + +#define IFD_TAG_NEWSUBFILETYPE 254 /* NewSubfileType, LONG */ +# define TAG_NEWSUBFILETYPE_REDUCED (1 << 0) /* Bit 0: Reduced resolution verson of image */ +# define TAG_NEWSUBFILETYPE_SINGLE (1 << 1) /* Bit 1: Single page of a multi-page image */ +# define TAG_NEWSUBFILETYPE_TRANSP (1 << 2) /* Bit 2: Defines a transparency mask for image */ +#define IFD_TAG_SUBFILETYPE 255 /* SubfileType, SHORT */ +# define TAG_SUBFILETYPE_FULL 1 /* Full-resolution image data */ +# define TAG_SUBFILETYPE_REDUCED 2 /* Reduced-resolution image data */ +# define TAG_SUBFILETYPE_SINGLE 3 /* Single page of a multi-page image */ +#define IFD_TAG_IMAGEWIDTH 256 /* ImageLength, SHORT or LONG (Required) */ +#define IFD_TAG_IMAGELENGTH 257 /* ImageWidth, SHORT or LONG (Required) */ +#define IFD_TAG_BITSPERSAMPLE 258 /* BitsPerSample, SHORT (Required + * in greyscale and pallette-color image files) */ +#define IFD_TAG_COMPRESSION 259 /* Compression, SHORT (Required) */ +# define TAG_COMP_NONE 1 /* No compression */ +# define TAG_COMP_CCITT 2 /* CCITT Group 3 1-Dimensional Modified Huffman + * run length encoding */ +# define TAG_COMP_T4 3 /* CCITT T.4 bi-level encoding */ +# define TAG_COMP_T6 4 /* CCITT T.6 bi-level encoding */ +# define TAG_COMP_LZW 5 /* LZW */ +# define TAG_COMP_JPEG 6 /* LZW */ +# define TAG_COMP_PACKBITS 32773 /* PackBits compression */ +#define IFD_TAG_PMI 262 /* PhotometricInterpretation, SHORT (Required) */ +# define TAG_PMI_WHITE 0 /* WhiteIsZero */ +# define TAG_PMI_BLACK 1 /* BlackIsZero */ +# define TAG_PMI_RGB 2 /* RGB */ +# define TAG_PMI_PALETTE 3 /* Palette color */ +# define TAG_PMI_TRANSP 4 /* Transparency mask */ +# define TAG_PMI_CMYK 5 /* CMYK */ +# define TAG_PMI_YCbCr 6 /* YCbCr */ +# define TAG_PMI_CIELAB 8 /* 1976 CIE L*a*b* */ +#define IFD_TAG_THRESHHOLDING 263 /* Threshholding, SHORT */ +# define TAG_THRESHHOLD_NONE 1 /* No dithering or halftoning has been applied */ +# define TAG_THRESHHOLD_ORDERED 2 /* Ordered dither or halftone technique has been applied */ +# define TAG_THRESHHOLD_RANDOM 3 /* Randomized process has been applied */ +#define IFD_TAG_CELLWIDTH 264 /* CellWidth, SHORT */ +#define IFD_TAG_CELLLENGTH 265 /* CellLength, SHORT */ +#define IFD_TAG_FILLORDER 266 /* FillOrder, SHORT */ +# define TAG_FILLORDER_HIGH 1 /* Lower column values are stored in the + * higher-order bits */ +# define TAG_FILLORDER_LOW 2 /* Lower column values are stored in the + * lower-order bits */ +#define IFD_TAG_DOCUMENTNAME 269 /* DocumentName, ASCII */ +#define IFD_TAG_IMAGEDESCRIPTION 270 /* ImageDescription, ASCII */ +#define IFD_TAG_MAKE 271 /* Make, ASCII */ +#define IFD_TAG_MODEL 272 /* Model, ASCII */ +#define IFD_TAG_STRIPOFFSETS 273 /* StripOffsets, SHORT or LONG (Required) */ +#define IFD_TAG_ORIENTATION 274 /* Orientation, SHORT */ +# define TAG_ORIENTATION_TL 1 /* (0,0)=top left */ +# define TAG_ORIENTATION_TR 2 /* (0,0)=top right */ +# define TAG_ORIENTATION_BR 3 /* (0,0)=bottom right */ +# define TAG_ORIENTATION_BL 4 /* (0,0)=bottom left */ +# define TAG_ORIENTATION_LT 5 /* (0,0)=left top */ +# define TAG_ORIENTATION_RT 6 /* (0,0)=right top */ +# define TAG_ORIENTATION_RB 7 /* (0,0)=right bottom */ +# define TAG_ORIENTATION_LB 8 /* (0,0)=left bottom */ +#define IFD_TAG_SAMPLESPERPIXEL 277 /* SamplesPerPixel, SHORT (Required in + * RGB full color files) */ +#define IFD_TAG_ROWSPERSTRIP 278 /* RowsPerStrip, SHORT or LONG (Required) */ +#define IFD_TAG_STRIPCOUNTS 279 /* StripByteCounts, SHORT or LONG (Required) */ +#define IFD_TAG_MINSAMPLEVALUE 280 /* MinSampleValue, SHORT */ +#define IFD_TAG_MAXSAMPLEVALUE 281 /* MaxSampleValue, SHORT */ +#define IFD_TAG_XRESOLUTION 282 /* XResolution, RATIONAL (Required) */ +#define IFD_TAG_YRESOLUTION 283 /* YResolution, RATIONAL (Required) */ +#define IFD_TAG_PLANARCONFIG 284 /* PlanarConfiguration, SHORT */ +# define TAG_PLCONFIG_CHUNKY 1 /* Chunky format */ +# define TAG_PLCONFIG_PLANAR 2 /* Planar format */ +#define IFD_TAG_PAGENAME 285 /* PageName, ASCII */ +#define IFD_TAG_XPOSITION 286 /* XPosition, RATIONAL */ +#define IFD_TAG_YPOSITION 287 /* YPosition, RATIONAL */ +#define IFD_TAG_FREEOFFSETS 288 /* FreeOffsets, LONG */ +#define IFD_TAG_FREEBYTECOUNTS 289 /* FreeByteCounts, LONG */ +#define IFD_TAG_GRAYRESPONSEUNIT 290 /* GrayResponseUnit, SHORT */ +# define TAG_GRAYRESPUNIT_10THS 1 /* Number represents tenths of a unit */ +# define TAG_GRAYRESPUNIT_100THS 2 /* Number represents hundredths of a unit */ +# define TAG_GRAYRESPUNIT_1KTHS 3 /* Number represents thousandths of a unit */ +# define TAG_GRAYRESPUNIT_10KTHS 4 /* Number represents ten-thousandths of a unit */ +# define TAG_GRAYRESPUNIT_100KTHS 5 /* Number represents hundred-thousandths of a unit */ +#define IFD_TAG_GRAYRESPONSECURVE 291 /* GrayResponseCurve, SHORT */ +#define IFD_TAG_T4OPTIONS 292 /* T4Options, LONG */ +# define TAG_T4OPTIONS_2D (1 << 0) /* 2-dimensional coding */ +# define TAG_T4OPTIONS_NONE (1 << 1) /* Uncompressed mode */ +# define TAG_T4OPTIONS_FILL (1 << 2) /* Fill bits have been added */ +#define IFD_TAG_T6OPTIONS 293 /* T6Options, LONG */ +# define TAG_T6OPTIONS_NONE (1 << 1) /* Uncompressed mode allowed */ +#define IFD_TAG_RESUNIT 296 /* ResolutionUnit, SHORT (Required) */ +# define TAG_RESUNIT_NONE 1 /* No absolute unit of measurement */ +# define TAG_RESUNIT_INCH 2 /* Inch (default) */ +# define TAG_RESUNIT_CENTIMETER 3 /* Centimeter */ +#define IFD_TAG_PAGENUMBER 297 /* PageNumber, SHORT */ +#define IFD_TAG_TRANSFERFUNCTION 301 /* TransferFunction, SHORT */ +#define IFD_TAG_SOFTWARE 305 /* Software, ASCII */ +#define IFD_TAG_DATETIME 306 /* DateTime, ASCII */ +#define IFD_TAG_ARTIST 315 /* Artist, ASCII */ +#define IFD_TAG_HOSTCOMPUTER 316 /* HostComputer, ASCII */ +#define IFD_TAG_PREDICTOR 317 /* Predictor SHORT */ +# define TAG_PREDICTOR_NONE 1 /* No prediction scheme used before coding */ +# define TAG_PREDICTOR_HORIZ 2 /* Horizontal differencing */ +#define IFD_TAG_WHITEPOINT 318 /* WhitePoint, RATIONAL */ +#define IFD_TAG_PRIMARYCHROMA 319 /* PrimaryChromaticities, RATIONAL */ +#define IFD_TAG_COLORMAP 320 /* ColorMap, SHORT (Required in palette + * color image files) */ +#define IFD_TAG_HALFTONEHINTS 321 /* HalftoneHints, SHORT */ +#define IFD_TAG_TILEWIDTH 322 /* TileWidth, SHORT or LONG */ +#define IFD_TAG_TILELENGTH 323 /* TileLength, SHORT or LONG */ +#define IFD_TAG_TILEOFFSETS 324 /* TileOffsets, LONG */ +#define IFD_TAG_TILEBYTECOUNTS 325 /* TileByteCounts, SHORT or LONG */ +#define IFD_TAG_INKSET 332 /* InkSet, SHORT */ +# define TAG_INKSET_CMYK 1 /* CMYK */ +# define TAG_INKSET_OTHER 2 /* Not CMYK */ +#define IFD_TAG_INKNAMES 333 /* InkNames, ASCII */ +#define IFD_TAG_NUMBEROFINKS 334 /* NumberOfInks, SHORT */ +#define IFD_TAG_DOTRANGE 336 /* DotRange, BYTE or SHORT */ +#define IFD_TAG_TARGETPRINTER 337 /* TargetPrinter, ASCII */ +#define IFD_TAG_EXTRASAMPLES 338 /* ExtraSamples, SHORT */ +# define TAG_EXTSAMP_UNSPEC 0 /* Unspecified */ +# define TAG_EXTSAMP_ASSOCALPHA 1 /* Associated alpha data */ +# define TAG_EXTSAMP_UNASSALPHA 2 /* Unassociated alpha data */ +#define IFD_TAG_SAMPLEFORMAT 339 /* SampleFormat, SHORT */ +# define TAG_SAMPLEFMT_UNSIGED 1 /* Unsigned integer data */ +# define TAG_SAMPLEFMT_SIGNED 2 /* Two’s complement signed integer data */ +# define TAG_SAMPLEFMT_FLOAT 3 /* IEEE floating point data */ +# define TAG_SAMPLEFMT_UNDEFINED 4 /* Undefined data format */ +#define IFD_TAG_SMINSAMPLEVALUE 340 /* SMinSampleValue, type matches sample data */ +#define IFD_TAG_SMAXSAMPLEVALUE 341 /* SMaxSampleValue, type matches sample data */ +#define IFD_TAG_TRANSFERRANGE 342 /* TransferRange, SHORT */ +#define IFD_TAG_JPEGPROC 512 /* JPEGProc, SHORT */ +#define IFD_TAG_JPEGFMT 513 /* JPEGInterchangeFormat, LONG */ +#define IFD_TAG_JPEGLENGTH 514 /* JPEGInterchangeFormatLength, LONG */ +#define IFD_TAG_JPEGRESTART 515 /* JPEGRestartInterval, SHORT */ +#define IFD_TAG_JPEGLLPREDICTORS 517 /* JPEGLosslessPredictors, SHORT */ +#define IFD_TAG_JPEGPOINTXFORMS 518 /* JPEGPointTransforms, SHORT */ +#define IFD_TAG_JPEGQTABLES 519 /* JPEGQTables, LONG */ +#define IFD_TAG_JPEGDCTABLES 520 /* JPEGDCTables, LONG */ +#define IFD_TAG_JPEGACTABLES 521 /* JPEGACTables, LONG */ +#define IFD_TAG_YCbCrCOEFFS 529 /* YCbCrCoefficients, RATIONAL */ +#define IFD_TAG_YCbCrSUBSAMPLING 530 /* YCbCrSubSampling, SHORT */ +#define IFD_TAG_YCbCrPOSITIONING 531 /* YCbCrPositioning, SHORT */ +#define IFD_TAG_REFERENCEBW 532 /* ReferenceBlackWhite, RATIONAL */ +#define IFD_TAG_COPYRIGHT 33432 /* Copyright, ASCII */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ +/* TIFF File Format Structure *******************************************************/ +/* "A TIFF file begins with an 8-byte image file header that points to an + * image file directory (IFD). An image file directory contains information + * about the image, as well as pointers to the actual image data." + */ + +struct tiff_header_s +{ + uint8_t order[2]; /* 0-1: Byte order: "II"=little endian, "MM"=big endian */ + uint8_t magic[2]; /* 2-3: 42 in appropriate byte order */ + uint8_t offset[4]; /* 4-7: Offset to the first IFD */ +}; +#define SIZEOF_TIFF_HEADER 8 + +/* "An Image File Directory (IFD) consists of a 2-byte count of the number + * of directory entries (i.e., the number of fields), followed by a sequence + * of 12-byte field entries, followed by a 4-byte offset of the next IFD (or + * 0 if none). + * + * Each 12-byte IFD entry has the following format: + */ + +struct tiff_ifdentry_s +{ + uint8_t tag[2]; /* 0-1: The Tag that identifies the field */ + uint8_t type[2]; /* 2-3 The field Type */ + uint8_t count[4]; /* 4-7: The number of values of the indicated type */ + uint8_t offset[4]; /* 8-11: The Value Offset (or the value itself) */ +}; +#define SIZEOF_IFD_ENTRY 12 + +/************************************************************************************/ +/* Structures needed to interface with the TIFF file creation library )and also + * structures used only internally by the TIFF file creation library). + */ + +/* This structure describes on strip in tmpfile2 */ + +struct tiff_strip_s +{ + uint32_t offset; /* Offset to the strip data in tmpfile1 */ + uint32_t count; /* Count of pixels in the strip */ +}; + +/* This structure is used only internally by the TIFF file creation library to + * manage file offsets. + */ + +struct tiff_filefmt_s +{ + uint16_t nifdentries; /* Number of IFD entries */ + uint16_t soifdoffset; /* Offset to StripOffset IFD entry */ + uint16_t sbcifdoffset; /* Offset to StripByteCount IFD entry */ + uint16_t valoffset; /* Offset to first values */ + uint16_t xresoffset; /* Offset to XResolution values */ + uint16_t yresoffset; /* Offset to yResolution values */ + uint16_t swoffset; /* Offset to Software string */ + uint16_t dateoffset; /* Offset to DateTime string */ + uint16_t sbcoffset; /* Offset to StripByteCount values */ +}; + +/* These type is used to hold information about the TIFF file under + * construction + */ + +struct tiff_info_s +{ + /* The first fields are used to pass information to the TIFF file creation + * logic via tiff_initialize(). + * + * Filenames. Three file names are required. (1) path to the final + * output file and (2) two paths to temporary files. One temporary file + * (tmpfile1) will be used to hold the strip image data and the other + * (tmpfile2) will be used to hold strip offset and count information. + * + * colorfmt - Specifies the form of the color data that will be provided + * in the strip data. These are the FB_FMT_* definitions + * provided in include/nuttx/fb.h. Only the following values + * are supported: + * + * FB_FMT_Y1 BPP=1, monochrome, 0=black + * FB_FMT_Y4 BPP=4, 4-bit greyscale, 0=black + * FB_FMT_Y8 BPP=8, 8-bit greyscale, 0=black + * FB_FMT_RGB16_565 BPP=16 R=6, G=6, B=5 + * FB_FMT_RGB24 BPP=24 R=8, G=8, B=8 + * + * rps - TIFF RowsPerStrip + * imgwidth - TIFF ImageWidth, Number of columns in the image + * imgheight - TIFF ImageLength, Number of rows in the image + */ + + FAR const char *outfile; /* Full path to the final output file name */ + FAR const char *tmpfile1; /* Full path to first temporary file */ + FAR const char *tmpfile2; /* Full path to second temporary file */ + + uint8_t colorfmt; /* See FB_FMT_* definitions in include/nuttx/fb.h */ + nxgl_coord_t rps; /* TIFF RowsPerStrip */ + nxgl_coord_t imgwidth; /* TIFF ImageWidth, Number of columns in the image */ + nxgl_coord_t imgheight; /* TIFF ImageLength, Number of rows in the image */ + + /* The caller must provide an I/O buffer as well. This I/O buffer will + * used for color conversions and as the intermediate buffer for copying + * files. The larger the buffer, the better the performance. + */ + + FAR uint8_t *iobuffer; /* IO buffer allocated by the caller */ + unsigned int iosize; /* The size of the I/O buffer in bytes */ + + /* The second set of fields are used only internally by the TIFF file + * creation logic. These fields must be set to zero initially by the + * caller of tiff_initialize(). User logic should not depend upon any + * definitions in the following -- they are subject to change without + * notice. They are only exposed here so that the caller can allocate + * memory for their storage. + */ + + uint8_t imgflags; /* Bit-encoded image flags */ + nxgl_coord_t nstrips; /* Number of strips in tmpfile3 */ + size_t pps; /* Pixels per strip */ + size_t bps; /* Bytes per strip */ + int outfd; /* outfile file descriptor */ + int tmp1fd; /* tmpfile1 file descriptor */ + int tmp2fd; /* tmpfile2 file descriptor */ + off_t outsize; /* Current size of outfile */ + off_t tmp1size; /* Current size of tmpfile1 */ + off_t tmp2size; /* Current size of tmpfile2 */ + + /* Points to an internal constant structure of file offsets */ + + FAR const struct tiff_filefmt_s *filefmt; +}; + +/************************************************************************************ + * Public Function Prototypes + ************************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +/************************************************************************************ + * Name: tiff_initialize + * + * Description: + * Setup to create a new TIFF file. The overall steps to creating a TIFF file are + * as follows: + * + * 1) Create an initialize a struct tiff_info_s instance + * 2) Call tiff_initialize() to setup the file creation + * 3) Call tiff_addstrip() repeatedly to add strips to the graphic image + * 4) Call tiff_finalize() to complete the file creation. + * + * Input Parameters: + * info - A pointer to the caller allocated parameter passing/TIFF state instance. + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ************************************************************************************/ + +EXTERN int tiff_initialize(FAR struct tiff_info_s *info); + +/************************************************************************************ + * Name: tiff_addstrip + * + * Description: + * Add an image data strip. The size of the strip in pixels must be equal to + * the RowsPerStrip x ImageWidth values that were provided to tiff_initialize(). + * + * Input Parameters: + * info - A pointer to the caller allocated parameter passing/TIFF state instance. + * buffer - A buffer containing a single row of data. + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ************************************************************************************/ + +EXTERN int tiff_addstrip(FAR struct tiff_info_s *info, FAR const uint8_t *strip); + +/************************************************************************************ + * Name: tiff_finalize + * + * Description: + * Finalize the TIFF output file, completing the TIFF file creation steps. + * + * Input Parameters: + * info - A pointer to the caller allocated parameter passing/TIFF state instance. + * + * Returned Value: + * Zero (OK) on success. A negated errno value on failure. + * + ************************************************************************************/ + +EXTERN int tiff_finalize(FAR struct tiff_info_s *info); + +/************************************************************************************ + * Name: tiff_abort + * + * Description: + * Abort the TIFF file creation and create-up resources. + * + * Input Parameters: + * info - A pointer to the caller allocated parameter passing/TIFF state instance. + * + * Returned Value: + * None + * + ************************************************************************************/ + +EXTERN void tiff_abort(FAR struct tiff_info_s *info); + +/************************************************************************************ + * Name: tiff_put/get16/32 + * + * Description: + * Put and get 16 and 32 values in the correct byte order at the specified position. + * + * Input Parameters: + * dest - The location to store the multi-byte data (put only) + * src - The location to get the multi-byte data (get only) + * + * Returned Value: + * None (put) + * The extracted value (get) + * + ************************************************************************************/ + +EXTERN void tiff_put16(FAR uint8_t *dest, uint16_t value); +EXTERN void tiff_put32(FAR uint8_t *dest, uint32_t value); +EXTERN uint16_t tiff_get16(FAR uint8_t *dest); +EXTERN uint32_t tiff_get32(FAR uint8_t *dest); + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __APPS_INCLUDE_TIFF_H */ diff --git a/apps/interpreters/Makefile b/apps/interpreters/Makefile new file mode 100644 index 0000000000..1ef9c7439c --- /dev/null +++ b/apps/interpreters/Makefile @@ -0,0 +1,70 @@ +############################################################################ +# apps/interpreters/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config # Current configuration + +# Sub-directories containing interpreter runtime + +SUBDIRS = pcode ficl + +# Create the list of installed runtime modules (INSTALLED_DIRS) + +define ADD_DIRECTORY +INSTALLED_DIRS += ${shell if [ -r $1/Makefile ]; then echo "$1"; fi} +endef + +$(foreach DIR, $(SUBDIRS), $(eval $(call ADD_DIRECTORY,$(DIR)))) + +all: nothing +.PHONY: nothing context depend clean distclean + +nothing: + +context: + +depend: + @for dir in $(INSTALLED_DIRS) ; do \ + $(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done + +clean: + @for dir in $(INSTALLED_DIRS) ; do \ + $(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done + +distclean: clean + @for dir in $(INSTALLED_DIRS) ; do \ + $(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done diff --git a/apps/interpreters/README.txt b/apps/interpreters/README.txt new file mode 100644 index 0000000000..8cf7ce321b --- /dev/null +++ b/apps/interpreters/README.txt @@ -0,0 +1,67 @@ +apps/interpreters README file +============================= + +This apps/ directory is set aside to hold interpreters that may be +incorporated into NuttX. + +ficl +---- + + This is DIY port of Ficl (the "Forth Inspired Command Language"). See + http://ficl.sourceforge.net/. It is a "DIY" port because the Ficl source + is not in that directory, only an environment and instructions that will + let you build Ficl under NuttX. The rest is up to you. + +pcode +----- + + At present, only the NuttX Pascal add-on is supported. This NuttX add-on + must be downloaded separately (or is available in an SVN snapshot in the + misc/pascal directory). + + This Pascal add-on must be installed into the NuttX apps/ directory. After + unpacking the Pascal add-on package, an installation script and README.txt + instructions can be found at pascal/nuttx. + + INSTALL.sh -- The script that performs the operation. Usage: + + ./INSTALL.sh [-16|-32] + + If you are using this standard NuttX apps/ package, the correct + location for the is apps/interpreters. That is + where the examples and build logic will expect to find the pcode + sub-directory. + + Example: + + ./INSTALL.sh -16 $PWD/../../../apps/interpreters + + After installation, the NuttX apps/interpresters directory will contain + the following files + + pcode + |-- Makefile + |-- include + | `-- Common header files + |-- libboff + | `-- Pascal object format (POFF) library + `--insn + |-- include + | `-- model-specific header files + `-- prun + `-- model-specific source files + + pashello + + There is a simple Pascal example at apps/examples/pashello. This is the + standard "Hello, World!" example written in Pascal and interpreted from + Pascal P-Code at runtime. To use this example, place the following in + your appconfig file" + + # Path to example in apps/examples containing the user_start entry point + + CONFIGURED_APPS += examples/pashello + + # Path to the Pascal p-code runtime interpreter module + + CONFIGURED_APPS += interpreters/pcode diff --git a/apps/interpreters/ficl/Makefile b/apps/interpreters/ficl/Makefile new file mode 100644 index 0000000000..183246b67a --- /dev/null +++ b/apps/interpreters/ficl/Makefile @@ -0,0 +1,118 @@ +############################################################################ +# apps/interpreters/ficl/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +BUILDDIR := ${shell pwd | sed -e 's/ /\\ /g'} + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# Tools + +INCDIR = $(TOPDIR)/tools/incdir.sh + +ifeq ($(WINTOOL),y) +INCDIROPT = -w +endif + +# Include paths + +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(BUILDDIR)/$(FICL_SUBDIR) $(BUILDDIR)/src} + +# Source Files + +ASRCS = +CXXSRCS = +CSRCS = nuttx.c + +-include Make.srcs + +ASRCS += $(FICL_ASRCS) +CXXSRCS += $(FICL_CXXSRCS) +CSRCS += $(FICL_CSRCS) + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOT_DEPPATH = --dep-path . +SRC_DEPPATH = --dep-path src + +VPATH = src:$(FICL_SUBDIR) + +all: .built +.PHONY: debug context depend clean distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +debug: + @#echo "FICL: $(FICL_SUBDIR)" + @#echo "VPATH: $(VPATH)" + @#echo "CFLAGS: $(CFLAGS)" + +.built: debug $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: debug Makefile $(SRCS) + @$(MKDEP) $(ROOT_DEPPATH) $(SRC_DEPPATH) $(FICL_DEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/interpreters/ficl/README.txt b/apps/interpreters/ficl/README.txt new file mode 100755 index 0000000000..d775db1e82 --- /dev/null +++ b/apps/interpreters/ficl/README.txt @@ -0,0 +1,42 @@ +apps/interpreter/README.txt +=========================== + +Ficl is a programming language interpreter designed to be embedded into +other systems as a command, macro, and development prototyping language. +Ficl is an acronym for "Forth Inspired Command Language". See +http://ficl.sourceforge.net/ + +Build Instructions +------------------ + +Disclaimer: This installation steps have only been exercised using Ficl +4.1.0. With new versions you will likely have to make some adjustments +to this instructtions or to the files within this directory. This of this +information as "recommendations" -- not necessarily proven instructions. + +1. CD to apps/interpreters/ficl + +2. Download Ficl: http://sourceforge.net/projects/ficl/files/ + +3. Uznip the Ficl compressed file. + + For example, 'unzip ficl-4.1.0.zip' will leave the file + apps/interpreters/ficl/ficl-4.1.0 + +4. Configure to build Ficl in the apps/interpreters/ficl directory using + the configure.sh script. + + For example, './configure.sh ficl-4.1.0' will leave the Makefile + fragment 'Make.srcs' in the ficl build directory. + +5. Create your NuttX configuration. The appconfig file should include + (1) the path to your application code, and (2) the path to the Ficl + build directory. That latter would appear as the following line in + your appconfig file: + + CONFIGURED_APPS += interpreters/ficl + + 6. Configure and build NuttX. On successful completion, the Ficl objects + will be available in apps/libapps.a and that NuttX binary will be + linked against that file. Of course, Ficl will do nothing unless + you have written some application code that uses it! diff --git a/apps/interpreters/ficl/configure.sh b/apps/interpreters/ficl/configure.sh new file mode 100755 index 0000000000..cadc1d48a1 --- /dev/null +++ b/apps/interpreters/ficl/configure.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +USAGE="$0 " + +FICLDIR=$1 +if [ -z "${FICLDIR}" ]; then + echo "Missing command line argument" + echo $USAGE + exit 1 +fi + +if [ ! -d "${FICLDIR}" ]; then + echo "Sub-directory ${FICLDIR} does not exist" + echo $USAGE + exit 1 +fi + +if [ ! -r "${FICLDIR}/Makefile" ]; then + echo "Readable ${FICLDIR}/Makefile does not exist" + echo $USAGE + exit 1 +fi + +OBJECTS=`grep "^OBJECTS" ${FICLDIR}/Makefile` +if [ -z "${OBJECTS}" ]; then + echo "No OBJECTS found in ${FICLDIR}/Makefile" + echo $USAGE + exit 1 +fi + +OBJLIST=`echo ${OBJECTS} | cut -d'=' -f2 | sed -e "s/unix\.o//g"` + +rm -f Make.srcs +echo "# apps/interpreters/ficl/Make.obs" >> Make.srcs +echo "# Auto-generated file.. Do not edit" >> Make.srcs +echo "" >> Make.srcs +echo "FICL_SUBDIR = ${1}" >> Make.srcs +echo "FICL_DEPPATH = --dep-path ${1}" >> Make.srcs + +unset CSRCS +for OBJ in ${OBJLIST}; do + SRC=`echo ${OBJ} | sed -e "s/\.o/\.c/g"` + CSRCS=${CSRCS}" ${SRC}" +done +echo "FICL_ASRCS = " >> Make.srcs +echo "FICL_CXXSRCS = " >> Make.srcs +echo "FICL_CSRCS = ${CSRCS}" >> Make.srcs diff --git a/apps/interpreters/ficl/src/nuttx.c b/apps/interpreters/ficl/src/nuttx.c new file mode 100644 index 0000000000..16b3fa1dbc --- /dev/null +++ b/apps/interpreters/ficl/src/nuttx.c @@ -0,0 +1,65 @@ +#include +#include + +#include +#include +#include + +#include "ficl.h" + +void *ficlMalloc(size_t size) +{ + return malloc(size); +} + +void *ficlRealloc(void *p, size_t size) +{ + return realloc(p, size); +} + +void ficlFree(void *p) +{ + free(p); +} + +void ficlCallbackDefaultTextOut(ficlCallback *callback, char *message) +{ + FICL_IGNORE(callback); + if (message != NULL) + fputs(message, stdout); + else + fflush(stdout); + return; +} + +int ficlFileStatus(char *filename, int *status) +{ + struct stat statbuf; + if (stat(filename, &statbuf) == 0) + { + *status = statbuf.st_mode; + return 0; + } + *status = ENOENT; + return -1; +} + +long ficlFileSize(ficlFile *ff) +{ + struct stat statbuf; + if (ff == NULL) + return -1; + + statbuf.st_size = -1; + if (fstat(fileno(ff->f), &statbuf) != 0) + return -1; + + return statbuf.st_size; +} + +void ficlSystemCompilePlatform(ficlSystem *system) +{ + return; +} + + diff --git a/apps/interpreters/ficl/src/nuttx.h b/apps/interpreters/ficl/src/nuttx.h new file mode 100644 index 0000000000..e44031066b --- /dev/null +++ b/apps/interpreters/ficl/src/nuttx.h @@ -0,0 +1,19 @@ +#include + +typedef int8_t ficlInteger8; +typedef uint8_t ficlUnsigned8; +typedef int16_t ficlInteger16; +typedef uint16_t ficlUnsigned16; +typedef int32_t ficlInteger32; +typedef uint32_t ficlUnsigned32; + +typedef intptr_t ficlInteger; +typedef uintptr_t ficlUnsigned; +typedef float ficlFloat; + +#define FICL_PLATFORM_BASIC_TYPES (1) +#define FICL_PLATFORM_HAS_2INTEGER (0) +#define FICL_PLATFORM_HAS_FTRUNCATE (0) + +#define FICL_PLATFORM_OS "ansi" +#define FICL_PLATFORM_ARCHITECTURE "unknown" diff --git a/apps/namedapp/Makefile b/apps/namedapp/Makefile new file mode 100644 index 0000000000..fba8fb1ff9 --- /dev/null +++ b/apps/namedapp/Makefile @@ -0,0 +1,106 @@ +############################################################################ +# apps/nshlib/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# NSH Library + +# Source and object files + +ASRCS = +CSRCS = namedapp.c exec_namedapp.c + +ifeq ($(CONFIG_APPS_BINDIR),y) +CSRCS += binfs.c +endif + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . +VPATH = + +# Build Targets + +all: .built +.PHONY: .context context depend clean distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +.context: + @echo "/* List of application requirements, generated during make context. */" > namedapp_list.h + @echo "/* List of application entry points, generated during make context. */" > namedapp_proto.h + @touch $@ + +context: .context + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f .context Make.dep .depend + @rm -f namedapp_list.h + @rm -f namedapp_proto.h + +-include Make.dep + diff --git a/apps/namedapp/binfs.c b/apps/namedapp/binfs.c new file mode 100644 index 0000000000..106c1444c4 --- /dev/null +++ b/apps/namedapp/binfs.c @@ -0,0 +1,596 @@ +/**************************************************************************** + * apps/namedapps/binfs.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "namedapp.h" + +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_APPS_BINDIR) + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/* This structure represents the overall mountpoint state. An instance of this + * structure is retained as inode private data on each mountpoint that is + * mounted with a fat32 filesystem. + */ + +struct binfs_state_s +{ + sem_t bm_sem; /* Used to assume thread-safe access */ +}; + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static void binfs_semtake(struct binfs_state_s *bm); +static inline void binfs_semgive(struct binfs_state_s *bm); +static int binfs_open(FAR struct file *filep, const char *relpath, + int oflags, mode_t mode); +static int binfs_close(FAR struct file *filep); +static ssize_t binfs_read(FAR struct file *filep, char *buffer, size_t buflen); +static int binfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg); + +static int binfs_opendir(struct inode *mountpt, const char *relpath, + struct fs_dirent_s *dir); +static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir); +static int binfs_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir); + +static int binfs_bind(FAR struct inode *blkdriver, const void *data, + void **handle); +static int binfs_unbind(void *handle, FAR struct inode **blkdriver); +static int binfs_statfs(struct inode *mountpt, struct statfs *buf); + +static int binfs_stat(struct inode *mountpt, const char *relpath, struct stat *buf); + +/**************************************************************************** + * Private Variables + ****************************************************************************/ + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/* See fs_mount.c -- this structure is explicitly externed there. + * We use the old-fashioned kind of initializers so that this will compile + * with any compiler. + */ + +const struct mountpt_operations binfs_operations = +{ + binfs_open, /* open */ + binfs_close, /* close */ + binfs_read, /* read */ + NULL, /* write */ + NULL, /* seek */ + binfs_ioctl, /* ioctl */ + NULL, /* sync */ + + binfs_opendir, /* opendir */ + NULL, /* closedir */ + binfs_readdir, /* readdir */ + binfs_rewinddir, /* rewinddir */ + + binfs_bind, /* bind */ + binfs_unbind, /* unbind */ + binfs_statfs, /* statfs */ + + NULL, /* unlink */ + NULL, /* mkdir */ + NULL, /* rmdir */ + NULL, /* rename */ + binfs_stat /* stat */ +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: binfs_semtake + ****************************************************************************/ + +static void binfs_semtake(struct binfs_state_s *bm) +{ + /* Take the semaphore (perhaps waiting) */ + + while (sem_wait(&bm->bm_sem) != 0) + { + /* The only case that an error should occur here is if + * the wait was awakened by a signal. + */ + + ASSERT(errno == EINTR); + } +} + +/**************************************************************************** + * Name: binfs_semgive + ****************************************************************************/ + +static inline void binfs_semgive(struct binfs_state_s *bm) +{ + sem_post(&bm->bm_sem); +} + +/**************************************************************************** + * Name: binfs_open + ****************************************************************************/ + +static int binfs_open(FAR struct file *filep, const char *relpath, + int oflags, mode_t mode) +{ + struct binfs_state_s *bm; + int ret = -ENOSYS; + + fvdbg("Open '%s'\n", relpath); + + /* Sanity checks */ + + DEBUGASSERT(filep->f_priv == NULL && filep->f_inode != NULL); + + /* mountpoint private data from the inode reference from the file + * structure + */ + + bm = (struct binfs_state_s*)filep->f_inode->i_private; + DEBUGASSERT(bm != NULL); + + /* BINFS is read-only. Any attempt to open with any kind of write + * access is not permitted. + */ + + if ((oflags & O_WRONLY) != 0 || (oflags & O_RDONLY) == 0) + { + fdbg("Only O_RDONLY supported\n"); + ret = -EACCES; + } + + /* Save open-specific state in filep->f_priv */ + + /* Opening of elements within the pseudo-file system is not yet supported */ + + return ret; +} + +/**************************************************************************** + * Name: binfs_close + ****************************************************************************/ + +static int binfs_close(FAR struct file *filep) +{ + struct binfs_state_s *bm; + int ret = -ENOSYS; + + fvdbg("Closing\n"); + + /* Sanity checks */ + + DEBUGASSERT(filep->f_priv != NULL && filep->f_inode != NULL); + + /* Recover the open file state from the struct file instance */ + /* bf = filep->f_priv; */ + + /* Recover the file system state from the inode */ + + bm = filep->f_inode->i_private; + DEBUGASSERT(bm != NULL); + + /* Free the open file state */ + /* free(bf); */ + + filep->f_priv = NULL; + + /* Since open() is not yet supported, neither is close(). */ + + return ret; +} + +/**************************************************************************** + * Name: binfs_read + ****************************************************************************/ + +static ssize_t binfs_read(FAR struct file *filep, char *buffer, size_t buflen) +{ + struct binfs_state_s *bm; + + fvdbg("Read %d bytes from offset %d\n", buflen, filep->f_pos); + + /* Sanity checks */ + + DEBUGASSERT(filep->f_priv != NULL && filep->f_inode != NULL); + + /* Recover the open file state data from the struct file instance */ + /* bf = filep->f_priv; */ + + /* Recover the file system state from the inode */ + + bm = filep->f_inode->i_private; + DEBUGASSERT(bm != NULL); + + /* Since open is not yet supported, neither is reading */ + + return -ENOSYS; +} + +/**************************************************************************** + * Name: binfs_ioctl + ****************************************************************************/ + +static int binfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg) +{ + struct binfs_state_s *bm; + + fvdbg("cmd: %d arg: %08lx\n", cmd, arg); + + /* Sanity checks */ + + DEBUGASSERT(filep->f_priv != NULL && filep->f_inode != NULL); + + /* Recover the open file state from the struct file instance */ + /* bf = filep->f_priv; */ + + /* Recover the file system state from the inode */ + + bm = filep->f_inode->i_private; + DEBUGASSERT(bm != NULL); + + /* No ioctl commands yet supported */ + + return -ENOTTY; +} + +/**************************************************************************** + * Name: binfs_opendir + * + * Description: + * Open a directory for read access + * + ****************************************************************************/ + +static int binfs_opendir(struct inode *mountpt, const char *relpath, + struct fs_dirent_s *dir) +{ + struct binfs_state_s *bm; + int ret; + + fvdbg("relpath: \"%s\"\n", relpath ? relpath : "NULL"); + + /* Sanity checks */ + + DEBUGASSERT(mountpt != NULL && mountpt->i_private != NULL); + + /* Recover the file system state from the inode instance */ + + bm = mountpt->i_private; + binfs_semtake(bm); + + /* The requested directory must be the volume-relative "root" directory */ + + if (relpath && relpath[0] != '\0') + { + ret = -ENOENT; + goto errout_with_semaphore; + } + + /* Set the index to the first entry */ + + dir->u.binfs.fb_index = 0; + ret = OK; + +errout_with_semaphore: + binfs_semgive(bm); + return ret; +} + +/**************************************************************************** + * Name: binfs_readdir + * + * Description: Read the next directory entry + * + ****************************************************************************/ + +static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir) +{ + struct binfs_state_s *bm; + unsigned int index; + int ret; + + /* Sanity checks */ + + DEBUGASSERT(mountpt != NULL && mountpt->i_private != NULL); + + /* Recover the file system state from the inode instance */ + + bm = mountpt->i_private; + binfs_semtake(bm); + + /* Have we reached the end of the directory */ + + index = dir->u.binfs.fb_index; + if (namedapps[index].name == NULL) + { + /* We signal the end of the directory by returning the + * special error -ENOENT + */ + + fvdbg("Entry %d: End of directory\n", index); + ret = -ENOENT; + } + else + { + /* Save the filename and file type */ + + fvdbg("Entry %d: \"%s\"\n", index, namedapps[index].name); + dir->fd_dir.d_type = DTYPE_FILE; + strncpy(dir->fd_dir.d_name, namedapps[index].name, NAME_MAX+1); + + /* The application list is terminated by an entry with a NULL name. + * Therefore, there is at least one more entry in the list. + */ + + index++; + + /* Set up the next directory entry offset. NOTE that we could use the + * standard f_pos instead of our own private fb_index. + */ + + dir->u.binfs.fb_index = index; + ret = OK; + } + + binfs_semgive(bm); + return ret; +} + +/**************************************************************************** + * Name: binfs_rewindir + * + * Description: Reset directory read to the first entry + * + ****************************************************************************/ + +static int binfs_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir) +{ + struct binfs_state_s *bm; + + fvdbg("Entry\n"); + + /* Sanity checks */ + + DEBUGASSERT(mountpt != NULL && mountpt->i_private != NULL); + + /* Recover the file system state from the inode instance */ + + bm = mountpt->i_private; + binfs_semtake(bm); + + dir->u.binfs.fb_index = 0; + + binfs_semgive(bm); + return OK; +} + +/**************************************************************************** + * Name: binfs_bind + * + * Description: This implements a portion of the mount operation. This + * function allocates and initializes the mountpoint private data and + * binds the blockdriver inode to the filesystem private data. The final + * binding of the private data (containing the blockdriver) to the + * mountpoint is performed by mount(). + * + ****************************************************************************/ + +static int binfs_bind(FAR struct inode *blkdriver, const void *data, + void **handle) +{ + struct binfs_state_s *bm; + + fvdbg("Entry\n"); + + /* Create an instance of the mountpt state structure */ + + bm = (struct binfs_state_s *)zalloc(sizeof(struct binfs_state_s)); + if (!bm) + { + fdbg("Failed to allocate mountpoint structure\n"); + return -ENOMEM; + } + + /* Initialize the allocated mountpt state structure. The filesystem is + * responsible for one reference ont the blkdriver inode and does not + * have to addref() here (but does have to release in ubind(). + */ + + sem_init(&bm->bm_sem, 0, 1); /* Initialize the semaphore that controls access */ + + /* Mounted! */ + + *handle = (void*)bm; + return OK; +} + +/**************************************************************************** + * Name: binfs_unbind + * + * Description: This implements the filesystem portion of the umount + * operation. + * + ****************************************************************************/ + +static int binfs_unbind(void *handle, FAR struct inode **blkdriver) +{ + struct binfs_state_s *bm = (struct binfs_state_s*)handle; + + fvdbg("Entry\n"); + +#ifdef CONFIG_DEBUG + if (!bm) + { + return -EINVAL; + } +#endif + + /* Check if there are sill any files opened on the filesystem. */ + + /* Release the mountpoint private data */ + + sem_destroy(&bm->bm_sem); + return OK; +} + +/**************************************************************************** + * Name: binfs_statfs + * + * Description: Return filesystem statistics + * + ****************************************************************************/ + +static int binfs_statfs(struct inode *mountpt, struct statfs *buf) +{ + struct binfs_state_s *bm; + + fvdbg("Entry\n"); + + /* Sanity checks */ + + DEBUGASSERT(mountpt && mountpt->i_private); + + /* Get the mountpoint private data from the inode structure */ + + bm = mountpt->i_private; + binfs_semtake(bm); + + /* Fill in the statfs info */ + + memset(buf, 0, sizeof(struct statfs)); + buf->f_type = BINFS_MAGIC; + buf->f_bsize = 0; + buf->f_blocks = 0; + buf->f_bfree = 0; + buf->f_bavail = 0; + buf->f_namelen = NAME_MAX; + + binfs_semgive(bm); + return OK; +} + +/**************************************************************************** + * Name: binfs_stat + * + * Description: Return information about a file or directory + * + ****************************************************************************/ + +static int binfs_stat(struct inode *mountpt, const char *relpath, struct stat *buf) +{ + struct binfs_state_s *bm; + int ret; + + fvdbg("Entry\n"); + + /* Sanity checks */ + + DEBUGASSERT(mountpt && mountpt->i_private); + + /* Get the mountpoint private data from the inode structure */ + + bm = mountpt->i_private; + binfs_semtake(bm); + + /* The requested directory must be the volume-relative "root" directory */ + + if (relpath && relpath[0] != '\0') + { + /* Check if there is a file with this name. */ + + if (namedapp_isavail(relpath) < 0) + { + ret = -ENOENT; + goto errout_with_semaphore; + } + + /* It's a execute-only file name */ + + buf->st_mode = S_IFREG|S_IXOTH|S_IXGRP|S_IXUSR; + } + else + { + /* It's a read/execute-only directory name */ + + buf->st_mode = S_IFDIR|S_IROTH|S_IRGRP|S_IRUSR|S_IXOTH|S_IXGRP|S_IXUSR; + } + + /* File/directory size, access block size */ + + buf->st_size = 0; + buf->st_blksize = 0; + buf->st_blocks = 0; + ret = OK; + +errout_with_semaphore: + binfs_semgive(bm); + return ret; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +#endif /* !CONFIG_DISABLE_MOUNTPOINT && CONFIG_APPS_BINDIR */ + diff --git a/apps/namedapp/exec_namedapp.c b/apps/namedapp/exec_namedapp.c new file mode 100644 index 0000000000..dd0f0b84f2 --- /dev/null +++ b/apps/namedapp/exec_namedapp.c @@ -0,0 +1,122 @@ +/**************************************************************************** + * apps/namedaps/exec_namedapp.c + * + * Copyright (C) 2011 Uros Platise. All rights reserved. + * Author: Uros Platise + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include + +#include +#include + +#include "namedapp.h" + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +const char *namedapp_getname(int index) +{ + if (index < 0 || index >= number_namedapps()) + { + return NULL; + } + + return namedapps[index].name; +} + +int namedapp_isavail(FAR const char *appname) +{ + int i; + + for (i = 0; namedapps[i].name; i++) + { + if (!strcmp(namedapps[i].name, appname)) + { + return i; + } + } + + set_errno(ENOENT); + return ERROR; +} + +int exec_namedapp(FAR const char *appname, FAR const char **argv) +{ + int i; + + if ((i = namedapp_isavail(appname)) >= 0) + { +#ifndef CONFIG_CUSTOM_STACK + i = task_create(namedapps[i].name, namedapps[i].priority, + namedapps[i].stacksize, namedapps[i].main, + (argv) ? &argv[1] : (const char **)NULL); +#else + i = task_create(namedapps[i].name, namedapps[i].priority, namedapps[i].main, + (argv) ? &argv[1] : (const char **)NULL); +#endif + +#if CONFIG_RR_INTERVAL > 0 + if (i > 0) + { + struct sched_param param; + + sched_getparam(0, ¶m); + sched_setscheduler(i, SCHED_RR, ¶m); + } +#endif + } + + return i; +} diff --git a/apps/namedapp/namedapp.c b/apps/namedapp/namedapp.c new file mode 100644 index 0000000000..a5c2bee0e2 --- /dev/null +++ b/apps/namedapp/namedapp.c @@ -0,0 +1,96 @@ +/**************************************************************************** + * apps/namedaps/namedapp.c + * + * Copyright (C) 2011 Uros Platise. All rights reserved. + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Authors: Uros Platise + * Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +#include "namedapp_proto.h" + +const struct namedapp_s namedapps[] = +{ +# include "namedapp_list.h" + { NULL, 0, 0, 0 } +}; + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int number_namedapps(void) +{ + return sizeof(namedapps)/sizeof(struct namedapp_s) - 1; +} + + diff --git a/apps/namedapp/namedapp.h b/apps/namedapp/namedapp.h new file mode 100644 index 0000000000..88fa7f36a8 --- /dev/null +++ b/apps/namedapp/namedapp.h @@ -0,0 +1,78 @@ +/**************************************************************************** + * apps/namedaps/namedapp.h + * + * Copyright (C) 2011 Uros Platise. All rights reserved. + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Authors: Uros Platise + * Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_NAMEDAPP_NAMEDAPP_H +#define __APPS_NAMEDAPP_NAMEDAPP_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +EXTERN const struct namedapp_s namedapps[]; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +EXTERN int number_namedapps(void); + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __APPS_NAMEDAPP_NAMEDAPP_H */ + diff --git a/apps/netutils/Makefile b/apps/netutils/Makefile new file mode 100644 index 0000000000..df61f97e81 --- /dev/null +++ b/apps/netutils/Makefile @@ -0,0 +1,64 @@ +############################################################################ +# apps/netutils/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config # Current configuration + +# Sub-directories + +ifeq ($(CONFIG_NET),y) +SUBDIRS = uiplib dhcpc dhcpd ftpc resolv smtp telnetd webclient webserver tftpc thttpd +endif + +all: nothing +.PHONY: nothing context depend clean distclean + +nothing: + +context: + +depend: + @for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done + +clean: + @for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done + +distclean: clean + @for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done diff --git a/apps/netutils/README.txt b/apps/netutils/README.txt new file mode 100644 index 0000000000..2059b569e4 --- /dev/null +++ b/apps/netutils/README.txt @@ -0,0 +1,40 @@ +netutils +^^^^^^^^ + +This directory contains most of the network applications contained +under the uIP-1.0 apps directory. As the uIP apps/README says, +these applications "are not all heavily tested." These uIP apps +include: + + dhcpc - Dynamic Host Configuration Protocol (DHCP) client + resolv - uIP DNS resolver + smtp - Simple Mail Transfer Protocol (SMTP) client + telnetd - TELNET server + webclient - HTTP web client + webserver - HTTP web server + +You may find additional information on these apps in the uIP forum +accessible through: http://www.sics.se/~adam/uip/index.php/Main_Page + +Additional applications that were not part of uIP (but which are +highly influenced by uIP) include: + + dhcpd - Dynamic Host Configuration Protocol (DHCP) server + tftpc - TFTP client + ftpc - FTP client + thttpd - This is a port of Jef Poskanzer's THTTPD HTPPD server. + See http://acme.com/software/thttpd/. + +If you use DHCPC/D, then some special configuration network options are +required. These include: + + CONFIG_NET=y Of course + CONFIG_NSOCKET_DESCRIPTORS And, of course, you must allocate some + socket descriptors. + CONFIG_NET_UDP=y UDP support is required for DHCP + (as well as various other UDP-related + configuration settings). + CONFIG_NET_BROADCAST=y UDP broadcast support is needed. + CONFIG_NET_BUFSIZE=650 The client must be prepared to receive + (or larger) DHCP messages of up to 576 bytes (excluding + Ethernet, IP, or UDP headers and FCS). diff --git a/apps/netutils/dhcpc/Makefile b/apps/netutils/dhcpc/Makefile new file mode 100644 index 0000000000..d5f1f90c54 --- /dev/null +++ b/apps/netutils/dhcpc/Makefile @@ -0,0 +1,97 @@ +############################################################################ +# apps/netutils/dhcpc/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# DHCP Client Library + +ASRCS = +CSRCS = + +ifeq ($(CONFIG_NET_UDP),y) +CSRCS += dhcpc.c +endif + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: context depend clean distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/netutils/dhcpc/dhcpc.c b/apps/netutils/dhcpc/dhcpc.c new file mode 100644 index 0000000000..b5551c6f13 --- /dev/null +++ b/apps/netutils/dhcpc/dhcpc.c @@ -0,0 +1,607 @@ +/**************************************************************************** + * netutils/dhcpc/dhcpc.c + * + * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Based heavily on portions of uIP: + * + * Author: Adam Dunkels + * Copyright (c) 2005, Swedish Institute of Computer Science + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#define STATE_INITIAL 0 +#define STATE_HAVE_OFFER 1 +#define STATE_HAVE_LEASE 2 + +#define BOOTP_BROADCAST 0x8000 + +#define DHCP_REQUEST 1 +#define DHCP_REPLY 2 +#define DHCP_HTYPE_ETHERNET 1 +#define DHCP_HLEN_ETHERNET 6 +#define DHCP_MSG_LEN 236 + +#define DHCPC_SERVER_PORT 67 +#define DHCPC_CLIENT_PORT 68 + +#define DHCPDISCOVER 1 +#define DHCPOFFER 2 +#define DHCPREQUEST 3 +#define DHCPDECLINE 4 +#define DHCPACK 5 +#define DHCPNAK 6 +#define DHCPRELEASE 7 + +#define DHCP_OPTION_SUBNET_MASK 1 +#define DHCP_OPTION_ROUTER 3 +#define DHCP_OPTION_DNS_SERVER 6 +#define DHCP_OPTION_REQ_IPADDR 50 +#define DHCP_OPTION_LEASE_TIME 51 +#define DHCP_OPTION_MSG_TYPE 53 +#define DHCP_OPTION_SERVER_ID 54 +#define DHCP_OPTION_REQ_LIST 55 +#define DHCP_OPTION_END 255 + +#define BUFFER_SIZE 256 + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct dhcp_msg +{ + uint8_t op; + uint8_t htype; + uint8_t hlen; + uint8_t hops; + uint8_t xid[4]; + uint16_t secs; + uint16_t flags; + uint8_t ciaddr[4]; + uint8_t yiaddr[4]; + uint8_t siaddr[4]; + uint8_t giaddr[4]; + uint8_t chaddr[16]; +#ifndef CONFIG_NET_DHCP_LIGHT + uint8_t sname[64]; + uint8_t file[128]; +#endif + uint8_t options[312]; +}; + +struct dhcpc_state_s +{ + struct uip_udp_conn *ds_conn; + const void *ds_macaddr; + int ds_maclen; + int sockfd; + struct in_addr ipaddr; + struct in_addr serverid; + struct dhcp_msg packet; +}; + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const uint8_t xid[4] = {0xad, 0xde, 0x12, 0x23}; +static const uint8_t magic_cookie[4] = {99, 130, 83, 99}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: dhcpc_add