From 5375bb5b86e266157ceceef08c367da711b8144e Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 1 Jun 2013 01:04:32 +0200 Subject: Cleanup, WIP, needs a NuttX checkout to Firmware/NuttX now --- nuttx/include/arpa/inet.h | 136 --- nuttx/include/assert.h | 132 --- nuttx/include/crc32.h | 83 -- nuttx/include/ctype.h | 223 ---- nuttx/include/cxx/cassert | 49 - nuttx/include/cxx/cctype | 49 - nuttx/include/cxx/cerrno | 49 - nuttx/include/cxx/cfcntl | 57 - nuttx/include/cxx/climits | 49 - nuttx/include/cxx/cmath | 137 --- nuttx/include/cxx/csched | 74 -- nuttx/include/cxx/csignal | 72 -- nuttx/include/cxx/cstdarg | 49 - nuttx/include/cxx/cstdbool | 58 - nuttx/include/cxx/cstddef | 81 -- nuttx/include/cxx/cstdint | 81 -- nuttx/include/cxx/cstdio | 96 -- nuttx/include/cxx/cstdlib | 85 -- nuttx/include/cxx/cstring | 85 -- nuttx/include/cxx/ctime | 71 -- nuttx/include/cxx/cunistd | 73 -- nuttx/include/debug.h | 614 ----------- nuttx/include/dirent.h | 117 -- nuttx/include/elf32.h | 352 ------ nuttx/include/errno.h | 369 ------- nuttx/include/fcntl.h | 161 --- nuttx/include/fixedmath.h | 226 ---- nuttx/include/inttypes.h | 190 ---- nuttx/include/libgen.h | 66 -- nuttx/include/limits.h | 212 ---- nuttx/include/mqueue.h | 109 -- nuttx/include/net/ethernet.h | 71 -- nuttx/include/net/if.h | 142 --- nuttx/include/netinet/arp.h | 114 -- nuttx/include/netinet/ether.h | 77 -- nuttx/include/netinet/in.h | 155 --- nuttx/include/netinet/ip.h | 54 - nuttx/include/netinet/ip6.h | 54 - nuttx/include/nuttx/analog/adc.h | 226 ---- nuttx/include/nuttx/analog/dac.h | 212 ---- nuttx/include/nuttx/analog/pga11x.h | 390 ------- nuttx/include/nuttx/arch.h | 867 --------------- nuttx/include/nuttx/ascii.h | 200 ---- nuttx/include/nuttx/binfmt/binfmt.h | 385 ------- nuttx/include/nuttx/binfmt/builtin.h | 178 --- nuttx/include/nuttx/binfmt/elf.h | 340 ------ nuttx/include/nuttx/binfmt/nxflat.h | 287 ----- nuttx/include/nuttx/binfmt/symtab.h | 163 --- nuttx/include/nuttx/can.h | 374 ------- nuttx/include/nuttx/clock.h | 251 ----- nuttx/include/nuttx/compiler.h | 477 -------- nuttx/include/nuttx/fb.h | 354 ------ nuttx/include/nuttx/float.h | 225 ---- nuttx/include/nuttx/fs/binfs.h | 83 -- nuttx/include/nuttx/fs/dirent.h | 221 ---- nuttx/include/nuttx/fs/fat.h | 122 --- nuttx/include/nuttx/fs/fs.h | 745 ------------- nuttx/include/nuttx/fs/ioctl.h | 234 ---- nuttx/include/nuttx/fs/mkfatfs.h | 145 --- nuttx/include/nuttx/fs/nfs.h | 108 -- nuttx/include/nuttx/fs/nxffs.h | 150 --- nuttx/include/nuttx/gran.h | 202 ---- nuttx/include/nuttx/i2c.h | 354 ------ nuttx/include/nuttx/init.h | 82 -- nuttx/include/nuttx/input/ads7843e.h | 182 ---- nuttx/include/nuttx/input/kbd_codec.h | 347 ------ nuttx/include/nuttx/input/keypad.h | 54 - nuttx/include/nuttx/input/max11802.h | 175 --- nuttx/include/nuttx/input/stmpe811.h | 785 -------------- nuttx/include/nuttx/input/touchscreen.h | 180 ---- nuttx/include/nuttx/input/tsc2007.h | 172 --- nuttx/include/nuttx/irq.h | 94 -- nuttx/include/nuttx/kmalloc.h | 114 -- nuttx/include/nuttx/lcd/hd4478ou.h | 118 -- nuttx/include/nuttx/lcd/lcd.h | 219 ---- nuttx/include/nuttx/lcd/mio283qt2.h | 149 --- nuttx/include/nuttx/lcd/nokia6100.h | 141 --- nuttx/include/nuttx/lcd/p14201.h | 129 --- nuttx/include/nuttx/lcd/ssd1289.h | 149 --- nuttx/include/nuttx/lcd/ug-2864ambag01.h | 246 ----- nuttx/include/nuttx/lcd/ug-2864hsweg01.h | 246 ----- nuttx/include/nuttx/lcd/ug-9664hswag01.h | 154 --- nuttx/include/nuttx/lib.h | 82 -- nuttx/include/nuttx/math.h | 329 ------ nuttx/include/nuttx/mm.h | 84 -- nuttx/include/nuttx/mmcsd.h | 107 -- nuttx/include/nuttx/mqueue.h | 124 --- nuttx/include/nuttx/mtd.h | 243 ----- nuttx/include/nuttx/net/cs89x0.h | 168 --- nuttx/include/nuttx/net/enc28j60.h | 182 ---- nuttx/include/nuttx/net/ioctl.h | 164 --- nuttx/include/nuttx/net/mii.h | 474 -------- nuttx/include/nuttx/net/net.h | 300 ------ nuttx/include/nuttx/net/uip/uip-arch.h | 374 ------- nuttx/include/nuttx/net/uip/uip-arp.h | 262 ----- nuttx/include/nuttx/net/uip/uip-icmp.h | 211 ---- nuttx/include/nuttx/net/uip/uip-igmp.h | 258 ----- nuttx/include/nuttx/net/uip/uip-ipopt.h | 251 ----- nuttx/include/nuttx/net/uip/uip-tcp.h | 460 -------- nuttx/include/nuttx/net/uip/uip-udp.h | 206 ---- nuttx/include/nuttx/net/uip/uip.h | 568 ---------- nuttx/include/nuttx/net/uip/uipopt.h | 330 ------ nuttx/include/nuttx/nx/nx.h | 904 ---------------- nuttx/include/nuttx/nx/nxconsole.h | 367 ------- nuttx/include/nuttx/nx/nxfonts.h | 386 ------- nuttx/include/nuttx/nx/nxglib.h | 738 ------------- nuttx/include/nuttx/nx/nxtk.h | 713 ------------ nuttx/include/nuttx/page.h | 467 -------- nuttx/include/nuttx/power/battery.h | 217 ---- nuttx/include/nuttx/power/pm.h | 486 --------- nuttx/include/nuttx/progmem.h | 199 ---- nuttx/include/nuttx/pthread.h | 88 -- nuttx/include/nuttx/pwm.h | 306 ------ nuttx/include/nuttx/ramdisk.h | 99 -- nuttx/include/nuttx/ramlog.h | 208 ---- nuttx/include/nuttx/regex.h | 82 -- nuttx/include/nuttx/rgbcolors.h | 293 ----- nuttx/include/nuttx/rtc.h | 283 ----- nuttx/include/nuttx/rwbuffer.h | 192 ---- nuttx/include/nuttx/sched.h | 578 ---------- 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/sensors/qencoder.h | 180 ---- nuttx/include/nuttx/sercomm/msgb.h | 176 --- nuttx/include/nuttx/sercomm/sercomm.h | 57 - nuttx/include/nuttx/sercomm/sercomm_cons.h | 10 - nuttx/include/nuttx/serial/serial.h | 343 ------ nuttx/include/nuttx/serial/tioctl.h | 225 ---- nuttx/include/nuttx/serial/uart_16550.h | 351 ------ nuttx/include/nuttx/spawn.h | 121 --- nuttx/include/nuttx/spi.h | 446 -------- nuttx/include/nuttx/stdarg.h | 64 -- nuttx/include/nuttx/streams.h | 295 ----- nuttx/include/nuttx/syslog.h | 136 --- nuttx/include/nuttx/time.h | 120 --- nuttx/include/nuttx/usb/audio.h | 1618 ---------------------------- nuttx/include/nuttx/usb/cdc.h | 879 --------------- nuttx/include/nuttx/usb/cdcacm.h | 417 ------- nuttx/include/nuttx/usb/composite.h | 186 ---- 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/pl2303.h | 91 -- nuttx/include/nuttx/usb/storage.h | 131 --- nuttx/include/nuttx/usb/usb.h | 416 ------- nuttx/include/nuttx/usb/usbdev.h | 393 ------- nuttx/include/nuttx/usb/usbdev_trace.h | 500 --------- nuttx/include/nuttx/usb/usbhost.h | 875 --------------- nuttx/include/nuttx/usb/usbhost_trace.h | 75 -- nuttx/include/nuttx/usb/usbmsc.h | 259 ----- nuttx/include/nuttx/vt100.h | 250 ----- nuttx/include/nuttx/watchdog.h | 293 ----- nuttx/include/nuttx/wireless/cc1101.h | 464 -------- nuttx/include/nuttx/wqueue.h | 271 ----- nuttx/include/nxflat.h | 204 ---- nuttx/include/poll.h | 138 --- nuttx/include/pthread.h | 411 ------- nuttx/include/queue.h | 129 --- nuttx/include/sched.h | 172 --- nuttx/include/semaphore.h | 145 --- nuttx/include/signal.h | 265 ----- nuttx/include/spawn.h | 198 ---- nuttx/include/stdbool.h | 120 --- nuttx/include/stddef.h | 49 - nuttx/include/stdint.h | 305 ------ nuttx/include/stdio.h | 157 --- nuttx/include/stdlib.h | 192 ---- nuttx/include/string.h | 104 -- nuttx/include/sys/ioctl.h | 83 -- nuttx/include/sys/mman.h | 113 -- nuttx/include/sys/mount.h | 77 -- nuttx/include/sys/prctl.h | 114 -- nuttx/include/sys/select.h | 121 --- nuttx/include/sys/sendfile.h | 123 --- nuttx/include/sys/socket.h | 234 ---- nuttx/include/sys/sockio.h | 120 --- nuttx/include/sys/stat.h | 134 --- nuttx/include/sys/statfs.h | 145 --- nuttx/include/sys/syscall.h | 398 ------- nuttx/include/sys/time.h | 74 -- nuttx/include/sys/types.h | 234 ---- nuttx/include/sys/vfs.h | 61 -- nuttx/include/sys/wait.h | 118 -- nuttx/include/syscall.h | 71 -- nuttx/include/syslog.h | 94 -- nuttx/include/termios.h | 304 ------ nuttx/include/time.h | 192 ---- nuttx/include/unistd.h | 194 ---- nuttx/include/wdog.h | 109 -- 191 files changed, 46673 deletions(-) delete mode 100644 nuttx/include/arpa/inet.h delete mode 100644 nuttx/include/assert.h delete mode 100644 nuttx/include/crc32.h delete mode 100644 nuttx/include/ctype.h delete mode 100644 nuttx/include/cxx/cassert delete mode 100644 nuttx/include/cxx/cctype delete mode 100644 nuttx/include/cxx/cerrno delete mode 100644 nuttx/include/cxx/cfcntl delete mode 100644 nuttx/include/cxx/climits delete mode 100644 nuttx/include/cxx/cmath delete mode 100644 nuttx/include/cxx/csched delete mode 100644 nuttx/include/cxx/csignal delete mode 100644 nuttx/include/cxx/cstdarg delete mode 100644 nuttx/include/cxx/cstdbool delete mode 100644 nuttx/include/cxx/cstddef delete mode 100644 nuttx/include/cxx/cstdint delete mode 100644 nuttx/include/cxx/cstdio delete mode 100644 nuttx/include/cxx/cstdlib delete mode 100644 nuttx/include/cxx/cstring delete mode 100644 nuttx/include/cxx/ctime delete mode 100644 nuttx/include/cxx/cunistd delete mode 100644 nuttx/include/debug.h delete mode 100644 nuttx/include/dirent.h delete mode 100644 nuttx/include/elf32.h delete mode 100644 nuttx/include/errno.h delete mode 100644 nuttx/include/fcntl.h delete mode 100644 nuttx/include/fixedmath.h delete mode 100644 nuttx/include/inttypes.h delete mode 100644 nuttx/include/libgen.h delete mode 100644 nuttx/include/limits.h delete mode 100644 nuttx/include/mqueue.h delete mode 100644 nuttx/include/net/ethernet.h delete mode 100644 nuttx/include/net/if.h delete mode 100644 nuttx/include/netinet/arp.h delete mode 100644 nuttx/include/netinet/ether.h delete mode 100644 nuttx/include/netinet/in.h delete mode 100644 nuttx/include/netinet/ip.h delete mode 100644 nuttx/include/netinet/ip6.h delete mode 100644 nuttx/include/nuttx/analog/adc.h delete mode 100644 nuttx/include/nuttx/analog/dac.h delete mode 100644 nuttx/include/nuttx/analog/pga11x.h delete mode 100644 nuttx/include/nuttx/arch.h delete mode 100644 nuttx/include/nuttx/ascii.h delete mode 100644 nuttx/include/nuttx/binfmt/binfmt.h delete mode 100644 nuttx/include/nuttx/binfmt/builtin.h delete mode 100644 nuttx/include/nuttx/binfmt/elf.h delete mode 100644 nuttx/include/nuttx/binfmt/nxflat.h delete mode 100644 nuttx/include/nuttx/binfmt/symtab.h delete mode 100644 nuttx/include/nuttx/can.h delete mode 100644 nuttx/include/nuttx/clock.h delete mode 100644 nuttx/include/nuttx/compiler.h delete mode 100644 nuttx/include/nuttx/fb.h delete mode 100644 nuttx/include/nuttx/float.h delete mode 100644 nuttx/include/nuttx/fs/binfs.h delete mode 100644 nuttx/include/nuttx/fs/dirent.h delete mode 100644 nuttx/include/nuttx/fs/fat.h delete mode 100644 nuttx/include/nuttx/fs/fs.h delete mode 100644 nuttx/include/nuttx/fs/ioctl.h delete mode 100644 nuttx/include/nuttx/fs/mkfatfs.h delete mode 100644 nuttx/include/nuttx/fs/nfs.h delete mode 100644 nuttx/include/nuttx/fs/nxffs.h delete mode 100644 nuttx/include/nuttx/gran.h delete mode 100644 nuttx/include/nuttx/i2c.h delete mode 100644 nuttx/include/nuttx/init.h delete mode 100644 nuttx/include/nuttx/input/ads7843e.h delete mode 100644 nuttx/include/nuttx/input/kbd_codec.h delete mode 100644 nuttx/include/nuttx/input/keypad.h delete mode 100644 nuttx/include/nuttx/input/max11802.h delete mode 100644 nuttx/include/nuttx/input/stmpe811.h delete mode 100644 nuttx/include/nuttx/input/touchscreen.h delete mode 100644 nuttx/include/nuttx/input/tsc2007.h delete mode 100644 nuttx/include/nuttx/irq.h delete mode 100644 nuttx/include/nuttx/kmalloc.h delete mode 100644 nuttx/include/nuttx/lcd/hd4478ou.h delete mode 100644 nuttx/include/nuttx/lcd/lcd.h delete mode 100644 nuttx/include/nuttx/lcd/mio283qt2.h delete mode 100644 nuttx/include/nuttx/lcd/nokia6100.h delete mode 100644 nuttx/include/nuttx/lcd/p14201.h delete mode 100644 nuttx/include/nuttx/lcd/ssd1289.h delete mode 100644 nuttx/include/nuttx/lcd/ug-2864ambag01.h delete mode 100644 nuttx/include/nuttx/lcd/ug-2864hsweg01.h delete mode 100644 nuttx/include/nuttx/lcd/ug-9664hswag01.h delete mode 100644 nuttx/include/nuttx/lib.h delete mode 100644 nuttx/include/nuttx/math.h delete mode 100644 nuttx/include/nuttx/mm.h delete mode 100644 nuttx/include/nuttx/mmcsd.h delete mode 100644 nuttx/include/nuttx/mqueue.h delete mode 100644 nuttx/include/nuttx/mtd.h delete mode 100644 nuttx/include/nuttx/net/cs89x0.h delete mode 100644 nuttx/include/nuttx/net/enc28j60.h delete mode 100644 nuttx/include/nuttx/net/ioctl.h delete mode 100644 nuttx/include/nuttx/net/mii.h delete mode 100644 nuttx/include/nuttx/net/net.h delete mode 100644 nuttx/include/nuttx/net/uip/uip-arch.h delete mode 100644 nuttx/include/nuttx/net/uip/uip-arp.h delete mode 100644 nuttx/include/nuttx/net/uip/uip-icmp.h delete mode 100644 nuttx/include/nuttx/net/uip/uip-igmp.h delete mode 100644 nuttx/include/nuttx/net/uip/uip-ipopt.h delete mode 100644 nuttx/include/nuttx/net/uip/uip-tcp.h delete mode 100644 nuttx/include/nuttx/net/uip/uip-udp.h delete mode 100644 nuttx/include/nuttx/net/uip/uip.h delete mode 100644 nuttx/include/nuttx/net/uip/uipopt.h delete mode 100644 nuttx/include/nuttx/nx/nx.h delete mode 100644 nuttx/include/nuttx/nx/nxconsole.h delete mode 100644 nuttx/include/nuttx/nx/nxfonts.h delete mode 100644 nuttx/include/nuttx/nx/nxglib.h delete mode 100644 nuttx/include/nuttx/nx/nxtk.h delete mode 100644 nuttx/include/nuttx/page.h delete mode 100644 nuttx/include/nuttx/power/battery.h delete mode 100644 nuttx/include/nuttx/power/pm.h delete mode 100644 nuttx/include/nuttx/progmem.h delete mode 100644 nuttx/include/nuttx/pthread.h delete mode 100644 nuttx/include/nuttx/pwm.h delete mode 100644 nuttx/include/nuttx/ramdisk.h delete mode 100644 nuttx/include/nuttx/ramlog.h delete mode 100644 nuttx/include/nuttx/regex.h delete mode 100644 nuttx/include/nuttx/rgbcolors.h delete mode 100644 nuttx/include/nuttx/rtc.h delete mode 100644 nuttx/include/nuttx/rwbuffer.h delete mode 100644 nuttx/include/nuttx/sched.h delete mode 100644 nuttx/include/nuttx/scsi.h delete mode 100644 nuttx/include/nuttx/sdio.h delete mode 100644 nuttx/include/nuttx/sensors/lis331dl.h delete mode 100644 nuttx/include/nuttx/sensors/lm75.h delete mode 100644 nuttx/include/nuttx/sensors/qencoder.h delete mode 100644 nuttx/include/nuttx/sercomm/msgb.h delete mode 100644 nuttx/include/nuttx/sercomm/sercomm.h delete mode 100644 nuttx/include/nuttx/sercomm/sercomm_cons.h delete mode 100644 nuttx/include/nuttx/serial/serial.h delete mode 100644 nuttx/include/nuttx/serial/tioctl.h delete mode 100644 nuttx/include/nuttx/serial/uart_16550.h delete mode 100644 nuttx/include/nuttx/spawn.h delete mode 100644 nuttx/include/nuttx/spi.h delete mode 100644 nuttx/include/nuttx/stdarg.h delete mode 100644 nuttx/include/nuttx/streams.h delete mode 100644 nuttx/include/nuttx/syslog.h delete mode 100644 nuttx/include/nuttx/time.h delete mode 100644 nuttx/include/nuttx/usb/audio.h delete mode 100644 nuttx/include/nuttx/usb/cdc.h delete mode 100644 nuttx/include/nuttx/usb/cdcacm.h delete mode 100644 nuttx/include/nuttx/usb/composite.h delete mode 100644 nuttx/include/nuttx/usb/hid.h delete mode 100644 nuttx/include/nuttx/usb/hid_parser.h delete mode 100644 nuttx/include/nuttx/usb/ohci.h delete mode 100644 nuttx/include/nuttx/usb/pl2303.h delete mode 100644 nuttx/include/nuttx/usb/storage.h delete mode 100644 nuttx/include/nuttx/usb/usb.h delete mode 100644 nuttx/include/nuttx/usb/usbdev.h delete mode 100644 nuttx/include/nuttx/usb/usbdev_trace.h delete mode 100644 nuttx/include/nuttx/usb/usbhost.h delete mode 100644 nuttx/include/nuttx/usb/usbhost_trace.h delete mode 100644 nuttx/include/nuttx/usb/usbmsc.h delete mode 100644 nuttx/include/nuttx/vt100.h delete mode 100644 nuttx/include/nuttx/watchdog.h delete mode 100644 nuttx/include/nuttx/wireless/cc1101.h delete mode 100644 nuttx/include/nuttx/wqueue.h delete mode 100644 nuttx/include/nxflat.h delete mode 100644 nuttx/include/poll.h delete mode 100644 nuttx/include/pthread.h delete mode 100644 nuttx/include/queue.h delete mode 100644 nuttx/include/sched.h delete mode 100644 nuttx/include/semaphore.h delete mode 100644 nuttx/include/signal.h delete mode 100644 nuttx/include/spawn.h delete mode 100644 nuttx/include/stdbool.h delete mode 100644 nuttx/include/stddef.h delete mode 100644 nuttx/include/stdint.h delete mode 100644 nuttx/include/stdio.h delete mode 100644 nuttx/include/stdlib.h delete mode 100644 nuttx/include/string.h delete mode 100644 nuttx/include/sys/ioctl.h delete mode 100644 nuttx/include/sys/mman.h delete mode 100644 nuttx/include/sys/mount.h delete mode 100644 nuttx/include/sys/prctl.h delete mode 100644 nuttx/include/sys/select.h delete mode 100644 nuttx/include/sys/sendfile.h delete mode 100644 nuttx/include/sys/socket.h delete mode 100644 nuttx/include/sys/sockio.h delete mode 100644 nuttx/include/sys/stat.h delete mode 100644 nuttx/include/sys/statfs.h delete mode 100644 nuttx/include/sys/syscall.h delete mode 100644 nuttx/include/sys/time.h delete mode 100644 nuttx/include/sys/types.h delete mode 100644 nuttx/include/sys/vfs.h delete mode 100644 nuttx/include/sys/wait.h delete mode 100644 nuttx/include/syscall.h delete mode 100644 nuttx/include/syslog.h delete mode 100644 nuttx/include/termios.h delete mode 100644 nuttx/include/time.h delete mode 100644 nuttx/include/unistd.h delete mode 100644 nuttx/include/wdog.h (limited to 'nuttx/include') diff --git a/nuttx/include/arpa/inet.h b/nuttx/include/arpa/inet.h deleted file mode 100644 index 7428c76f2..000000000 --- a/nuttx/include/arpa/inet.h +++ /dev/null @@ -1,136 +0,0 @@ -/**************************************************************************** - * include/arpa/inet.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 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. - * - ****************************************************************************/ - -#ifndef __INCLUDE_ARPA_INET_H -#define __INCLUDE_ARPA_INET_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ -/* Length of the string form for IP address (excludes NULL termination) */ - -#define INET_ADDRSTRLEN 16 - -/* Length of the string form for IPv6 address (excludes NULL termination) */ - -#define INET6_ADDRSTRLEN 46 - -/* This macro to convert a 16/32-bit constant values quantity from host byte - * order to network byte order. The 16-bit version of this macro is required - * for uIP: - * - * Author Adam Dunkels - * Copyright (c) 2001-2003, Adam Dunkels. - * All rights reserved. - */ - -#ifdef CONFIG_ENDIAN_BIG -# define HTONS(ns) (ns) -# define HTONL(nl) (nl) -#else -# define HTONS(ns) \ - (unsigned short) \ - (((((unsigned short)(ns)) & 0x00ff) << 8) | \ - ((((unsigned short)(ns)) >> 8) & 0x00ff)) -# define HTONL(nl) \ - (unsigned long) \ - (((((unsigned long)(nl)) & 0x000000ffUL) << 24) | \ - ((((unsigned long)(nl)) & 0x0000ff00UL) << 8) | \ - ((((unsigned long)(nl)) & 0x00ff0000UL) >> 8) | \ - ((((unsigned long)(nl)) & 0xff000000UL) >> 24)) -#endif - -#define NTOHS(hs) HTONS(hs) -#define NTOHL(hl) HTONL(hl) - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/* Functions to convert between nost and network byte ordering */ - -EXTERN uint32_t ntohl(uint32_t nl); -EXTERN uint16_t ntohs(uint16_t ns); -EXTERN uint32_t htonl(uint32_t hl); -EXTERN uint16_t htons(uint16_t hs); - -/* Functions to manipulate address representations */ - -EXTERN int inet_aton(FAR const char *cp, FAR struct in_addr *inp); -EXTERN in_addr_t inet_addr(FAR const char *cp); -EXTERN in_addr_t inet_network(FAR const char *cp); - -#ifdef CONFIG_CAN_PASS_STRUCTS -EXTERN FAR char *inet_ntoa(struct in_addr in); -EXTERN in_addr_t inet_lnaof(struct in_addr in); -EXTERN in_addr_t inet_netof(struct in_addr in); -#else -EXTERN FAR char *_inet_ntoa(in_addr_t in); -# define inet_ntoa(in) _inet_ntoa(in.s_addr); - -EXTERN in_addr_t _inet_lnaof(in_addr_t in); -# define inet_lnaof(in) _inet_lnaof(in.s_addr); - -EXTERN in_addr_t _inet_netof(in_addr_t in); -# define inet_netof(in) _inet_netof(in.s_addr); -#endif -EXTERN struct in_addr inet_makeaddr(in_addr_t net, in_addr_t host); - -EXTERN int inet_pton(int af, FAR const char *src, FAR void *dst); -EXTERN const char *inet_ntop(int af, FAR const void *src, FAR char *dst, socklen_t size); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_ARPA_INET_H */ diff --git a/nuttx/include/assert.h b/nuttx/include/assert.h deleted file mode 100644 index 62ffb3a6e..000000000 --- a/nuttx/include/assert.h +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** - * include/assert.h - * - * Copyright (C) 2007-2009, 2011-2013 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_ASSERT_H -#define __INCLUDE_ASSERT_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Macro Name: ASSERT, ASSERTCODE, et al. */ - -#undef ASSERT -#undef ASSERTCODE -#undef DEBUGASSERT -#undef PANIC - -#ifdef CONFIG_HAVE_FILENAME - -# define ASSERT(f) \ - { if (!(f)) up_assert((const uint8_t *)__FILE__, (int)__LINE__); } - -# define ASSERTCODE(f, code) \ - { if (!(f)) up_assert_code((const uint8_t *)__FILE__, (int)__LINE__, code); } - -# ifdef CONFIG_DEBUG -# define DEBUGASSERT(f) \ - { if (!(f)) up_assert((const uint8_t *)__FILE__, (int)__LINE__); } -# else -# define DEBUGASSERT(f) -# endif /* CONFIG_DEBUG */ - -# define PANIC(code) \ - up_assert_code((const uint8_t *)__FILE__, (int)__LINE__, (code)|0x8000) - -#else -# define ASSERT(f) \ - { if (!(f)) up_assert(); } - -# define ASSERTCODE(f, code) \ - { if (!(f)) up_assert_code(code); } - -# ifdef CONFIG_DEBUG -# define DEBUGASSERT(f) \ - { if (!(f)) up_assert(); } -# else -# define DEBUGASSERT(f) -# endif /* CONFIG_DEBUG */ - -# define PANIC(code) \ - up_assert_code((code)|0x8000) - -#endif - -#ifndef assert -#define assert ASSERT -#endif - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" -{ -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef CONFIG_HAVE_FILENAME -void up_assert(FAR const uint8_t *filename, int linenum) noreturn_function; -void up_assert_code(FAR const uint8_t *filename, int linenum, int errcode) - noreturn_function; -#else -void up_assert(void) noreturn_function; -void up_assert_code(int errcode) noreturn_function; -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_ASSERT_H */ diff --git a/nuttx/include/crc32.h b/nuttx/include/crc32.h deleted file mode 100644 index 1dd6fff13..000000000 --- a/nuttx/include/crc32.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** - * include/crc.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 __INCLUDE_CRC32_H -#define __INCLUDE_CRC32_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: crc32part - * - * Description: - * Continue CRC calculation on a part of the buffer. - * - ****************************************************************************/ - -EXTERN uint32_t crc32part(FAR const uint8_t *src, size_t len, - uint32_t crc32val); - -/**************************************************************************** - * Name: crc32 - * - * Description: - * Return a 32-bit CRC of the contents of the 'src' buffer, length 'len' - * - ****************************************************************************/ - -EXTERN uint32_t crc32(FAR const uint8_t *src, size_t len); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_CRC32_H */ diff --git a/nuttx/include/ctype.h b/nuttx/include/ctype.h deleted file mode 100644 index 22b325eef..000000000 --- a/nuttx/include/ctype.h +++ /dev/null @@ -1,223 +0,0 @@ -/**************************************************************************** - * include/ctype.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 __INCLUDE_CTYPE_H -#define __INCLUDE_CTYPE_H - -/* There is no consistent ctype implementation, just a smattering of - * functions. Individually, they are okay, but a more standard, data lookup - * approach would make more sense if used extensively. - */ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Name: isspace - * - * Description: - * Checks for white-space characters. In the "C" and "POSIX" locales, - * these are: space, form-feed ('\f'), newline ('\n'), carriage return - * ('\r'), horizontal tab ('\t'), and vertical tab ('\v'). - * - ****************************************************************************/ - -#define isspace(c) \ - ((c) == ' ' || (c) == '\t' || (c) == '\n' || \ - (c) == '\r' || (c) == '\f' || c== '\v') - -/**************************************************************************** - * Name: isascii - * - * Description: - * Checks whether c is a 7-bit unsigned char value that fits into the - * ASCII character set. - * - ****************************************************************************/ - -#define isascii(c) ((c) >= 0 && (c) <= 0x7f) - -/**************************************************************************** - * Name: isprint - * - * Description: - * Checks for a printable character (including space) - * - ****************************************************************************/ - -#define isprint(c) ((c) >= 0x20 && (c) < 0x7f) - -/**************************************************************************** - * Name: isgraph - * - * Description: - * Checks for a printable character (excluding space) - * - ****************************************************************************/ - -#define isgraph(c) ((c) > 0x20 && (c) < 0x7f) - -/**************************************************************************** - * Name: iscntrl - * - * Description: - * Checks for control character. - * - ****************************************************************************/ - -#define iscontrol(c) (!isprint(c)) - -/**************************************************************************** - * Name: islower - * - * Description: - * Checks for an lowercase letter. - * - ****************************************************************************/ - -#define islower(c) ((c) >= 'a' && (c) <= 'z') - -/**************************************************************************** - * Name: isupper - * - * Description: - * Checks for an uppercase letter. - * - ****************************************************************************/ - -#define isupper(c) ((c) >= 'A' && (c) <= 'Z') - -/**************************************************************************** - * Name: isalpha - * - * Description: - * Checks for an alphabetic character - * - ****************************************************************************/ - -#define isalpha(c) (islower(c) || isupper(c)) - -/**************************************************************************** - * Name: isdigit - * - * Description: - * ANSI standard isdigit implementation. - * - ****************************************************************************/ - -#define isdigit(c) ((c) >= '0' && (c) <= '9') - -/**************************************************************************** - * Name: isalnum - * - * Description: - * Checks for an alphanumeric character - * - ****************************************************************************/ - -#define isalnum(c) (isalpha(c) || isdigit(c)) - -/**************************************************************************** - * Name: ispunct - * - * Description: - * Checks for a printable character which is not a space or an - * alphanumeric character - * - ****************************************************************************/ - -#define ispunct(c) (isgraph(c) && !isalnum(c)) - -/**************************************************************************** - * Name: isxdigit - * - * Description: - * isxdigit() checks for a hexadecimal digits, i.e. one of {0-9,a-f,A-F} - * - ****************************************************************************/ - -#define isxdigit(c) \ - (((c) >= '0' && (c) <= '9') || \ - ((c) >= 'a' && (c) <= 'f') || \ - ((c) >= 'A' && (c) <= 'F')) - -/**************************************************************************** - * Name: toupper - * - * Description: - * toupper() converts the letter c to upper case, if possible. - * - ****************************************************************************/ - -#define toupper(c) \ - (((c) >= 'a' && (c) <= 'z') ? ((c) - 'a' + 'A') : (c)) - -/**************************************************************************** - * Name: tolower - * - * Description: - * tolower() converts the letter c to lower case, if possible. - * - ****************************************************************************/ - -#define tolower(c) \ - (((c) >= 'A' && (c) <= 'Z') ? ((c) - 'A' + 'a') : (c)) - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_CTYPE_H */ diff --git a/nuttx/include/cxx/cassert b/nuttx/include/cxx/cassert deleted file mode 100644 index b67592c2b..000000000 --- a/nuttx/include/cxx/cassert +++ /dev/null @@ -1,49 +0,0 @@ -//*************************************************************************** -// include/cxx/cassert -// -// 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 __INCLUDE_CXX_CASSERT -#define __INCLUDE_CXX_CASSERT - -//*************************************************************************** -// Included Files -//*************************************************************************** - -#include - -//*************************************************************************** -// Namespace -//*************************************************************************** - -#endif // __INCLUDE_CXX_CASSERT diff --git a/nuttx/include/cxx/cctype b/nuttx/include/cxx/cctype deleted file mode 100644 index 5d3b6dc70..000000000 --- a/nuttx/include/cxx/cctype +++ /dev/null @@ -1,49 +0,0 @@ -//*************************************************************************** -// include/cxx/cctype -// -// 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 __INCLUDE_CXX_CCTYPE -#define __INCLUDE_CXX_CCTYPE - -//*************************************************************************** -// Included Files -//*************************************************************************** - -#include - -//*************************************************************************** -// Namespace -//*************************************************************************** - -#endif // __INCLUDE_CXX_CCTYPE diff --git a/nuttx/include/cxx/cerrno b/nuttx/include/cxx/cerrno deleted file mode 100644 index 59847df3b..000000000 --- a/nuttx/include/cxx/cerrno +++ /dev/null @@ -1,49 +0,0 @@ -//*************************************************************************** -// include/cxx/cerrno -// -// 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 __INCLUDE_CXX_CERRNO -#define __INCLUDE_CXX_CERRNO - -//*************************************************************************** -// Included Files -//*************************************************************************** - -#include - -//*************************************************************************** -// Namespace -//*************************************************************************** - -#endif // __INCLUDE_CXX_CERRNO diff --git a/nuttx/include/cxx/cfcntl b/nuttx/include/cxx/cfcntl deleted file mode 100644 index 6907a5348..000000000 --- a/nuttx/include/cxx/cfcntl +++ /dev/null @@ -1,57 +0,0 @@ -//*************************************************************************** -// include/cxx/cfcntl -// -// Copyright (C) 2012 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_CXX_CFCNTL -#define __INCLUDE_CXX_CFCNTL - -//*************************************************************************** -// Included Files -//*************************************************************************** - -#include - -//*************************************************************************** -// Namespace -//*************************************************************************** - -namespace std -{ - using ::flock; - using ::creat; - using ::open; - using ::fcntl; -} - -#endif // __INCLUDE_CXX_CFCNTL diff --git a/nuttx/include/cxx/climits b/nuttx/include/cxx/climits deleted file mode 100644 index 2cd543a0e..000000000 --- a/nuttx/include/cxx/climits +++ /dev/null @@ -1,49 +0,0 @@ -//*************************************************************************** -// include/cxx/climits -// -// 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 __INCLUDE_CXX_CLIMITS -#define __INCLUDE_CXX_CLIMITS - -//*************************************************************************** -// Included Files -//*************************************************************************** - -#include - -//*************************************************************************** -// Namespace -//*************************************************************************** - -#endif // __INCLUDE_CXX_CLIMITS diff --git a/nuttx/include/cxx/cmath b/nuttx/include/cxx/cmath deleted file mode 100644 index b30d5548b..000000000 --- a/nuttx/include/cxx/cmath +++ /dev/null @@ -1,137 +0,0 @@ -//*************************************************************************** -// include/cxx/cmath -// -// 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 __INCLUDE_CXX_CMATH -#define __INCLUDE_CXX_CMATH - -//*************************************************************************** -// Included Files -//*************************************************************************** - -#include -#include - -#include - -//*************************************************************************** -// Namespace -//*************************************************************************** - -namespace std -{ -#if CONFIG_HAVE_FLOAT - using ::acosf; - using ::asinf; - using ::atanf; - using ::atan2f; - using ::ceilf; - using ::cosf; - using ::coshf; - using ::expf; - using ::fabsf; - using ::floorf; - using ::fmodf; - using ::frexpf; - using ::ldexpf; - using ::logf; - using ::log10f; - using ::log2f; - using ::modff; - using ::roundf; - using ::powf; - using ::sinf; - using ::sinhf; - using ::sqrtf; - using ::tanf; - using ::tanhf; -#endif - -#if CONFIG_HAVE_DOUBLE - using ::acos; - using ::asin; - using ::atan; - using ::atan2; - using ::ceil; - using ::cos; - using ::cosh; - using ::exp; - using ::fabs; - using ::floor; - using ::fmod; - using ::frexp; - using ::ldexp; - using ::log; - using ::log10; - using ::log2; - using ::modf; - using ::round; - using ::pow; - using ::sin; - using ::sinh; - using ::sqrt; - using ::tan; - using ::tanh; -#endif - -#ifdef CONFIG_HAVE_LONG_DOUBLE - using ::acosl; - using ::asinl; - using ::atanl; - using ::atan2l; - using ::ceill; - using ::cosl; - using ::coshl; - using ::expl; - using ::fabsl; - using ::floorl; - using ::fmodl; - using ::frexpl; - using ::ldexpl; - using ::logl; - using ::log10l; - using ::log2l; - using ::modfl; - using ::roundl; - using ::powl; - using ::sinl; - using ::sinhl; - using ::sqrtl; - using ::tanl; - using ::tanhl; -#endif - -} - -#endif // __INCLUDE_CXX_CMATH diff --git a/nuttx/include/cxx/csched b/nuttx/include/cxx/csched deleted file mode 100644 index 262782888..000000000 --- a/nuttx/include/cxx/csched +++ /dev/null @@ -1,74 +0,0 @@ -//*************************************************************************** -// include/cxx/cfcntl -// -// Copyright (C) 2012 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_CXX_CSCHED -#define __INCLUDE_CXX_CSCHED - -//*************************************************************************** -// Included Files -//*************************************************************************** - -#include - -//*************************************************************************** -// Namespace -//*************************************************************************** - -namespace std -{ - using ::sched_param; - using ::task_init; - using ::task_activate; - using ::task_create; - using ::task_delete; - using ::task_restart; - using ::sched_setparam; - using ::sched_getparam; - using ::sched_setscheduler; - using ::sched_getscheduler; - using ::sched_get_priority_max; - using ::sched_get_priority_min; - using ::sched_rr_get_interval; - using ::sched_lock; - using ::sched_unlock; - using ::sched_lockcount; -#ifdef CONFIG_SCHED_INSTRUMENTATION - using ::sched_note_start; - using ::sched_note_stop; - using ::sched_note_switch; -#endif -} - -#endif // __INCLUDE_CXX_CSCHED diff --git a/nuttx/include/cxx/csignal b/nuttx/include/cxx/csignal deleted file mode 100644 index 2303a864d..000000000 --- a/nuttx/include/cxx/csignal +++ /dev/null @@ -1,72 +0,0 @@ -//*************************************************************************** -// include/cxx/csignal -// -// 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 __INCLUDE_CXX_CSIGNAL -#define __INCLUDE_CXX_CSIGNAL - -//*************************************************************************** -// Included Files -//*************************************************************************** - -#include - -//*************************************************************************** -// Namespace -//*************************************************************************** - -namespace std -{ - using ::sigset_t; - using ::sigval; - using ::sigevent; - using ::siginfo; - using ::siginfo_t; - using ::sigaction; - using ::kill; - using ::sigemptyset; - using ::sigfillset; - using ::sigaddset; - using ::sigdelset; - using ::sigismember; - using ::sigaction; - using ::sigprocmask; - using ::sigpending; - using ::sigsuspend; - using ::sigwaitinfo; - using ::sigtimedwait; - using ::sigqueue; -} - -#endif // CSIGNAL_HEADER diff --git a/nuttx/include/cxx/cstdarg b/nuttx/include/cxx/cstdarg deleted file mode 100644 index 4964f8e7c..000000000 --- a/nuttx/include/cxx/cstdarg +++ /dev/null @@ -1,49 +0,0 @@ -//*************************************************************************** -// include/cxx/cstdarg -// -// Copyright (C) 2009, 2012 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_CXX_CSTDARG -#define __INCLUDE_CXX_CSTDARG - -//*************************************************************************** -// Included Files -//*************************************************************************** - -#include - -//*************************************************************************** -// Namespace -//*************************************************************************** - -#endif // __INCLUDE_CXX_CSTDARG diff --git a/nuttx/include/cxx/cstdbool b/nuttx/include/cxx/cstdbool deleted file mode 100644 index 192fde490..000000000 --- a/nuttx/include/cxx/cstdbool +++ /dev/null @@ -1,58 +0,0 @@ -//*************************************************************************** -// include/cxx/cstdbool -// -// 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 __INCLUDE_CXX_CSTDBOOL -#define __INCLUDE_CXX_CSTDBOOL - -//*************************************************************************** -// Included Files -//*************************************************************************** - -#include - -//*************************************************************************** -// Namespace -//*************************************************************************** - -//*************************************************************************** -// Namespace -//*************************************************************************** - -namespace std -{ - using ::_Bool8; -} - -#endif // __INCLUDE_CXX_CSTDBOOL diff --git a/nuttx/include/cxx/cstddef b/nuttx/include/cxx/cstddef deleted file mode 100644 index 73dbcd526..000000000 --- a/nuttx/include/cxx/cstddef +++ /dev/null @@ -1,81 +0,0 @@ -//*************************************************************************** -// include/cxx/cstddef -// -// 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 __INCLUDE_CXX_CCTYPE -#define __INCLUDE_CXX_CCTYPE - -//*************************************************************************** -// Included Files -//*************************************************************************** - -#include -#include - -#include - -//*************************************************************************** -// Namespace -//*************************************************************************** - -namespace std -{ - // Standard types - - using ::float32; -#ifndef CONFIG_HAVE_DOUBLE - using ::double_t; - using ::float64; -#else - using ::double_t; - using ::float64; -#endif - using ::mode_t; - using ::size_t; - using ::ssize_t; - using ::off_t; - using ::blksize_t; - using ::blkcnt_t; - using ::fpos_t; - using ::uid_t; - using ::gid_t; - using ::dev_t; - using ::ino_t; - using ::pid_t; - - using ::socklen_t; - using ::sa_family_t; -} - -#endif // __INCLUDE_CXX_CCTYPE diff --git a/nuttx/include/cxx/cstdint b/nuttx/include/cxx/cstdint deleted file mode 100644 index d662c5dc7..000000000 --- a/nuttx/include/cxx/cstdint +++ /dev/null @@ -1,81 +0,0 @@ -//*************************************************************************** -// include/cxx/cstdint -// -// Copyright (C) 2009, 2012 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_CXX_CSTDINT -#define __INCLUDE_CXX_CSTDINT - -//*************************************************************************** -// Included Files -//*************************************************************************** - -#include - -//*************************************************************************** -// Namespace -//*************************************************************************** - -namespace std -{ - using ::int8_t; - using ::int16_t; - using ::int32_t; - using ::int64_t; - using ::int_fast8_t; - using ::int_fast16_t; - using ::int_fast32_t; - using ::int_fast64_t; - using ::int_least8_t; - using ::int_least16_t; - using ::int_least32_t; - using ::int_least64_t; - using ::intmax_t; - using ::intptr_t; - using ::uint8_t; - using ::uint16_t; - using ::uint32_t; - using ::uint64_t; - using ::uint_fast8_t; - using ::uint_fast16_t; - using ::uint_fast32_t; - using ::uint_fast64_t; - using ::uint_least8_t; - using ::uint_least16_t; - using ::uint_least32_t; - using ::uint_least64_t; - using ::uintmax_t; - using ::uintptr_t; -} - -#endif // __INCLUDE_CXX_CSTDINT diff --git a/nuttx/include/cxx/cstdio b/nuttx/include/cxx/cstdio deleted file mode 100644 index 6a9620e1a..000000000 --- a/nuttx/include/cxx/cstdio +++ /dev/null @@ -1,96 +0,0 @@ -//*************************************************************************** -// include/cxx/cstdio -// -// 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 __INCLUDE_CXX_CCTYPE -#define __INCLUDE_CXX_CCTYPE - -//*************************************************************************** -// Included Files -//*************************************************************************** - -#include -#include - -//*************************************************************************** -// Namespace -//*************************************************************************** - -namespace std -{ - using ::FILE; - using ::fpos_t; - using ::size_t; - - using ::clearerr; - using ::fclose; - using ::fflush; - using ::feof; - using ::ferror; - using ::fgetc; - using ::fgetpos; - using ::fgets; - using ::fopen; - using ::fprintf; - using ::fputc; - using ::fputs; - using ::fread; - using ::fseek; - using ::fsetpos; - using ::ftell; - using ::fwrite; - using ::gets; - using ::ungetc; - - using ::printf; - using ::puts; - using ::rename; - using ::sprintf; - using ::asprintf; - using ::snprintf; - using ::sscanf; - using ::perror; - - using ::vprintf; - using ::vfprintf; - using ::vsprintf; - using ::avsprintf; - using ::vsnprintf; - using ::vsscanf; - - using ::fdopen; - using ::statfs; -} - -#endif // __INCLUDE_CXX_CCTYPE diff --git a/nuttx/include/cxx/cstdlib b/nuttx/include/cxx/cstdlib deleted file mode 100644 index 1bf8ed9da..000000000 --- a/nuttx/include/cxx/cstdlib +++ /dev/null @@ -1,85 +0,0 @@ -//*************************************************************************** -// include/cxx/cstdlib -// -// Copyright (C) 2009, 2012 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_CXX_CSTDLIB -#define __INCLUDE_CXX_CSTDLIB - -//*************************************************************************** -// Included Files -//*************************************************************************** - -#include -#include - -//*************************************************************************** -// Namespace -//*************************************************************************** - -namespace std -{ - using ::srand; - using ::rand; - -#ifndef CONFIG_DISABLE_ENIVRON - using ::getenv; - using ::putenv; - using ::clearenv; - using ::setenv; - using ::unsetenv; -#endif - - using ::exit; - using ::abort; -#ifdef CONFIG_SCHED_ATEXIT - using ::atexit; -#endif -#ifdef CONFIG_SCHED_ONEXIT - using ::on_exit; -#endif - - using ::strtol; - using ::strtoul; - using ::strtod; - - using ::malloc; - using ::free; - using ::realloc; - using ::memalign; - using ::zalloc; - using ::calloc; - using ::mallinfo; -} - -#endif // __INCLUDE_CXX_CSTDLIB diff --git a/nuttx/include/cxx/cstring b/nuttx/include/cxx/cstring deleted file mode 100644 index 84d98277d..000000000 --- a/nuttx/include/cxx/cstring +++ /dev/null @@ -1,85 +0,0 @@ -//*************************************************************************** -// include/cxx/cstring -// -// Copyright (C) 2009-2012 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_CXX_CSTRING -#define __INCLUDE_CXX_CSTRING - -//*************************************************************************** -// Included Files -//*************************************************************************** - -#include -#include - -//*************************************************************************** -// Namespace -//*************************************************************************** - -namespace std -{ - using ::size_t; - - using ::strdup; - using ::strndup; - using ::strerror; - using ::strlen; - using ::strnlen; - using ::strcat; - using ::strncat; - using ::strcmp; - using ::strncmp; - using ::strcasecmp; - using ::strncasecmp; - using ::strcpy; - using ::strncpy; - using ::strpbrk; - using ::strchr; - using ::strrchr; - using ::strspn; - using ::strcspn; - using ::strstr; - using ::strcasestr; - using ::strtok; - using ::strtok_r; - - using ::memchr; - using ::memccpy; - using ::memcmp; - using ::memcpy; - using ::memmove; - using ::memset; -} - -#endif // __INCLUDE_CXX_CSTRING diff --git a/nuttx/include/cxx/ctime b/nuttx/include/cxx/ctime deleted file mode 100644 index 3d3dfaec1..000000000 --- a/nuttx/include/cxx/ctime +++ /dev/null @@ -1,71 +0,0 @@ -//*************************************************************************** -// include/cxx/ctime -// -// 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 __INCLUDE_CXX_CTIME -#define __INCLUDE_CXX_CTIME - -//*************************************************************************** -// Included Files -//*************************************************************************** - -#include - -//*************************************************************************** -// Namespace -//*************************************************************************** - -namespace std -{ - using ::size_t; - using ::time_t; - using ::clockid_t; - using ::timer_t; - using ::timespec; - using ::timeval; - using ::tm; - using ::itimerspec; - using ::sigevent; - using ::clock_settime; - using ::clock_gettime; - using ::mktime; - using ::gmtime_r; - using ::timer_create; - using ::timer_delete; - using ::timer_settime; - using ::timer_gettime; - using ::timer_getoverrun; -} - -#endif // __INCLUDE_CXX_CTIME diff --git a/nuttx/include/cxx/cunistd b/nuttx/include/cxx/cunistd deleted file mode 100644 index 2f0b71270..000000000 --- a/nuttx/include/cxx/cunistd +++ /dev/null @@ -1,73 +0,0 @@ -//*************************************************************************** -// include/cxx/cunistd -// -// Copyright (C) 2012 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_CXX_CUNISTD -#define __INCLUDE_CXX_CUNISTD - -//*************************************************************************** -// Included Files -//*************************************************************************** - -#include - -//*************************************************************************** -// Namespace -//*************************************************************************** - -namespace std -{ - using ::getpid; - using ::_exit; - using ::sleep; - using ::usleep; - using ::close; - using ::dup; - using ::dup2; - using ::fsync; - using ::lseek; - using ::read; - using ::write; - using ::pipe; - using ::chdir; - using ::getcwd; - using ::unlink; - using ::rmdir; - using ::getopt; - using ::getoptargp; - using ::getopindgp; - using ::getoptoptp; -} - -#endif // __INCLUDE_CXX_CUNISTD diff --git a/nuttx/include/debug.h b/nuttx/include/debug.h deleted file mode 100644 index 70ae2ee18..000000000 --- a/nuttx/include/debug.h +++ /dev/null @@ -1,614 +0,0 @@ -/**************************************************************************** - * include/debug.h - * - * Copyright (C) 2007-2011, 2013 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_DEBUG_H -#define __INCLUDE_DEBUG_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Debug macros to runtime filter the debug messages sent to the console. In - * general, there are four forms of the debug macros: - * - * [a-z]dbg() -- Outputs messages to the console similar to printf() except - * that the output is not buffered. The first character indicates the - * system system (e.g., n=network, f=filesystm, etc.). If the first - * character is missing (i.e., dbg()), then it is common. The common - * dbg() macro is enabled by CONFIG_DEBUG. Subystem debug requires an - * additional configuration setting to enable it (e.g., CONFIG_DEBUG_NET - * for the network, CONFIG_DEBUG_FS for the file syste, etc). - * - * In general, error messages and output of importance use [a-z]dbg(). - * [a-z]dbg() is implementation dependent but usually uses file descriptors. - * (that is a problem only because the interrupt task may have re- - * directed stdout). Therefore [a-z]dbg() should not be used in interrupt - * handlers. - * - * [a-z]vdbg() -- Identifcal to [a-z]dbg() except that it also requires that - * CONFIG_DEBUG_VERBOSE be defined. This is intended for general debug - * output that you would normally want to suppress. - * - * [a-z]lldbg() -- Identical to [a-z]dbg() except this is uses special - * interfaces provided by architecture-specific logic to talk directly - * to the underlying console hardware. If the architecture provides such - * logic, it should define CONFIG_ARCH_LOWPUTC. - * - * [a-z]lldbg() should not be used in normal code because the implementation - * probably disables interrupts and does things that are not consistent with - * good real-time performance. However, [a-z]lldbg() is particularly useful - * in low-level code where it is inappropriate to use file descriptors. For - * example, only [a-z]lldbg() should be used in interrupt handlers. - * - * [a-z]llvdbg() -- Identifcal to [a-z]lldbg() except that it also requires that - * CONFIG_DEBUG_VERBOSE be defined. This is intended for general debug - * output that you would normally want to suppress. - */ - -#ifdef CONFIG_HAVE_FUNCTIONNAME -# define EXTRA_FMT "%s: " -# define EXTRA_ARG ,__FUNCTION__ -#else -# define EXTRA_FMT -# define EXTRA_ARG -#endif - -/* Debug macros will differ depending upon if the toolchain supports - * macros with a variable number of arguments or not. - */ - -#ifdef CONFIG_CPP_HAVE_VARARGS - -/* Variable argument macros supported */ - -#ifdef CONFIG_DEBUG -# define dbg(format, arg...) \ - syslog(EXTRA_FMT format EXTRA_ARG, ##arg) - -# ifdef CONFIG_ARCH_LOWPUTC -# define lldbg(format, arg...) \ - lowsyslog(EXTRA_FMT format EXTRA_ARG, ##arg) -# else -# define lldbg(x...) -# endif - -# ifdef CONFIG_DEBUG_VERBOSE -# define vdbg(format, arg...) \ - syslog(EXTRA_FMT format EXTRA_ARG, ##arg) - -# ifdef CONFIG_ARCH_LOWPUTC -# define llvdbg(format, arg...) \ - lowsyslog(EXTRA_FMT format EXTRA_ARG, ##arg) -# else -# define llvdbg(x...) -# endif - -# else -# define vdbg(x...) -# define llvdbg(x...) -# endif - -#else /* CONFIG_DEBUG */ - -# define dbg(x...) -# define lldbg(x...) -# define vdbg(x...) -# define llvdbg(x...) - -#endif /* CONFIG_DEBUG */ - -/* Subsystem specific debug */ - -#ifdef CONFIG_DEBUG_MM -# define mdbg(format, arg...) dbg(format, ##arg) -# define mlldbg(format, arg...) lldbg(format, ##arg) -# define mvdbg(format, arg...) vdbg(format, ##arg) -# define mllvdbg(format, arg...) llvdbg(format, ##arg) -#else -# define mdbg(x...) -# define mlldbg(x...) -# define mvdbg(x...) -# define mllvdbg(x...) -#endif - -#ifdef CONFIG_DEBUG_SCHED -# define sdbg(format, arg...) dbg(format, ##arg) -# define slldbg(format, arg...) lldbg(format, ##arg) -# define svdbg(format, arg...) vdbg(format, ##arg) -# define sllvdbg(format, arg...) llvdbg(format, ##arg) -#else -# define sdbg(x...) -# define slldbg(x...) -# define svdbg(x...) -# define sllvdbg(x...) -#endif - -#ifdef CONFIG_DEBUG_PAGING -# define pgdbg(format, arg...) dbg(format, ##arg) -# define pglldbg(format, arg...) lldbg(format, ##arg) -# define pgvdbg(format, arg...) vdbg(format, ##arg) -# define pgllvdbg(format, arg...) llvdbg(format, ##arg) -#else -# define pgdbg(x...) -# define pglldbg(x...) -# define pgvdbg(x...) -# define pgllvdbg(x...) -#endif - -#ifdef CONFIG_DEBUG_DMA -# define dmadbg(format, arg...) dbg(format, ##arg) -# define dmalldbg(format, arg...) lldbg(format, ##arg) -# define dmavdbg(format, arg...) vdbg(format, ##arg) -# define dmallvdbg(format, arg...) llvdbg(format, ##arg) -#else -# define dmadbg(x...) -# define dmalldbg(x...) -# define dmavdbg(x...) -# define dmallvdbg(x...) -#endif - -#ifdef CONFIG_DEBUG_NET -# define ndbg(format, arg...) dbg(format, ##arg) -# define nlldbg(format, arg...) lldbg(format, ##arg) -# define nvdbg(format, arg...) vdbg(format, ##arg) -# define nllvdbg(format, arg...) llvdbg(format, ##arg) -#else -# define ndbg(x...) -# define nlldbg(x...) -# define nvdbg(x...) -# define nllvdbg(x...) -#endif - -#ifdef CONFIG_DEBUG_USB -# define udbg(format, arg...) dbg(format, ##arg) -# define ulldbg(format, arg...) lldbg(format, ##arg) -# define uvdbg(format, arg...) vdbg(format, ##arg) -# define ullvdbg(format, arg...) llvdbg(format, ##arg) -#else -# define udbg(x...) -# define ulldbg(x...) -# define uvdbg(x...) -# define ullvdbg(x...) -#endif - -#ifdef CONFIG_DEBUG_FS -# define fdbg(format, arg...) dbg(format, ##arg) -# define flldbg(format, arg...) lldbg(format, ##arg) -# define fvdbg(format, arg...) vdbg(format, ##arg) -# define fllvdbg(format, arg...) llvdbg(format, ##arg) -#else -# define fdbg(x...) -# define flldbg(x...) -# define fvdbg(x...) -# define fllvdbg(x...) -#endif - -#ifdef CONFIG_DEBUG_INPUT -# define idbg(format, arg...) dbg(format, ##arg) -# define illdbg(format, arg...) lldbg(format, ##arg) -# define ivdbg(format, arg...) vdbg(format, ##arg) -# define illvdbg(format, arg...) llvdbg(format, ##arg) -#else -# define idbg(x...) -# define illdbg(x...) -# define ivdbg(x...) -# define illvdbg(x...) -#endif - -#ifdef CONFIG_DEBUG_ANALOG -# define adbg(format, arg...) dbg(format, ##arg) -# define alldbg(format, arg...) lldbg(format, ##arg) -# define avdbg(format, arg...) vdbg(format, ##arg) -# define allvdbg(format, arg...) llvdbg(format, ##arg) -#else -# define adbg(x...) -# define alldbg(x...) -# define avdbg(x...) -# define allvdbg(x...) -#endif - -#ifdef CONFIG_DEBUG_GRAPHICS -# define gdbg(format, arg...) dbg(format, ##arg) -# define glldbg(format, arg...) lldbg(format, ##arg) -# define gvdbg(format, arg...) vdbg(format, ##arg) -# define gllvdbg(format, arg...) llvdbg(format, ##arg) -#else -# define gdbg(x...) -# define glldbg(x...) -# define gvdbg(x...) -# define gllvdbg(x...) -#endif - -#ifdef CONFIG_DEBUG_BINFMT -# define bdbg(format, arg...) dbg(format, ##arg) -# define blldbg(format, arg...) lldbg(format, ##arg) -# define bvdbg(format, arg...) vdbg(format, ##arg) -# define bllvdbg(format, arg...) llvdbg(format, ##arg) -#else -# define bdbg(x...) -# define blldbg(x...) -# define bvdbg(x...) -# define bllvdbg(x...) -#endif - -#ifdef CONFIG_DEBUG_LIB -# define ldbg(format, arg...) dbg(format, ##arg) -# define llldbg(format, arg...) lldbg(format, ##arg) -# define lvdbg(format, arg...) vdbg(format, ##arg) -# define lllvdbg(format, arg...) llvdbg(format, ##arg) -#else -# define ldbg(x...) -# define llldbg(x...) -# define lvdbg(x...) -# define lllvdbg(x...) -#endif - -#else /* CONFIG_CPP_HAVE_VARARGS */ - -/* Variable argument macros NOT supported */ - -#ifdef CONFIG_DEBUG -# ifndef CONFIG_ARCH_LOWPUTC -# define lldbg (void) -# endif -# ifndef CONFIG_DEBUG_VERBOSE -# define vdbg (void) -# define llvdbg (void) -# else -# ifndef CONFIG_ARCH_LOWPUTC -# define llvdbg (void) -# endif -# endif -#else -# define dbg (void) -# define lldbg (void) -# define vdbg (void) -# define llvdbg (void) -#endif - -/* Subsystem specific debug */ - -#ifdef CONFIG_DEBUG_MM -# define mdbg dbg -# define mlldbg lldbg -# define mvdbg vdbg -# define mllvdbg llvdbg -#else -# define mdbg (void) -# define mlldbg (void) -# define mvdbg (void) -# define mllvdbg (void) -#endif - -#ifdef CONFIG_DEBUG_SCHED -# define sdbg dbg -# define slldbg lldbg -# define svdbg vdbg -# define sllvdbg llvdbg -#else -# define sdbg (void) -# define slldbg (void) -# define svdbg (void) -# define sllvdbg (void) -#endif - -#ifdef CONFIG_DEBUG_PAGING -# define pgdbg dbg -# define pglldbg lldbg -# define pgvdbg vdbg -# define pgllvdbg llvdbg -#else -# define pgdbg (void) -# define pglldbg (void) -# define pgvdbg (void) -# define pgllvdbg (void) -#endif - -#ifdef CONFIG_DEBUG_DMA -# define dmadbg dbg -# define dmalldbg lldbg -# define dmavdbg vdbg -# define dmallvdbg llvdbg -#else -# define dmadbg (void) -# define dmalldbg (void) -# define dmavdbg (void) -# define dmallvdbg (void) -#endif - -#ifdef CONFIG_DEBUG_NET -# define ndbg dbg -# define nlldbg lldbg -# define nvdbg vdbg -# define nllvdbg llvdbg -#else -# define ndbg (void) -# define nlldbg (void) -# define nvdbg (void) -# define nllvdbg (void) -#endif - -#ifdef CONFIG_DEBUG_USB -# define udbg dbg -# define ulldbg lldbg -# define uvdbg vdbg -# define ullvdbg llvdbg -#else -# define udbg (void) -# define ulldbg (void) -# define uvdbg (void) -# define ullvdbg (void) -#endif - -#ifdef CONFIG_DEBUG_FS -# define fdbg dbg -# define flldbg lldbg -# define fvdbg vdbg -# define fllvdbg llvdbg -#else -# define fdbg (void) -# define flldbg (void) -# define fvdbg (void) -# define fllvdbg (void) -#endif - -#ifdef CONFIG_DEBUG_INPUT -# define idbg dbg -# define illdbg lldbg -# define ivdbg vdbg -# define illvdbg llvdbg -#else -# define idbg (void) -# define illdbg (void) -# define ivdbg (void) -# define illvdbg (void) -#endif - -#ifdef CONFIG_DEBUG_ANALOG -# define adbg dbg -# define alldbg lldbg -# define avdbg vdbg -# define allvdbg llvdbg -#else -# define adbg (void) -# define alldbg (void) -# define avdbg (void) -# define allvdbg (void) -#endif - -#ifdef CONFIG_DEBUG_GRAPHICS -# define gdbg dbg -# define glldbg lldbg -# define gvdbg vdbg -# define gllvdbg llvdbg -#else -# define gdbg (void) -# define glldbg (void) -# define gvdbg (void) -# define gllvdbg (void) -#endif - -#ifdef CONFIG_DEBUG_BINFMT -# define bdbg dbg -# define blldbg lldbg -# define bvdbg vdbg -# define bllvdbg llvdbg -#else -# define bdbg (void) -# define blldbg (void) -# define bvdbg (void) -# define bllvdbg (void) -#endif - -#ifdef CONFIG_DEBUG_LIB -# define ldbg dbg -# define llldbg lldbg -# define lvdbg vdbg -# define lllvdbg llvdbg -#else -# define ldbg (void) -# define llldbg (void) -# define lvdbg (void) -# define lllvdbg (void) -#endif - -#endif /* CONFIG_CPP_HAVE_VARARGS */ - -/* Buffer dumping macros do not depend on varargs */ - -#ifdef CONFIG_DEBUG -# define dbgdumpbuffer(m,b,n) lib_dumpbuffer(m,b,n) -# ifdef CONFIG_DEBUG_VERBOSE -# define vdbgdumpbuffer(m,b,n) lib_dumpbuffer(m,b,n) -# else -# define vdbgdumpbuffer(m,b,n) -# endif -#else -# define dbgdumpbuffer(m,b,n) -# define vdbgdumpbuffer(m,b,n) -# endif - -/* Subsystem specific debug */ - -#ifdef CONFIG_DEBUG_MM -# define mdbgdumpbuffer(m,b,n) dbgdumpbuffer(m,b,n) -# define mvdbgdumpbuffer(m,b,n) vdbgdumpbuffer(m,b,n) -#else -# define mdbgdumpbuffer(m,b,n) -# define mvdbgdumpbuffer(m,b,n) -#endif - -#ifdef CONFIG_DEBUG_SCHED -# define sdbgdumpbuffer(m,b,n) dbgdumpbuffer(m,b,n) -# define svdbgdumpbuffer(m,b,n) vdbgdumpbuffer(m,b,n) -#else -# define sdbgdumpbuffer(m,b,n) -# define svdbgdumpbuffer(m,b,n) -#endif - -#ifdef CONFIG_DEBUG_PAGING -# define pgdbgdumpbuffer(m,b,n) dbgdumpbuffer(m,b,n) -# define pgvdbgdumpbuffer(m,b,n) vdbgdumpbuffer(m,b,n) -#else -# define pgdbgdumpbuffer(m,b,n) -# define pgvdbgdumpbuffer(m,b,n) -#endif - -#ifdef CONFIG_DEBUG_DMA -# define dmadbgdumpbuffer(m,b,n) dbgdumpbuffer(m,b,n) -# define dmavdbgdumpbuffer(m,b,n) vdbgdumpbuffer(m,b,n) -#else -# define dmadbgdumpbuffer(m,b,n) -# define dmavdbgdumpbuffer(m,b,n) -#endif - -#ifdef CONFIG_DEBUG_NET -# define ndbgdumpbuffer(m,b,n) dbgdumpbuffer(m,b,n) -# define nvdbgdumpbuffer(m,b,n) vdbgdumpbuffer(m,b,n) -#else -# define ndbgdumpbuffer(m,b,n) -# define nvdbgdumpbuffer(m,b,n) -#endif - -#ifdef CONFIG_DEBUG_USB -# define udbgdumpbuffer(m,b,n) dbgdumpbuffer(m,b,n) -# define uvdbgdumpbuffer(m,b,n) vdbgdumpbuffer(m,b,n) -#else -# define udbgdumpbuffer(m,b,n) -# define uvdbgdumpbuffer(m,b,n) -#endif - -#ifdef CONFIG_DEBUG_FS -# define fdbgdumpbuffer(m,b,n) dbgdumpbuffer(m,b,n) -# define fvdbgdumpbuffer(m,b,n) vdbgdumpbuffer(m,b,n) -#else -# define fdbgdumpbuffer(m,b,n) -# define fvdbgdumpbuffer(m,b,n) -#endif - -#ifdef CONFIG_DEBUG_INPUT -# define idbgdumpbuffer(m,b,n) dbgdumpbuffer(m,b,n) -# define ivdbgdumpbuffer(m,b,n) vdbgdumpbuffer(m,b,n) -#else -# define idbgdumpbuffer(m,b,n) -# define ivdbgdumpbuffer(m,b,n) -#endif - -#ifdef CONFIG_DEBUG_GRAPHICS -# define gdbgdumpbuffer(m,b,n) dbgdumpbuffer(m,b,n) -# define gvdbgdumpbuffer(m,b,n) vdbgdumpbuffer(m,b,n) -#else -# define gdbgdumpbuffer(m,b,n) -# define gvdbgdumpbuffer(m,b,n) -#endif - -#ifdef CONFIG_DEBUG_BINFMT -# define bdbgdumpbuffer(m,b,n) dbgdumpbuffer(m,b,n) -# define bvdbgdumpbuffer(m,b,n) vdbgdumpbuffer(m,b,n) -#else -# define bdbgdumpbuffer(m,b,n) -# define bvdbgdumpbuffer(m,b,n) -#endif - -#ifdef CONFIG_DEBUG_LIB -# define ldbgdumpbuffer(m,b,n) dbgdumpbuffer(m,b,n) -# define lvdbgdumpbuffer(m,b,n) vdbgdumpbuffer(m,b,n) -#else -# define ldbgdumpbuffer(m,b,n) -# define lvdbgdumpbuffer(m,b,n) -#endif - -/**************************************************************************** - * Public Type Declarations - ****************************************************************************/ - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/* Dump a buffer of data */ - -void lib_dumpbuffer(FAR const char *msg, FAR const uint8_t *buffer, unsigned int buflen); - -/* The system logging interfaces are pnormally accessed via the macros - * provided above. If the cross-compiler's C pre-processor supports a - * variable number of macro arguments, then those macros below will map all - * debug statements to the logging interfaces declared in syslog.h. - * - * If the cross-compiler's pre-processor does not support variable length - * arguments, then these additional APIs will be built. - */ - -#ifndef CONFIG_CPP_HAVE_VARARGS -#ifdef CONFIG_DEBUG -int dbg(const char *format, ...); - -# ifdef CONFIG_ARCH_LOWPUTC -int lldbg(const char *format, ...); -# endif - -# ifdef CONFIG_DEBUG_VERBOSE -int vdbg(const char *format, ...); - -# ifdef CONFIG_ARCH_LOWPUTC -int llvdbg(const char *format, ...); -# endif -#endif -#endif /* CONFIG_DEBUG */ -#endif /* CONFIG_CPP_HAVE_VARARGS */ - -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_DEBUG_H */ diff --git a/nuttx/include/dirent.h b/nuttx/include/dirent.h deleted file mode 100644 index 1eea999a1..000000000 --- a/nuttx/include/dirent.h +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** - * include/dirent.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 __INCLUDE_DIRENT_H -#define __INCLUDE_DIRENT_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* File type code for the d_type field in dirent struct. - * Note that because of the simplified filesystem organization - * of NuttX, an inode can be BOTH a file and a directory - */ - -#define DTYPE_FILE 0x01 -#define DTYPE_CHR 0x02 -#define DTYPE_BLK 0x04 -#define DTYPE_DIRECTORY 0x08 - -#define DIRENT_ISFILE(dtype) (((dtype) & DTYPE_FILE) != 0 ) -#define DIRENT_ISCHR(dtype) (((dtype) & DTYPE_CHR) != 0 ) -#define DIRENT_ISBLK(dtype) (((dtype) & DTYPE_BLK) != 0 ) -#define DIRENT_ISDIRECTORY(dtype) (((dtype) & DTYPE_DIRECTORY) != 0 ) - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/* The POSIX specification requires that the caller of readdir_r provide - * storage "large enough for a dirent with the d_name member and an array - * of char containing at least {NAME_MAX} plus one elements. - */ - -struct dirent -{ - uint8_t d_type; /* type of file */ - char d_name[NAME_MAX+1]; /* filename */ -}; - -typedef void DIR; - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/* POSIX-like File System Interfaces */ - -EXTERN int closedir(FAR DIR *dirp); -EXTERN FAR DIR *opendir(FAR const char *path); -EXTERN FAR struct dirent *readdir(FAR DIR *dirp); -EXTERN int readdir_r(FAR DIR *dirp, FAR struct dirent *entry, - FAR struct dirent **result); -EXTERN void rewinddir(FAR DIR *dirp); -EXTERN void seekdir(FAR DIR *dirp, off_t loc); -EXTERN off_t telldir(FAR DIR *dirp); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_DIRENT_H */ diff --git a/nuttx/include/elf32.h b/nuttx/include/elf32.h deleted file mode 100644 index e16ae0091..000000000 --- a/nuttx/include/elf32.h +++ /dev/null @@ -1,352 +0,0 @@ -/**************************************************************************** - * include/elf32.h - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Reference: System V Application Binary Interface, Edition 4.1, March 18, - * 1997, The Santa Cruz Operation, Inc. - * - * 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_ELF32_H -#define __INCLUDE_ELF32_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Values for Elf32_Ehdr::e_type */ - -#define ET_NONE 0 /* No file type */ -#define ET_REL 1 /* Relocatable file */ -#define ET_EXEC 2 /* Executable file */ -#define ET_DYN 3 /* Shared object file */ -#define ET_CORE 4 /* Core file */ -#define ET_LOPROC 0xff00 /* Processor-specific */ -#define ET_HIPROC 0xffff /* Processor-specific */ - -/* Values for Elf32_Ehdr::e_machine (most of this were not included in the - * original SCO document but have been gleaned from elsewhere). - */ - -#define EM_NONE 0 /* No machine */ -#define EM_M32 1 /* AT&T WE 32100 */ -#define EM_SPARC 2 /* SPARC */ -#define EM_386 3 /* Intel 80386 */ -#define EM_68K 4 /* Motorola 68000 */ -#define EM_88K 5 /* Motorola 88000 */ -#define EM_486 6 /* Intel 486+ */ -#define EM_860 7 /* Intel 80860 */ -#define EM_MIPS 8 /* MIPS R3000 Big-Endian */ -#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */ -#define EM_PARISC 15 /* HPPA */ -#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ -#define EM_PPC 20 /* PowerPC */ -#define EM_PPC64 21 /* PowerPC64 */ -#define EM_ARM 40 /* ARM */ -#define EM_SH 42 /* SuperH */ -#define EM_SPARCV9 43 /* SPARC v9 64-bit */ -#define EM_IA_64 50 /* HP/Intel IA-64 */ -#define EM_X86_64 62 /* AMD x86-64 */ -#define EM_S390 22 /* IBM S/390 */ -#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ -#define EM_V850 87 /* NEC v850 */ -#define EM_M32R 88 /* Renesas M32R */ -#define EM_H8_300 46 -#define EM_ALPHA 0x9026 -#define EM_CYGNUS_V850 0x9080 -#define EM_CYGNUS_M32R 0x9041 -#define EM_S390_OLD 0xa390 -#define EM_FRV 0x5441 - -/* Values for Elf32_Ehdr::e_version */ - -#define EV_NONE 0 /* Invalid version */ -#define EV_CURRENT 1 /* The current version */ - -/* Ehe ELF identifier */ - -#define EI_MAG0 0 /* File identification */ -#define EI_MAG1 1 /* " " " " */ -#define EI_MAG2 2 /* " " " " */ -#define EI_MAG3 3 /* " " " " */ -#define EI_CLASS 4 /* File class */ -#define EI_DATA 5 /* Data encoding */ -#define EI_VERSION 6 /* File version */ -#define EI_PAD 7 /* Start of padding bytes */ -#define EI_NIDENT 16 /* Size of eident[] */ - -#define EI_MAGIC_SIZE 4 -#define EI_MAGIC {0x7f, 'E', 'L', 'F'} - -/* Values for EI_CLASS */ - -#define ELFCLASSNONE 0 /* Invalid class */ -#define ELFCLASS32 1 /* 32-bit objects */ -#define ELFCLASS64 2 /* 64-bit objects */ - -/* Values for EI_DATA */ - -#define ELFDATANONE 0 /* Invalid data encoding */ -#define ELFDATA2LSB 1 /* Least significant byte occupying the lowest address */ -#define ELFDATA2MSB 2 /* Most significant byte occupying the lowest address */ - -/* Figure 4-7: Special Section Indexes */ - -#define SHN_UNDEF 0 -#define SHN_LORESERVE 0xff00 -#define SHN_LOPROC 0xff00 -#define SHN_HIPROC 0xff1f -#define SHN_ABS 0xfff1 -#define SHN_COMMON 0xfff2 -#define SHN_HIRESERVE 0xffff - -/* Figure 4-9: Section Types, sh_type */ - -#define SHT_NULL 0 -#define SHT_PROGBITS 1 -#define SHT_SYMTAB 2 -#define SHT_STRTAB 3 -#define SHT_RELA 4 -#define SHT_HASH 5 -#define SHT_DYNAMIC 6 -#define SHT_NOTE 7 -#define SHT_NOBITS 8 -#define SHT_REL 9 -#define SHT_SHLIB 10 -#define SHT_DYNSYM 11 -#define SHT_LOPROC 0x70000000 -#define SHT_HIPROC 0x7fffffff -#define SHT_LOUSER 0x80000000 -#define SHT_HIUSER 0xffffffff - -/* Figure 4-11: Section Attribute Flags, sh_flags */ - -#define SHF_WRITE 1 -#define SHF_ALLOC 2 -#define SHF_EXECINSTR 4 -#define SHF_MASKPROC 0xf0000000 - -/* Definitions for Elf32_Sym::st_info */ - -#define ELF32_ST_BIND(i) ((i) >> 4) -#define ELF32_ST_TYPE(i) ((i) & 0xf) -#define ELF32_ST_INFO(b,t) (((b) << 4) | ((t) & 0xf)) - -/* Figure 4-16: Symbol Binding, ELF32_ST_BIND */ - -#define STB_LOCAL 0 -#define STB_GLOBAL 1 -#define STB_WEAK 2 -#define STB_LOPROC 13 -#define STB_HIPROC 15 - -/* Figure 4-17: Symbol Types, ELF32_ST_TYPE */ - -#define STT_NOTYPE 0 -#define STT_OBJECT 1 -#define STT_FUNC 2 -#define STT_SECTION 3 -#define STT_FILE 4 -#define STT_LOPROC 13 -#define STT_HIPROC 15 - -/* Definitions for Elf32_Rel*::r_info */ - -#define ELF32_R_SYM(i) ((i) >> 8) -#define ELF32_R_TYPE(i) ((i) & 0xff) -#define ELF32_R_INFO(s,t) (((s)<< 8) | ((t) & 0xff)) - -/* Figure 5-2: Segment Types, p_type */ - -#define PT_NULL 0 -#define PT_LOAD 1 -#define PT_DYNAMIC 2 -#define PT_INTERP 3 -#define PT_NOTE 4 -#define PT_SHLIB 5 -#define PT_PHDR 6 -#define PT_LOPROC 0x70000000 -#define PT_HIPROC 0x7fffffff - -/* Figure 5-3: Segment Flag Bits, p_flags */ - -#define PF_X 1 /* Execute */ -#define PF_W 2 /* Write */ -#define PF_R 4 /* Read */ -#define PF_MASKPROC 0xf0000000 /* Unspecified */ - -/* Figure 5-10: Dynamic Array Tags, d_tag */ - -#define DT_NULL 0 /* d_un=ignored */ -#define DT_NEEDED 1 /* d_un=d_val */ -#define DT_PLTRELSZ 2 /* d_un=d_val */ -#define DT_PLTGOT 3 /* d_un=d_ptr */ -#define DT_HASH 4 /* d_un=d_ptr */ -#define DT_STRTAB 5 /* d_un=d_ptr */ -#define DT_SYMTAB 6 /* d_un=d_ptr */ -#define DT_RELA 7 /* d_un=d_ptr */ -#define DT_RELASZ 8 /* d_un=d_val */ -#define DT_RELAENT 9 /* d_un=d_val */ -#define DT_STRSZ 10 /* d_un=d_val */ -#define DT_SYMENT 11 /* d_un=d_val */ -#define DT_INIT 12 /* d_un=d_ptr */ -#define DT_FINI 13 /* d_un=d_ptr */ -#define DT_SONAME 14 /* d_un=d_val */ -#define DT_RPATH 15 /* d_un=d_val */ -#define DT_SYMBOLIC 16 /* d_un=ignored */ -#define DT_REL 17 /* d_un=d_ptr */ -#define DT_RELSZ 18 /* d_un=d_val */ -#define DT_RELENT 19 /* d_un=d_val */ -#define DT_PLTREL 20 /* d_un=d_val */ -#define DT_DEBUG 21 /* d_un=d_ptr */ -#define DT_TEXTREL 22 /* d_un=ignored */ -#define DT_JMPREL 23 /* d_un=d_ptr */ -#define DT_BINDNOW 24 /* d_un=ignored */ -#define DT_LOPROC 0x70000000 /* d_un=unspecified */ -#define DT_HIPROC 0x7fffffff /* d_un= unspecified */ - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/* Figure 4.2: 32-Bit Data Types */ - -typedef uint32_t Elf32_Addr; /* Unsigned program address */ -typedef uint16_t Elf32_Half; /* Unsigned medium integer */ -typedef uint32_t Elf32_Off; /* Unsigned file offset */ -typedef int32_t Elf32_Sword; /* Signed large integer */ -typedef uint32_t Elf32_Word; /* Unsigned large integer */ - -/* Figure 4-3: ELF Header */ - -typedef struct -{ - unsigned char e_ident[EI_NIDENT]; - Elf32_Half e_type; - Elf32_Half e_machine; - Elf32_Word e_version; - Elf32_Addr e_entry; - Elf32_Off e_phoff; - Elf32_Off e_shoff; - Elf32_Word e_flags; - Elf32_Half e_ehsize; - Elf32_Half e_phentsize; - Elf32_Half e_phnum; - Elf32_Half e_shentsize; - Elf32_Half e_shnum; - Elf32_Half e_shstrndx; -} Elf32_Ehdr; - -/* Figure 4-8: Section Header */ - -typedef struct -{ - Elf32_Word sh_name; - Elf32_Word sh_type; - Elf32_Word sh_flags; - Elf32_Addr sh_addr; - Elf32_Off sh_offset; - Elf32_Word sh_size; - Elf32_Word sh_link; - Elf32_Word sh_info; - Elf32_Word sh_addralign; - Elf32_Word sh_entsize; -} Elf32_Shdr; - -/* Figure 4-15: Symbol Table Entry */ - -typedef struct -{ - Elf32_Word st_name; - Elf32_Addr st_value; - Elf32_Word st_size; - unsigned char st_info; - unsigned char st_other; - Elf32_Half st_shndx; -} Elf32_Sym; - -/* Figure 4-19: Relocation Entries */ - -typedef struct -{ - Elf32_Addr r_offset; - Elf32_Word r_info; -} Elf32_Rel; - -typedef struct -{ - Elf32_Addr r_offset; - Elf32_Word r_info; - Elf32_Sword r_addend; -} Elf32_Rela; - -/* Figure 5-1: Program Header */ - -typedef struct -{ - Elf32_Word p_type; - Elf32_Off p_offset; - Elf32_Addr p_vaddr; - Elf32_Addr p_paddr; - Elf32_Word p_filesz; - Elf32_Word p_memsz; - Elf32_Word p_flags; - Elf32_Word p_align; -} Elf32_Phdr; - -/* Figure 5-9: Dynamic Structure */ - -typedef struct -{ - Elf32_Sword d_tag; - union - { - Elf32_Word d_val; - Elf32_Addr d_ptr; - } d_un; -} Elf32_Dyn; - -//extern Elf32_Dyn _DYNAMIC[] ; - -#endif /* __INCLUDE_ELF32_H */ diff --git a/nuttx/include/errno.h b/nuttx/include/errno.h deleted file mode 100644 index ba4dcbd04..000000000 --- a/nuttx/include/errno.h +++ /dev/null @@ -1,369 +0,0 @@ -/************************************************************************ - * include/errno.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 __INCLUDE_ERRNO_H -#define __INCLUDE_ERRNO_H - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include - -/************************************************************************ - * Definitions - ************************************************************************/ - -/* Convenience/compatibility definition. - * - * For a flat, all kernel-mode build, the error can be read and written - * from all code using a simple pointer. - */ - -#ifndef CONFIG_NUTTX_KERNEL - -# define errno *get_errno_ptr() -# define set_errno(e) do { errno = (int)(e); } while (0) -# define get_errno(e) errno - -#else - -/* We doing separate user-/kernel-mode builds, then the errno has to be - * a little differently. In kernel-mode, the TCB errno value can still be - * read and written using a pointer. - */ - -#ifdef __KERNEL__ -# define errno *get_errno_ptr() -#else - -/* But in user-mode, the errno can only be read using the name 'errno'. - * The non-standard API set_errno() must be explicity be used from user- - * mode code in order to set the errno value. - */ - -# define errno get_errno() - -#endif /* __KERNEL__ */ -#endif /* CONFIG_NUTTX_KERNEL */ - -/* Definitions of error numbers and the string that would be - * returned by strerror(). - */ - -#define EPERM 1 -#define EPERM_STR "Operation not permitted" -#define ENOENT 2 -#define ENOENT_STR "No such file or directory" -#define ESRCH 3 -#define ESRCH_STR "No such process" -#define EINTR 4 -#define EINTR_STR "Interrupted system call" -#define EIO 5 -#define EIO_STR "I/O error" -#define ENXIO 6 -#define ENXIO_STR "No such device or address" -#define E2BIG 7 -#define E2BIG_STR "Arg list too long" -#define ENOEXEC 8 -#define ENOEXEC_STR "Exec format error" -#define EBADF 9 -#define EBADF_STR "Bad file number" -#define ECHILD 10 -#define ECHILD_STR "No child processes" -#define EAGAIN 11 -#define EWOULDBLOCK EAGAIN -#define EAGAIN_STR "Try again" -#define ENOMEM 12 -#define ENOMEM_STR "Out of memory" -#define EACCES 13 -#define EACCES_STR "Permission denied" -#define EFAULT 14 -#define EFAULT_STR "Bad address" -#define ENOTBLK 15 -#define ENOTBLK_STR "Block device required" -#define EBUSY 16 -#define EBUSY_STR "Device or resource busy" -#define EEXIST 17 -#define EEXIST_STR "File exists" -#define EXDEV 18 -#define EXDEV_STR "Cross-device link" -#define ENODEV 19 -#define ENODEV_STR "No such device" -#define ENOTDIR 20 -#define ENOTDIR_STR "Not a directory" -#define EISDIR 21 -#define EISDIR_STR "Is a directory" -#define EINVAL 22 -#define EINVAL_STR "Invalid argument" -#define ENFILE 23 -#define ENFILE_STR "File table overflow" -#define EMFILE 24 -#define EMFILE_STR "Too many open files" -#define ENOTTY 25 -#define ENOTTY_STR "Not a typewriter" -#define ETXTBSY 26 -#define ETXTBSY_STR "Text file busy" -#define EFBIG 27 -#define EFBIG_STR "File too large" -#define ENOSPC 28 -#define ENOSPC_STR "No space left on device" -#define ESPIPE 29 -#define ESPIPE_STR "Illegal seek" -#define EROFS 30 -#define EROFS_STR "Read-only file system" -#define EMLINK 31 -#define EMLINK_STR "Too many links" -#define EPIPE 32 -#define EPIPE_STR "Broken pipe" -#define EDOM 33 -#define EDOM_STR "Math argument out of domain of func" -#define ERANGE 34 -#define ERANGE_STR "Math result not representable" -#define EDEADLK 35 -#define EDEADLOCK EDEADLK -#define EDEADLK_STR "Resource deadlock would occur" -#define ENAMETOOLONG 36 -#define ENAMETOOLONG_STR "File name too long" -#define ENOLCK 37 -#define ENOLCK_STR "No record locks available" -#define ENOSYS 38 -#define ENOSYS_STR "Function not implemented" -#define ENOTEMPTY 39 -#define ENOTEMPTY_STR "Directory not empty" -#define ELOOP 40 -#define ELOOP_STR "Too many symbolic links encountered" -#define ENOMSG 42 -#define ENOMSG_STR "No message of desired type" -#define EIDRM 43 -#define EIDRM_STR "Identifier removed" -#define ECHRNG 44 -#define ECHRNG_STR "Channel number out of range" -#define EL2NSYNC 45 -#define EL2NSYNC_STR "Level 2 not synchronized" -#define EL3HLT 46 -#define EL3HLT_STR "Level 3 halted" -#define EL3RST 47 -#define EL3RST_STR "Level 3 reset" -#define ELNRNG 48 -#define ELNRNG_STR "Link number out of range" -#define EUNATCH 49 -#define EUNATCH_STR "Protocol driver not attached" -#define ENOCSI 50 -#define ENOCSI_STR "No CSI structure available" -#define EL2HLT 51 -#define EL2HLT_STR "Level 2 halted" -#define EBADE 52 -#define EBADE_STR "Invalid exchange" -#define EBADR 53 -#define EBADR_STR "Invalid request descriptor" -#define EXFULL 54 -#define EXFULL_STR "Exchange full" -#define ENOANO 55 -#define ENOANO_STR "No anode" -#define EBADRQC 56 -#define EBADRQC_STR "Invalid request code" -#define EBADSLT 57 -#define EBADSLT_STR "Invalid slot" -#define EBFONT 59 -#define EBFONT_STR "Bad font file format" -#define ENOSTR 60 -#define ENOSTR_STR "Device not a stream" -#define ENODATA 61 -#define ENODATA_STR "No data available" -#define ETIME 62 -#define ETIME_STR "Timer expired" -#define ENOSR 63 -#define ENOSR_STR "Out of streams resources" -#define ENONET 64 -#define ENONET_STR "Machine is not on the network" -#define ENOPKG 65 -#define ENOPKG_STR "Package not installed" -#define EREMOTE 66 -#define EREMOTE_STR "Object is remote" -#define ENOLINK 67 -#define ENOLINK_STR "Link has been severed" -#define EADV 68 -#define EADV_STR "Advertise error" -#define ESRMNT 69 -#define ESRMNT_STR "Srmount error" -#define ECOMM 70 -#define ECOMM_STR "Communication error on send" -#define EPROTO 71 -#define EPROTO_STR "Protocol error" -#define EMULTIHOP 72 -#define EMULTIHOP_STR "Multihop attempted" -#define EDOTDOT 73 -#define EDOTDOT_STR "RFS specific error" -#define EBADMSG 74 -#define EBADMSG_STR "Not a data message" -#define EOVERFLOW 75 -#define EOVERFLOW_STR "Value too large for defined data type" -#define ENOTUNIQ 76 -#define ENOTUNIQ_STR "Name not unique on network" -#define EBADFD 77 -#define EBADFD_STR "File descriptor in bad state" -#define EREMCHG 78 -#define EREMCHG_STR "Remote address changed" -#define ELIBACC 79 -#define ELIBACC_STR "Can not access a needed shared library" -#define ELIBBAD 80 -#define ELIBBAD_STR "Accessing a corrupted shared library" -#define ELIBSCN 81 -#define ELIBSCN_STR ".lib section in a.out corrupted" -#define ELIBMAX 82 -#define ELIBMAX_STR "Attempting to link in too many shared libraries" -#define ELIBEXEC 83 -#define ELIBEXEC_STR "Cannot exec a shared library directly" -#define EILSEQ 84 -#define EILSEQ_STR "Illegal byte sequence" -#define ERESTART 85 -#define ERESTART_STR "Interrupted system call should be restarted" -#define ESTRPIPE 86 -#define ESTRPIPE_STR "Streams pipe error" -#define EUSERS 87 -#define EUSERS_STR "Too many users" -#define ENOTSOCK 88 -#define ENOTSOCK_STR "Socket operation on non-socket" -#define EDESTADDRREQ 89 -#define EDESTADDRREQ_STR "Destination address required" -#define EMSGSIZE 90 -#define EMSGSIZE_STR "Message too long" -#define EPROTOTYPE 91 -#define EPROTOTYPE_STR "Protocol wrong type for socket" -#define ENOPROTOOPT 92 -#define ENOPROTOOPT_STR "Protocol not available" -#define EPROTONOSUPPORT 93 -#define EPROTONOSUPPORT_STR "Protocol not supported" -#define ESOCKTNOSUPPORT 94 -#define ESOCKTNOSUPPORT_STR "Socket type not supported" -#define EOPNOTSUPP 95 -#define EOPNOTSUPP_STR "Operation not supported on transport endpoint" -#define EPFNOSUPPORT 96 -#define EPFNOSUPPORT_STR "Protocol family not supported" -#define EAFNOSUPPORT 97 -#define EAFNOSUPPORT_STR "Address family not supported by protocol" -#define EADDRINUSE 98 -#define EADDRINUSE_STR "Address already in use" -#define EADDRNOTAVAIL 99 -#define EADDRNOTAVAIL_STR "Cannot assign requested address" -#define ENETDOWN 100 -#define ENETDOWN_STR "Network is down" -#define ENETUNREACH 101 -#define ENETUNREACH_STR "Network is unreachable" -#define ENETRESET 102 -#define ENETRESET_STR "Network dropped connection because of reset" -#define ECONNABORTED 103 -#define ECONNABORTED_STR "Software caused connection abort" -#define ECONNRESET 104 -#define ECONNRESET_STR "Connection reset by peer" -#define ENOBUFS 105 -#define ENOBUFS_STR "No buffer space available" -#define EISCONN 106 -#define EISCONN_STR "Transport endpoint is already connected" -#define ENOTCONN 107 -#define ENOTCONN_STR "Transport endpoint is not connected" -#define ESHUTDOWN 108 -#define ESHUTDOWN_STR "Cannot send after transport endpoint shutdown" -#define ETOOMANYREFS 109 -#define ETOOMANYREFS_STR "Too many references: cannot splice" -#define ETIMEDOUT 110 -#define ETIMEDOUT_STR "Connection timed out" -#define ECONNREFUSED 111 -#define ECONNREFUSED_STR "Connection refused" -#define EHOSTDOWN 112 -#define EHOSTDOWN_STR "Host is down" -#define EHOSTUNREACH 113 -#define EHOSTUNREACH_STR "No route to host" -#define EALREADY 114 -#define EALREADY_STR "Operation already in progress" -#define EINPROGRESS 115 -#define EINPROGRESS_STR "Operation now in progress" -#define ESTALE 116 -#define ESTALE_STR "Stale NFS file handle" -#define EUCLEAN 117 -#define EUCLEAN_STR "Structure needs cleaning" -#define ENOTNAM 118 -#define ENOTNAM_STR "Not a XENIX named type file" -#define ENAVAIL 119 -#define ENAVAIL_STR "No XENIX semaphores available" -#define EISNAM 120 -#define EISNAM_STR "Is a named type file" -#define EREMOTEIO 121 -#define EREMOTEIO_STR "Remote I/O error" -#define EDQUOT 122 -#define EDQUOT_STR "Quota exceeded" -#define ENOMEDIUM 123 -#define ENOMEDIUM_STR "No medium found" -#define EMEDIUMTYPE 124 -#define EMEDIUMTYPE_STR "Wrong medium type" - -/************************************************************************ - * Type Declarations - ************************************************************************/ - -/************************************************************************ - * Global Function Prototypes - ************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/* Return a pointer to the thread specific errno. NOTE: When doing a - * kernel-/user-mode build, this function can only be used within the - * kernel-mode space. - * - * In the user-mode space, set_errno() and get_errno() are always available, - * either as macros or via syscalls. - */ - -EXTERN FAR int *get_errno_ptr(void); - -#ifdef CONFIG_NUTTX_KERNEL -EXTERN void set_errno(int errcode); -EXTERN int get_errno(void); -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_ERRNO_H */ diff --git a/nuttx/include/fcntl.h b/nuttx/include/fcntl.h deleted file mode 100644 index 382c5be16..000000000 --- a/nuttx/include/fcntl.h +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************** - * include/fcntl.h - * - * Copyright (C) 2007-2009, 2012 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_FCNTL_H -#define __INCLUDE_FCNTL_H - -/******************************************************************************** - * Included Files - ********************************************************************************/ - -#include - -#include -#include - -/******************************************************************************** - * Definitions - ********************************************************************************/ - -/* open flag settings for open() (and related APIs) */ - -#define O_RDONLY (1 << 0) /* Open for read access (only) */ -#define O_RDOK O_RDONLY /* Read access is permitted (non-standard) */ -#define O_WRONLY (1 << 1) /* Open for write access (only) */ -#define O_WROK O_WRONLY /* Write access is permitted (non-standard) */ -#define O_RDWR (O_RDOK|O_WROK) /* Open for both read & write access */ -#define O_CREAT (1 << 2) /* Create file/sem/mq object */ -#define O_EXCL (1 << 3) /* Name must not exist when opened */ -#define O_APPEND (1 << 4) /* Keep contents, append to end */ -#define O_TRUNC (1 << 5) /* Delete contents */ -#define O_NONBLOCK (1 << 6) /* Don't wait for data */ -#define O_NDELAY O_NONBLOCK /* Synonym for O_NONBLOCK */ -#define O_SYNC (1 << 7) /* Synchronize output on write */ -#define O_DSYNC O_SYNC /* Equivalent to OSYNC in NuttX */ -#define O_BINARY (1 << 8) /* Open the file in binary (untranslated) mode. */ - -/* Unsupported, but required open flags */ - -#define O_RSYNC 0 /* Synchronize input on read */ -#define O_ACCMODE 0 /* Required by POSIX */ -#define O_NOCTTY 0 /* Required by POSIX */ -#define O_TEXT 0 /* Open the file in text (translated) mode. */ - -/* This is the highest bit number used in the open flags bitset. Bits above - * this bit number may be used within NuttX for other, internal purposes. - */ - -#define _O_MAXBIT 8 - -/* fcntl() commands */ - -#define F_DUPFD 0 /* Duplicate a file descriptor */ -#define F_GETFD 1 /* Read the file descriptor flags */ -#define F_GETFL 2 /* Read the file status flags */ -#define F_GETLEASE 3 /* Indicates what type of lease is held on fd (linux) */ -#define F_GETLK 4 /* Check if we could place a lock */ -#define F_GETOWN 5 /* Get the pid receiving SIGIO and SIGURG signals for fd */ -#define F_GETSIG 6 /* Get the signal sent */ -#define F_NOTIFY 7 /* Provide notification when directory referred to by fd changes (linux)*/ -#define F_SETFD 8 /* Set the file descriptor flags to value */ -#define F_SETFL 9 /* Set the file status flags to the value */ -#define F_SETLEASE 10 /* Set or remove file lease (linux) */ -#define F_SETLK 11 /* Acquire or release a lock on range of bytes */ -#define F_SETLKW 12 /* Like F_SETLK, but wait for lock to become available */ -#define F_SETOWN 13 /* Set pid that will receive SIGIO and SIGURG signals for fd */ -#define F_SETSIG 14 /* Set the signal to be sent */ - -/* For posix fcntl() and lockf() */ - -#define F_RDLCK 0 /* Take out a read lease */ -#define F_WRLCK 1 /* Take out a write lease */ -#define F_UNLCK 2 /* Remove a lease */ - -/* close-on-exec flag for F_GETRL and F_SETFL */ - -#define FD_CLOEXEC 1 - -/* These are the notifications that can be received from F_NOTIFY (linux) */ - -#define DN_ACCESS 0 /* A file was accessed */ -#define DN_MODIFY 1 /* A file was modified */ -#define DN_CREATE 2 /* A file was created */ -#define DN_DELETE 3 /* A file was unlinked */ -#define DN_RENAME 4 /* A file was renamed */ -#define DN_ATTRIB 5 /* Attributes of a file were changed */ - -/******************************************************************************** - * Public Type Definitions - ********************************************************************************/ - -/* struct flock is the third argument for F_GETLK, F_SETLK and F_SETLKW */ - -struct flock -{ - int16_t l_type; /* Type of lock: F_RDLCK, F_WRLCK, F_UNLCK */ - int16_t l_whence; /* How to interpret l_start: SEEK_SET, SEEK_CUR, SEEK_END */ - off_t l_start; /* Starting offset for lock */ - off_t l_len; /* Number of bytes to lock */ - pid_t l_pid; /* PID of process blocking our lock (F_GETLK only) */ -}; - -/******************************************************************************** - * Public Variables - ********************************************************************************/ - -/******************************************************************************** - * Public Function Prototypes - ********************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/* POSIX-like File System Interfaces */ - -EXTERN int creat(const char *path, mode_t mode); -EXTERN int open(const char *path, int oflag, ...); -EXTERN int fcntl(int fd, int cmd, ...); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_FCNTL_H */ diff --git a/nuttx/include/fixedmath.h b/nuttx/include/fixedmath.h deleted file mode 100644 index 4456361c7..000000000 --- a/nuttx/include/fixedmath.h +++ /dev/null @@ -1,226 +0,0 @@ -/**************************************************************************** - * include/fixedmath.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 __INCLUDE_FIXEDMATH_H -#define __INCLUDE_FIXEDMATH_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/************************************************************************** - * Definitions - **************************************************************************/ - -/* Common numbers */ - -#define b8HUNDRED 0x6400 /* 100 */ -#define b8TEN 0x0a00 /* 10 */ -#define b8ONE 0x0100 /* 1 */ -#define b8HALF 0x0080 /* 0.5 */ -#define b8ONETENTH 0x001a /* 0.1 (acutally 0.1015625) */ -#define b8ONEHUNDRTH 0x0003 /* 0.01 (actualy 0.0117198765) */ -#define b8HALFPI 0x0192 /* 1.5703125 */ -#define b8PI 0x0324 /* 3.1406250 */ -#define b8TWOPI 0x0648 /* 6.2812500 */ - -#define b8MAX 0x7fff /* Max value of b8_t */ -#define ub8MAX 0xffff /* Max value of rb8_t */ -#define b8MIN 0x8000 /* Min value of b8_t */ -#define ub8MIN 0x0000 /* Min value of ub8_t */ - -#define b16THOUSAND 0x03e80000 /* 1000 */ -#define b16HUNDRED 0x00640000 /* 100 */ -#define b16TEN 0x000a0000 /* 10 */ -#define b16ONE 0x00010000 /* 1 */ -#define b16HALF 0x00008000 /* 0.5 */ -#define b16ONETENTH 0x0000199a /* 0.1 (actually 0.100006..) */ -#define b16ONEHUNDRTH 0x0000028f /* 0.01 (actually 0.0099945..) */ -#define b16ONETHOUSTH 0x00000042 /* 0.001 (actually 0.000100708..)*/ -#define b16HALFPI 0x0001921f /* 1.57078552246 */ -#define b16PI 0x0003243f /* 3.14158630371 */ -#define b16TWOPI 0x0006487b /* 6.28312683105 */ - -#define b16MAX 0x7fffffff /* Max value of b16_t */ -#define ub16MAX 0xffffffff /* Max value of ub16_t */ -#define b16MIN 0x80000000 /* Min value of b16_t */ -#define ub16MIN 0x00000000 /* Min value of ub16_t */ - -#define b32MILLION 0x000f424000000000 /* 1000000 */ -#define b32THOUSAND 0x000003e800000000 /* 1000 */ -#define b32HUNDRED 0x0000006400000000 /* 100 */ -#define b32TEN 0x0000000a00000000 /* 10 */ -#define b32ONE 0x0000000100000000 /* 1 */ -#define b32HALF 0x0000000080000000 /* 0.5 */ -#define b32ONETENTH 0x000000001999999a /* 0.1 */ -#define b32ONEHUNDRTH 0x00000000028f5c29 /* 0.01 */ -#define b32ONETHOUSTH 0x0000000000418937 /* 0.001 */ -#define b32ONETENTHOU 0x0000000000068db9 /* 0.0001 */ -#define b32HALFPI 0x00000001921eb9ff /* 1.57078134990 */ -#define b32PI 0x00000003243f6b4f /* 3.14159269980 */ -#define b32TWOPI 0x00000006487ae7fd /* 6.28312539984 */ - -#define b32MAX 0x7fffffffffffffff /* Max value of b16_t */ -#define ub32MAX 0xffffffffffffffff /* Max value of ub16_t */ -#define b32MIN 0x8000000000000000 /* Min value of b16_t */ -#define ub32MIN 0x0000000000000000 /* Min value of ub16_t */ - -/* Conversions between b16 and b8 *****************************************/ - -#define b8tob16(b) (((b16_t)(b)) << 8) -#define ub8toub16(b) (((ub16_t)(b)) << 8) -#define b16tob8(b) (b8_t)(((b)+0x0080)>>8) -#define ub16toub8(b) (ub8_t)(((b)+0x0080)>>8) - -#ifdef CONFIG_HAVE_LONG_LONG -# define b8tob32(b) (((b32_t)(b)) << 24) -# define ub8toub32(b) (((ub32_t)(b)) << 24) -# define b16tob32(b) (((b32_t)(b)) << 16) -# define ub16toub32(b) (((ub32_t)(b)) << 16) -# define b32tob16(b) (b16_t)(((b) + 0x0000000000008000)>>16) -# define ub32toub16(b) (ub16_t)(((b) + 0x0000000000008000)>>16) -# define b32tob8(b) (b8_t)(((b) + 0x0000000000000080)>>8) -#endif - -/* 16-bit values with 8 bits of precision *********************************/ - -/* Conversions */ - -#define b8toi(a) ((a) >> 8) /* Conversion to integer */ -#define itob8(i) (((b8_t)(i)) << 8) /* Conversion from integer */ -#define uitoub8(i) (((ub8_t)(i)) << 8) /* Conversion from unsigned integer */ -#define b8tof(b) (((float)b)/256.0) /* Conversion to float */ -#define ftob8(f) (b8_t)(((f)*256.0)) /* Conversion from float */ -#define b8trunc(a) ((a) & 0xff00) /* Truncate to integer b8 */ -#define b8round(a) (((a)+0x0080) & 0xff00) /* Round to integer b8 */ -#define b8frac(a) ((a) & 0x00ff) /* Take fractional part */ - -/* Operators */ - -#define ub8inv(b) (0x8000/((b)>>1)) /* Inversion (b8=b15/b7) */ -#define b8inv(b) (0x4000/((b)>>2)) /* Inversion (b8=b14/b6) */ -#define b8addb8(a,b) ((a)+(b)) /* Addition */ -#define b8addi(a,i) ((a)+itob8(i)) /* Add integer from b16 */ -#define b8subb8(a,b) ((a)-(b)) /* Subtraction */ -#define b8subi(a,i) ((a)-itob8(i)) /* Subtract integer from b8 */ -#define b8mulb8(a,b) b16tob8((b16_t)(a)*(b16_t)(b) /* Muliplication */ -#define ub8mulub8(a,b) ub16toub8((ub16_t)(a)*(ub16_t)(b) /* Muliplication */ -#define b8muli(a,i) ((a)*(i)) /* Simple multiplication by integer */ -#define b8sqr(a) b8mulb8(a,a) /* Square */ -#define ub8sqr(a) ub8mulub8(a,a) /* Square */ -#define b8divb8(a,b) b8tob16(a)/(b16_t)(b) /* Division */ -#define ub8divub8(a,b) ub8toub16(a)/(ub16_t)(b) /* Division */ -#define b8divi(a,i) ((a)/(i)) /* Simple division by integer */ -#define b8idiv(i,j) (((i)<<8)/j) /* Division of integer, b8 result */ - -/* 32-bit values with 16 bits of precision ********************************/ - -/* Conversions */ - -#define b16toi(a) ((a) >> 16) /* Conversion to integer */ -#define itob16(i) (((b16_t)(i)) << 16) /* Conversion from integer */ -#define uitoub16(i) (((ub16_t)(i)) << 16) /* Conversion from unsigned integer */ -#define b16tof(b) (((float)b)/65536.0) /* Conversion to float */ -#define ftob16(f) (b16_t)(((f)*65536.0)) /* Conversion from float */ -#define b16trunc(a) ((a) & 0xffff0000) /* Truncate to integer */ -#define b16round(a) (((a)+0x00008000) & 0xffff0000) -#define b16frac(a) ((a) & 0x0000ffff) /* Take fractional part */ - -/* Operators */ - -#define ub16inv(b) (0x80000000/((b)>>1)) /* Inversion (b16=b31/b15) */ -#define b16inv(b) (0x40000000/((b)>>2)) /* Inversion (b16=b30/b14) */ -#define b16addb16(a,b) ((a)+(b)) /* Addition */ -#define b16addi(a,i) ((a)+itob16(i)) /* Add integer to b16 */ -#define b16subb16(a,b) ((a)-(b)) /* Subtraction */ -#define b16subi(a,i) ((a)-itob16(i)) /* Subtract integer from b16 */ -#define b16muli(a,i) ((a)*(i)) /* Simple multiplication by integer */ -#define b16divi(a,i) ((a)/(i)) /* Simple division by integer*/ -#define b16idiv(i,j) (((i)<<16)/j) /* Division of integer, b16 result */ - -#ifdef CONFIG_HAVE_LONG_LONG -# define b16mulb16(a,b) b32tob16((b32_t)(a)*(b32_t)(b)) /* Muliplication */ -# define ub16mulub16(a,b) ub32toub16((ub32_t)(a)*(ub32_t)(b) -# define b16sqr(a) b16mulb16(a,a) /* Square */ -# define ub16sqr(a) ub16mulub16(a,a) /* Square */ -# define b16divb16(a,b) b16tob32(a)/(b32_t)(b) /* Division */ -# define ub16divub16(a,b) ub16toub32(a)/(ub32_t)(b) -#endif - -/************************************************************************** - * Public Types - **************************************************************************/ - -typedef int16_t b8_t; -typedef uint16_t ub8_t; -typedef int32_t b16_t; -typedef uint32_t ub16_t; -#ifdef CONFIG_HAVE_LONG_LONG -typedef int64_t b32_t; -typedef uint64_t ub32_t; -#endif - -/************************************************************************** - * Global Functions - **************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -#ifndef CONFIG_HAVE_LONG_LONG -EXTERN b16_t b16mulb16(b16_t m1, b16_t m2); -EXTERN ub16_t ub16mulub16(ub16_t m1, ub16_t m2); -EXTERN b16_t b16sqr(b16_t a); -EXTERN ub16_t ub16sqr(ub16_t a); -EXTERN b16_t b16divb16(b16_t num, b16_t denom); -EXTERN ub16_t ub16divub16(ub16_t num, ub16_t denom); -#endif - -EXTERN b16_t b16sin(b16_t rad); -EXTERN b16_t b16cos(b16_t rad); -EXTERN b16_t b16atan2(b16_t y, b16_t x); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif -#endif /* __INCLUDE_FIXEDMATH_H */ diff --git a/nuttx/include/inttypes.h b/nuttx/include/inttypes.h deleted file mode 100644 index caadbe5d1..000000000 --- a/nuttx/include/inttypes.h +++ /dev/null @@ -1,190 +0,0 @@ -/**************************************************************************** - * include/inttypes.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 __INCLUDE_INTTYPES_H -#define __INCLUDE_INTTYPES_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include /* for wchar_t */ - -/* Notes from www.opengroup.org: - * - * "The header shall include the header." - */ - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* "The following macros shall be defined. Each expands to a character string - * literal containing a conversion specifier, possibly modified by a lengt - * modifier, suitable for use within the format argument of a formatted - * input/output function when converting the corresponding integer type. - * These macros have the general form of PRI (character string literals for - * the fprintf() and fwprintf() family of functions) or SCN (character string - * literals for the fscanf() and fwscanf() family of functions), followed by - * the conversion specifier, followed by a name corresponding to a similar - * type name in . In these names, N represents the width of the - * type as described in . For example, PRIdFAST32 can be used in a - * format string to print the value of an integer of type int_fast32_t. - * - * "The fprintf() macros for signed integers are: - * - * PRIdN - * PRIdLEASTN - * PRIdFASTN - * PRIdMAX - * PRIdPTR - * - * PRIiN - * PRIiLEASTN - * PRIiFASTN - * PRIiMAX - * PRIiPTR - * - * "The fprintf() macros for unsigned integers are: - * - * PRIoN - * PRIoLEASTN - * PRIoFASTN - * PRIoMAX - * PRIoPTR - * - * PRIuN - * PRIuLEASTN - * PRIuFASTN - * PRIuMAX - * PRIuPTR - * - * PRIxN - * PRIxLEASTN - * PRIxFASTN - * PRIxMAX - * PRIxPTR - * - * PRIXN - * PRIXLEASTN - * PRIXFASTN - * PRIXMAX - * PRIXPTR - * - * "The fscanf() macros for signed integers are: - * - * SCNdN - * SCNdLEASTN - * SCNdFASTN - * SCNdMAX - * SCNdPTR - * - * SCNiN - * SCNiLEASTN - * SCNiFASTN - * SCNiMAX - * SCNiPTR - * - * "The fscanf() macros for unsigned integers are: - * - * SCNoN - * SCNoLEASTN - * SCNoFASTN - * SCNoMAX - * SCNoPTR - * - * SCNuN - * SCNuLEASTN - * SCNuFASTN - * SCNuMAX - * SCNuPTR - * - * SCNxN - * SCNxLEASTN - * SCNxFASTN - * SCNxMAX - * SCNxPTR - * - * "For each type that the implementation provides in , the - * corresponding fprintf() and fwprintf() macros shall be defined and the - * corresponding fscanf() and fwscanf() macros shall be defined unless the - * implementation does not have a suitable modifier for the type. - */ - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ - -/* "The header shall include a definition of at least the - * following type: - * - * imaxdiv_t - * Structure type that is the type of the value returned by the imaxdiv() - * function. - */ - -typedef void *imaxdiv_t; /* Dummy type since imaxdiv is not yet supported */ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/* "The following shall be declared as functions and may also be defined as - * macros. Function prototypes shall be provided." - */ - -EXTERN intmax_t imaxabs(intmax_t); -EXTERN imaxdiv_t imaxdiv(intmax_t, intmax_t); -EXTERN intmax_t strtoimax(const char *, char **, int); -EXTERN uintmax_t strtoumax(const char *, char **, int); - -EXTERN intmax_t wcstoimax(const wchar_t *, wchar_t **, int); -EXTERN uintmax_t wcstoumax(const wchar_t *, wchar_t **, int); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_INTTYPES_H */ diff --git a/nuttx/include/libgen.h b/nuttx/include/libgen.h deleted file mode 100644 index 0d42dc778..000000000 --- a/nuttx/include/libgen.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** - * include/libgen.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 __INCLUDE_LIBGEN_H -#define __INCLUDE_LIBGEN_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -EXTERN FAR char *basename(FAR char *path); -EXTERN FAR char *dirname(FAR char *path); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_LIBGEN_H */ diff --git a/nuttx/include/limits.h b/nuttx/include/limits.h deleted file mode 100644 index 056e2ada8..000000000 --- a/nuttx/include/limits.h +++ /dev/null @@ -1,212 +0,0 @@ -/******************************************************************************** - * include/limits.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 __INCLUDE_LIMITS_H -#define __INCLUDE_LIMITS_H - -/******************************************************************************** - * Included Files - ********************************************************************************/ - -#include - -/* Architecture specific limits */ - -#include - -/******************************************************************************** - * Pre-processor Definitions - ********************************************************************************/ -/* Default values for user configurable limits **********************************/ -/* Maximum number of bytes in a filename (not including terminating null). */ - -#ifndef CONFIG_NAME_MAX -# define CONFIG_NAME_MAX 32 -#endif - -/* Maximum number of bytes in a pathname, including the terminating null - * character. - */ - -#ifndef CONFIG_PATH_MAX -# if CONFIG_NAME_MAX < 64 -# define CONFIG_PATH_MAX (4*CONFIG_NAME_MAX + 1) -# else -# define CONFIG_PATH_MAX 256 -# endif -#endif - -/* Configurable limits required by POSIX **************************************** - * - * Required for all implementations: - * - * _POSIX_ARG_MAX Total length of string arguments - * _POSIX_CHILD_MAX Number of child tasks active - * _POSIX_LINK_MAX The number of links a file can have - * _POSIX_MAX_CANON Number bytes in TTY canonical input queue - * _POSIX_MAX_INPUT Number bytes in TTY canonical input queue - * _POSIX_NAME_MAX Number of bytes in a file or pathname component - * _POSIX_NGROUPS_MAX Number supplementary group IDs - * _POSIX_OPEN_MAX Number of files a task can have open at once - * _POSIX_PATH_MAX Number of bytes in a full pathname (including NULL) - * _POSIX_PIPE_BUF Number of bytes for atomic write into pipe - * _POSIX_SSIZE_MAX Largest filesystem write; also max value of ssize_t - * _POSIX_STREAM_MAX Number of std I/O streams open at once - * _POSIX_TZNAME_MAX Max number of bytes of a timezone name - * - * Required for sigqueue - * - * _POSIX_RTSIG_MAX Difference between SIGRTMIN and SIGRTMAX - * _POSIX_SIGQUEUE_MAX Max number signals a task can queue - * - * Required for POSIX timers - * - * _POSIX_DELAYTIMER_MAX Max number timer overruns - * _POSIX_TIMER_MAX Max number of timers per task - * _POSIX_CLOCKRES_MIN Clock resolution in nanoseconds - * - * Required for asynchronous I/O - * - * _POSIX_AIO_LISTIO_MAX Max number of AIOs in single listio call - * _POSIX_AIO_MAX Max number of simultaneous AIO operations - * - * Required for POSIX message passing - * - * _POSIX_MQ_OPEN_MAX Max number message queues task may open (mq_open) - * _POSIX_MQ_PRIO_MAX Max message priority (mq_send) - * - * Required for POSIX semaphores - * - * _POSIX_SEM_NSEMS_MAX Max number of open semaphores per task - * _POSIX_SEM_VALUE_MAX Max value a semaphore may have - */ - -#define _POSIX_ARG_MAX 4096 -#define _POSIX_CHILD_MAX 6 -#define _POSIX_LINK_MAX 8 -#define _POSIX_MAX_CANON 255 -#define _POSIX_MAX_INPUT 255 -#define _POSIX_NAME_MAX CONFIG_NAME_MAX -#define _POSIX_NGROUPS_MAX 0 -#define _POSIX_OPEN_MAX CONFIG_NFILE_DESCRIPTORS -#define _POSIX_PATH_MAX CONFIG_PATH_MAX -#define _POSIX_PIPE_BUF 512 -#define _POSIX_SSIZE_MAX INT_MAX -#define _POSIX_STREAM_MAX CONFIG_NFILE_STREAMS -#define _POSIX_TZNAME_MAX 3 - -/* Requred for sigqueue */ - -#define _POSIX_RTSIG_MAX 31 -#define _POSIX_SIGQUEUE_MAX 32 - -/* Required for POSIX timers. - * - * _POSIX_DELAYTIMER_MAX is the number of timer expiration overruns. - * - * _POSIX_TIMER_MAX is the per-process number of timers. - * - * _POSIX_CLOCKRES_MIN is the resolution of the CLOCK_REALTIME clock in nanoseconds. - * CLOCK_REALTIME is controlled by the NuttX system time. The default value is the - * system timer which has a resolution of 10 milliseconds. This default setting can - * be overridden by defining the clock interval in milliseconds as CONFIG_MSEC_PER_TICK - * in the board configuration file. - */ - -#define _POSIX_DELAYTIMER_MAX 32 -#define _POSIX_TIMER_MAX 32 - -#ifdef CONFIG_MSEC_PER_TICK -# define _POSIX_CLOCKRES_MIN ((CONFIG_MSEC_PER_TICK)*1000000) -#else -# define _POSIX_CLOCKRES_MIN (10*1000000) -#endif - -/* Required for asynchronous I/O */ - -#define _POSIX_AIO_LISTIO_MAX 2 -#define _POSIX_AIO_MAX 1 - -/* Required for POSIX message passing */ - -#define _POSIX_MQ_OPEN_MAX 8 -#define _POSIX_MQ_PRIO_MAX UCHAR_MAX - -/* Required for POSIX semaphores */ - -#define _POSIX_SEM_NSEMS_MAX INT_MAX -#define _POSIX_SEM_VALUE_MAX 0x7fff - -/* Actual limits. These values may be increased from the POSIX minimum - * values above or made indeterminate - */ - -#define ARG_MAX _POSIX_ARG_MAX -#define CHILD_MAX _POSIX_CHILD_MAX -#define LINK_MAX _POSIX_LINK_MAX -#define MAX_CANON _POSIX_MAX_CANON -#define MAX_INPUT _POSIX_MAX_INPUT -#define NAME_MAX _POSIX_NAME_MAX -#define NGROUPS_MAX _POSIX_NGROUPS_MAX -#define OPEN_MAX _POSIX_OPEN_MAX -#define PATH_MAX _POSIX_PATH_MAX -#define PIPE_BUF _POSIX_PIPE_BUF -#define SSIZE_MAX _POSIX_SSIZE_MAX -#define STREAM_MAX _POSIX_STREAM_MAX -#define TZNAME_MAX _POSIX_TZNAME_MAX - -#define RTSIG_MAX _POSIX_RTSIG_MAX -#define SIGQUEUE_MAX _POSIX_SIGQUEUE_MAX - -#define DELAYTIMER_MAX _POSIX_DELAYTIMER_MAX -#define TIMER_MAX _POSIX_TIMER_MAX -#define CLOCKRES_MIN _POSIX_CLOCKRES_MIN - -/* Required for asynchronous I/O */ - -#define AIO_LISTIO_MAX _POSIX_AIO_LISTIO_MAX -#define AIO_MAX _POSIX_AIO_MAX - -/* Required for POSIX message passing */ - -#define MQ_OPEN_MAX _POSIX_MQ_OPEN_MAX -#define MQ_PRIO_MAX _POSIX_MQ_PRIO_MAX - -/* Required for POSIX semaphores */ - -#define SEM_NSEMS_MAX _POSIX_SEM_NSEMS_MAX -#define SEM_VALUE_MAX _POSIX_SEM_VALUE_MAX - -#endif /* __INCLUDE_LIMITS_H */ diff --git a/nuttx/include/mqueue.h b/nuttx/include/mqueue.h deleted file mode 100644 index 67dd5842d..000000000 --- a/nuttx/include/mqueue.h +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************** - * include/mqueue.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 __INCLUDE_MQUEUE_H -#define __INCLUDE_MQUEUE_H - -/******************************************************************************** - * Included Files - ********************************************************************************/ - -#include -#include -#include "queue.h" - -/******************************************************************************** - * Compilations Switches - ********************************************************************************/ - -/******************************************************************************** - * Definitions - ********************************************************************************/ - -#define MQ_NONBLOCK O_NONBLOCK - -/******************************************************************************** - * Global Type Declarations - ********************************************************************************/ - -/* Message queue attributes */ - -struct mq_attr -{ - size_t mq_maxmsg; /* Max number of messages in queue */ - size_t mq_msgsize; /* Max message size */ - unsigned mq_flags; /* Queue flags */ - size_t mq_curmsgs; /* Number of messages currently in queue */ -}; - -/* Message queue descriptor */ - -typedef FAR struct mq_des *mqd_t; - -/******************************************************************************** - * Global Variables - ********************************************************************************/ - -/******************************************************************************** - * Global Function Prototypes - ********************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -EXTERN mqd_t mq_open(const char *mq_name, int oflags, ...); -EXTERN int mq_close(mqd_t mqdes ); -EXTERN int mq_unlink(const char *mq_name); -EXTERN int mq_send(mqd_t mqdes, const void *msg, size_t msglen, int prio); -EXTERN int mq_timedsend(mqd_t mqdes, const char *msg, size_t msglen, int prio, - const struct timespec *abstime); -EXTERN ssize_t mq_receive(mqd_t mqdes, void *msg, size_t msglen, int *prio); -EXTERN ssize_t mq_timedreceive(mqd_t mqdes, void *msg, size_t msglen, - int *prio, const struct timespec *abstime); -EXTERN int mq_notify(mqd_t mqdes, const struct sigevent *notification); -EXTERN int mq_setattr(mqd_t mqdes, const struct mq_attr *mq_stat, - struct mq_attr *oldstat); -EXTERN int mq_getattr(mqd_t mqdes, struct mq_attr *mq_stat); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_MQUEUE_H */ diff --git a/nuttx/include/net/ethernet.h b/nuttx/include/net/ethernet.h deleted file mode 100644 index afbbe56fa..000000000 --- a/nuttx/include/net/ethernet.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** - * include/net/ethernet.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 __INCLUDE_NET_ETHERNET_H -#define __INCLUDE_NET_ETHERNET_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -#define ETHER_ADDR_LEN 6 - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -struct ether_addr -{ - uint8_t ether_addr_octet[6]; /* 48-bit Ethernet address */ -}; - -struct ether_header -{ - uint8_t ether_dhost[ETHER_ADDR_LEN]; /* Destination Ethernet address */ - uint8_t ether_shost[ETHER_ADDR_LEN]; /* Source Ethernet address */ - uint16_t ether_type; /* Ethernet packet type*/ -}; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#endif /* __INCLUDE_NET_ETHERNET_H */ diff --git a/nuttx/include/net/if.h b/nuttx/include/net/if.h deleted file mode 100644 index 1ff8ebc38..000000000 --- a/nuttx/include/net/if.h +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************************* - * include/net/if.h - * - * Copyright (C) 2007, 2008, 2012 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_NET_IF_H -#define __INCLUDE_NET_IF_H - -/******************************************************************************************* - * Included Files - *******************************************************************************************/ - -#include - -/******************************************************************************************* - * Pre-Processor Definitions - *******************************************************************************************/ - -/* Sizing parameters */ - -#define IFNAMSIZ 6 /* Older naming standard */ -#define IF_NAMESIZE 6 /* Newer naming standard */ -#define IFHWADDRLEN 6 - -#define IFF_RUNNING (1 << 0) -#define IF_FLAG_IFUP (1 << 0) -#define IF_FLAG_IFDOWN (2 << 0) - -/******************************************************************************************* - * Public Type Definitions - *******************************************************************************************/ - -/* This is the newer form if the I/F request structure that can be used with both IPv4 - * and IPv6. - */ - -struct lifreq -{ - char lifr_name[IFNAMSIZ]; /* Network device name (e.g. "eth0") */ - union - { - struct sockaddr_storage lifru_addr; /* IP Address */ - struct sockaddr_storage lifru_dstaddr; /* P-to-P Address */ - struct sockaddr_storage lifru_broadaddr; /* Broadcast address */ - struct sockaddr_storage lifru_netmask; /* Netmask */ - struct sockaddr lifru_hwaddr; /* MAC address */ - int lifru_count; /* Number of devices */ - int lifru_mtu; /* MTU size */ - uint8_t lifru_flags; /* Interface flags */ - } lifr_ifru; -}; - -#define lifr_addr lifr_ifru.lifru_addr /* IP address */ -#define lifr_dstaddr lifr_ifru.lifru_dstaddr /* P-to-P Address */ -#define lifr_broadaddr lifr_ifru.lifru_broadaddr /* Broadcast address */ -#define lifr_netmask lifr_ifru.lifru_netmask /* Interface net mask */ -#define lifr_hwaddr lifr_ifru.lifru_hwaddr /* MAC address */ -#define lifr_mtu lifr_ifru.lifru_mtu /* MTU */ -#define lifr_count lifr_ifru.lifru_count /* Number of devices */ -#define lifr_flags lifr_ifru.lifru_flags /* interface flags */ - -/* This is the older I/F request that should only be used with IPv4. However, since - * NuttX only supports IPv4 or 6 (not both), we can force the older structure to - * be compatible when IPv6 is enabled. - */ - -#ifndef CONFIG_NET_IPv6 -struct ifreq -{ - char ifr_name[IFNAMSIZ]; /* Network device name (e.g. "eth0") */ - union - { - struct sockaddr ifru_addr; /* IP Address */ - struct sockaddr ifru_dstaddr; /* P-to-P Address */ - struct sockaddr ifru_broadaddr; /* Broadcast address */ - struct sockaddr ifru_netmask; /* Netmask */ - struct sockaddr ifru_hwaddr; /* MAC address */ - int ifru_count; /* Number of devices */ - int ifru_mtu; /* MTU size */ - uint8_t ifru_flags; /* Interface flags */ - } ifr_ifru; -}; - -#define ifr_addr ifr_ifru.ifru_addr /* IP address */ -#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* P-to-P Address */ -#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* Broadcast address */ -#define ifr_netmask ifr_ifru.ifru_netmask /* Interface net mask */ -#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ -#define ifr_mtu ifr_ifru.ifru_mtu /* MTU */ -#define ifr_count ifr_ifru.ifru_count /* Number of devices */ -#define ifr_flags ifr_ifru.ifru_flags /* interface flags */ - -#else /* CONFIG_NET_IPv6 */ - -#define ifreq lifreq /* Replace ifreq with lifreq */ -#define ifr_name lifr_name /* Network device name */ -#define ifr_addr lifr_ifru.lifru_addr /* IP address */ -#define ifr_dstaddr lifr_ifru.lifru_dstaddr /* P-to-P Address */ -#define ifr_broadaddr lifr_ifru.lifru_broadaddr /* Broadcast address */ -#define ifr_netmask lifr_ifru.lifru_netmask /* Interface net mask */ -#define ifr_hwaddr lifr_ifru.lifru_hwaddr /* MAC address */ -#define ifr_mtu lifr_ifru.lifru_mtu /* MTU */ -#define ifr_count lifr_ifru.lifru_count /* Number of devices */ -#define ifr_flags lifr_ifru.lifru_flags /* interface flags */ - -#endif /* CONFIG_NET_IPv6 */ - -/******************************************************************************************* - * Public Function Prototypes - *******************************************************************************************/ - -#endif /* __INCLUDE_NET_IF_H */ diff --git a/nuttx/include/netinet/arp.h b/nuttx/include/netinet/arp.h deleted file mode 100644 index e318945aa..000000000 --- a/nuttx/include/netinet/arp.h +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** - * include/netinet/arp.h - * - * Copyright (C) 2009, 2012 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_NETINET_ARP_H -#define __INCLUDE_NETINET_ARP_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Three ioctls are available on all PF_INET sockets, but only if the NuttX - * configuration CONFIG_NET_ARPIOCTLS is defined. Each ioctl takes a pointer - * to a 'struct arpreq' as its parameter. - */ - -#define SIOCSARP _ARPIOC(1) /* Set a ARP mapping */ -#define SIOCDARP _ARPIOC(2) /* Delete an ARP mapping */ -#define SIOCGARP _ARPIOC(3) /* Get an ARP mapping */ - -/* Definitions for bits in field arp_flags of struct arpreq. If the - * ATF_NETMASK flag is set, then arp_netmask should be valid. This should - * be set to 0xffffffff, or 0 to remove an existing arp entry. - */ - -#define ATF_COM (1 << 0) /* Lookup complete */ -#define ATF_PERM (1 << 1) /* Permanent entry */ -#define ATF_PUBL (1 << 2) /* Publish entry */ -#define ATF_USETRAILERS (1 << 3) /* Trailers requested (obsolete) */ -#define ATF_NETMASK (1 << 4) /* Use a netmask */ -#define ATF_DONTPUB (1 << 5) /* Don't answer */ - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/* All ARP ioctls take a pointer to a struct arpreq as their parameter: */ - -struct arpreq -{ - struct sockaddr arp_pa; /* Protocol address */ - struct sockaddr arp_ha; /* Hardware address */ - struct sockaddr arp_netmask; /* Netmask of protocol address */ - uint8_t arp_flags; /* Flags */ - uint8_t arp_dev[IFNAMSIZ+1]; /* Device name (zero terminated)*/ -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/* If CONFIG_NET_ARPIOCTLS is defined then the semi-standard ioctl commands - * described above are supported. If not, you can call the uIP ARP interfaces - * directly in a very non-standard way. See include/nuttx/net/uip/uip-arp.h for - * prototypes. - */ - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NETINET_ARP_H */ diff --git a/nuttx/include/netinet/ether.h b/nuttx/include/netinet/ether.h deleted file mode 100644 index 69b8fbba6..000000000 --- a/nuttx/include/netinet/ether.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * include/netinet/ether.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 __INCLUDE_NETINET_ETHER_H -#define __INCLUDE_NETINET_ETHER_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 FAR char *ether_ntoa(FAR const struct ether_addr *addr); -EXTERN struct ether_addr *ether_aton(const char *asc); -EXTERN int ether_ntohost(char *hostname, const struct ether_addr *addr); -EXTERN int ether_hostton(const char *hostname, struct ether_addr *addr); -EXTERN int ether_line(const char *line, struct ether_addr *addr, char *hostname); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NETINET_ETHER_H */ diff --git a/nuttx/include/netinet/in.h b/nuttx/include/netinet/in.h deleted file mode 100644 index 547dc0968..000000000 --- a/nuttx/include/netinet/in.h +++ /dev/null @@ -1,155 +0,0 @@ -/**************************************************************************** - * include/netinet/in.h - * - * Copyright (C) 2007, 2009-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 __INCLUDE_NETINET_IP_H -#define __INCLUDE_NETINET_IP_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Values for protocol argument to socket() */ - -#define IPPROTO_IP 0 /* Dummy protocol for TCP */ -#define IPPROTO_HOPOPTS 0 /* IPv6 Hop-by-Hop options. */ -#define IPPROTO_ICMP 1 /* Internet Control Message Protocol */ -#define IPPROTO_IGMP 2 /* Internet Group Management Protocol */ -#define IPPROTO_IPIP 4 /* IPIP tunnels (older KA9Q tunnels use 94) */ -#define IPPROTO_TCP 6 /* Transmission Control Protocol */ -#define IPPROTO_EGP 8 /* Exterior Gateway Protocol */ -#define IPPROTO_PUP 12 /* PUP protocol */ -#define IPPROTO_UDP 17 /* User Datagram Protocol */ -#define IPPROTO_IDP 22 /* XNS IDP protocol */ -#define IPPROTO_TP 29 /* SO Transport Protocol Class 4. */ -#define IPPROTO_DCCP 33 /* Datagram Congestion Control Protocol */ -#define IPPROTO_IPV6 41 /* IPv6-in-IPv4 tunnelling */ -#define IPPROTO_ROUTING 43 /* IPv6 routing header. */ -#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header. */ -#define IPPROTO_RSVP 46 /* Reservation Protocol. */ -#define IPPROTO_GRE 47 /* General Routing Encapsulation. */ -#define IPPROTO_ESP 50 /* Encapsulation Security Payload protocol */ -#define IPPROTO_AH 51 /* Authentication Header protocol */ -#define IPPROTO_ICMPV6 58 /* ICMPv6 */ -#define IPPROTO_NONE 59 /* IPv6 no next header. */ -#define IPPROTO_DSTOPTS 60 /* IPv6 destination options. */ -#define IPPROTO_MTP 92 /* Multicast Transport Protocol. */ -#define IPPROTO_ENCAP 98 /* Encapsulation Header. */ -#define IPPROTO_BEETPH 94 /* IP option pseudo header for BEET */ -#define IPPROTO_PIM 103 /* Protocol Independent Multicast */ -#define IPPROTO_COMP 108 /* Compression Header protocol */ -#define IPPROTO_SCTP 132 /* Stream Control Transport Protocol */ -#define IPPROTO_UDPLITE 136 /* UDP-Lite (RFC 3828) */ -#define IPPROTO_RAW 255 /* Raw IP packets */ - -/* Values used with SIOCSIFMCFILTER and SIOCGIFMCFILTER ioctl's */ - -#define MCAST_EXCLUDE 0 -#define MCAST_INCLUDE 1 - -/* Special values of in_addr_t */ - -#define INADDR_ANY ((in_addr_t)0x00000000) /* Address to accept any incoming messages */ -#define INADDR_BROADCAST ((in_addr_t)0xffffffff) /* Address to send to all hosts */ -#define INADDR_NONE ((in_addr_t)0xffffffff) /* Address indicating an error return */ -#define INADDR_LOOPBACK ((in_addr_t)0x7f000001) /* Inet 127.0.0.1. */ - -/* Special initializer for in6_addr_t */ - -#define IN6ADDR_ANY_INIT {{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}} -#define IN6ADDR_LOOPBACK_INIT {{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}}} - -/* struct in6_addr union selectors */ - -#define s6_addr in6_u.u6_addr8 -#define s6_addr16 in6_u.u6_addr16 -#define s6_addr32 in6_u.u6_addr32 - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/* IPv4 Internet address */ - -typedef uint32_t in_addr_t; - -struct in_addr -{ - in_addr_t s_addr; /* Address (network byte order) */ -}; - -struct sockaddr_in -{ - sa_family_t sin_family; /* Address family: AF_INET */ - uint16_t sin_port; /* Port in network byte order */ - struct in_addr sin_addr; /* Internet address */ -}; - -/* IPv6 Internet address */ - -struct in6_addr -{ - union - { - uint8_t u6_addr8[16]; - uint16_t u6_addr16[8]; - uint32_t u6_addr32[4]; - } in6_u; -}; - -struct sockaddr_in6 -{ - sa_family_t sin_family; /* Address family: AF_INET */ - uint16_t sin_port; /* Port in network byte order */ - struct in6_addr sin6_addr; /* IPv6 internet address */ -}; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#endif /* __INCLUDE_NETINET_IP_H */ diff --git a/nuttx/include/netinet/ip.h b/nuttx/include/netinet/ip.h deleted file mode 100644 index e2a6aaf4f..000000000 --- a/nuttx/include/netinet/ip.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** - * include/netinet/ip.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 __INCLUDE_NETINET_IP_H -#define __INCLUDE_NETINET_IP_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#endif /* __INCLUDE_NETINET_IP_H */ diff --git a/nuttx/include/netinet/ip6.h b/nuttx/include/netinet/ip6.h deleted file mode 100644 index be16ae722..000000000 --- a/nuttx/include/netinet/ip6.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** - * include/netinet/ip6.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 __INCLUDE_NETINET_I6P_H -#define __INCLUDE_NETINET_I6P_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#endif /* __INCLUDE_NETINET_I6P_H */ diff --git a/nuttx/include/nuttx/analog/adc.h b/nuttx/include/nuttx/analog/adc.h deleted file mode 100644 index f654bff05..000000000 --- a/nuttx/include/nuttx/analog/adc.h +++ /dev/null @@ -1,226 +0,0 @@ -/************************************************************************************ - * include/nuttx/analog/adc.h - * - * Copyright (C) 2011 Li Zhuoyi. All rights reserved. - * Author: Li Zhuoyi - * History: 0.1 2011-08-04 initial version - * 0.2 remove ao_read - * - * Derived from include/nuttx/can.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 __INCLUDE_NUTTX_ANALOG_ADC_H -#define __INCLUDE_NUTTX_ANALOG_ADC_H - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include -#include - -#include -#include -#include -#include -#include -#include - -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - -/* Default configuration settings that may be overridden in the board configuration. - * file. The configured size is limited to 255 to fit into a uint8_t. - */ - -#if !defined(CONFIG_ADC_FIFOSIZE) -# define CONFIG_ADC_FIFOSIZE 8 -#elif CONFIG_ADC_FIFOSIZE > 255 -# undef CONFIG_ADC_FIFOSIZE -# define CONFIG_ADC_FIFOSIZE 255 -#endif - -/************************************************************************************ - * Public Types - ************************************************************************************/ - -struct adc_msg_s -{ - uint8_t am_channel; /* The 8-bit ADC Channel */ - int32_t am_data; /* ADC convert result (4 bytes) */ -} packed_struct; - -struct adc_fifo_s -{ - sem_t af_sem; /* Counting semaphore */ - uint8_t af_head; /* Index to the head [IN] index in the circular buffer */ - uint8_t af_tail; /* Index to the tail [OUT] index in the circular buffer */ - /* Circular buffer of CAN messages */ - struct adc_msg_s af_buffer[CONFIG_ADC_FIFOSIZE]; -}; - -/* This structure defines all of the operations providd by the architecture specific - * logic. All fields must be provided with non-NULL function pointers by the - * caller of can_register(). - */ - -struct adc_dev_s; -struct adc_ops_s -{ - /* Reset the ADC device. Called early to initialize the hardware. This - * is called, before ao_setup() and on error conditions. - */ - - CODE void (*ao_reset)(FAR struct adc_dev_s *dev); - - /* Configure the ADC. This method is called the first time that the ADC - * device is opened. This will occur when the port is first opened. - * This setup includes configuring and attaching ADC interrupts. Interrupts - * are all disabled upon return. - */ - - CODE int (*ao_setup)(FAR struct adc_dev_s *dev); - - /* Disable the ADC. This method is called when the ADC device is closed. - * This method reverses the operation the setup method. - */ - - CODE void (*ao_shutdown)(FAR struct adc_dev_s *dev); - - /* Call to enable or disable RX interrupts */ - - CODE void (*ao_rxint)(FAR struct adc_dev_s *dev, bool enable); - - /* All ioctl calls will be routed through this method */ - - CODE int (*ao_ioctl)(FAR struct adc_dev_s *dev, int cmd, unsigned long arg); - -}; - -/* This is the device structure used by the driver. The caller of - * can_register() must allocate and initialize this structure. The - * calling logic need only set all fields to zero except: - * - * The elements of 'ad_ops', and 'ad_priv' - * - * The common logic will initialize all semaphores. - */ - -struct adc_dev_s -{ - uint8_t ad_ocount; /* The number of times the device has been opened */ - uint8_t ad_nrxwaiters; /* Number of threads waiting to enqueue a message */ - sem_t ad_closesem; /* Locks out new opens while close is in progress */ - sem_t ad_recvsem; /* Used to wakeup user waiting for space in ad_recv.buffer */ - struct adc_fifo_s ad_recv; /* Describes receive FIFO */ - const struct adc_ops_s *ad_ops; /* Arch-specific operations */ - void *ad_priv; /* Used by the arch-specific logic */ -}; - -/************************************************************************************ - * Public Data - ************************************************************************************/ - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -#if defined(__cplusplus) -extern "C" { -#endif - -/************************************************************************************ - * "Upper-Half" ADC Driver Interfaces - ************************************************************************************/ -/************************************************************************************ - * Name: adc_register - * - * Description: - * Register a ADC driver. This function binds an instance of a "lower half" ADC - * driver with the "upper half" ADC device and registers that device so that can - * be used by application code. - * - * Input parameters: - * path - The full path to the driver to be registers in the NuttX pseudo- - * filesystem. The recommended convention is to name all PWM drivers - * as "/dev/adc", "/dev/adc1", etc. where the driver path differs only - * in the "minor" number at the end of the device name. - * dev - A pointer to an instance of lower half ADC driver. This instance - * is bound to the upper half ADC driver and must persists as long as the - * upper half driver driver persists. - * - * Returned Value: - * Zero on success; a negated errno value on failure. - * - ************************************************************************************/ - -int adc_register(FAR const char *path, FAR struct adc_dev_s *dev); - -/************************************************************************************ - * Name: adc_receive - * - * Description: - * This function is called from the lower half, platform-specific ADC logic when - * new ADC sample data is available. - * - * Input Parameters: - * dev - The ADC device structure that was previously registered by adc_register() - * ch - And ID for the ADC channel number that generated the data - * data - The actualy converted data from the channel. - * - * Returned Value: - * Zero on success; a negated errno value on failure. - * - ************************************************************************************/ - -int adc_receive(FAR struct adc_dev_s *dev, uint8_t ch, int32_t data); - -/************************************************************************************ - * Platform-Independent "Lower Half" ADC Driver Interfaces - ************************************************************************************/ -/************************************************************************************ - * Name: up_ads1255initialize - * - * Description: - * Initialize the TI ADS 125X lower half driver - * - ************************************************************************************/ - -FAR struct adc_dev_s *up_ads1255initialize(FAR struct spi_dev_s *spi, unsigned int devno); - -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_ANALOG_ADC_H */ diff --git a/nuttx/include/nuttx/analog/dac.h b/nuttx/include/nuttx/analog/dac.h deleted file mode 100644 index 655fdbfcf..000000000 --- a/nuttx/include/nuttx/analog/dac.h +++ /dev/null @@ -1,212 +0,0 @@ -/************************************************************************************ - * include/nuttx/analog/dac.h - * - * Copyright (C) 2011 Li Zhuoyi. All rights reserved. - * Author: Li Zhuoyi - * History: 0.1 2011-08-04 initial version - * - * Derived from include/nuttx/can.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 __INCLUDE_NUTTX_ANALOG_DAC_H -#define __INCLUDE_NUTTX_ANALOG_DAC_H - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include - -#include -#include -#include -#include -#include -#include - -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ -/* Default configuration settings that may be overridden in the board configuration. - * file. The configured size is limited to 255 to fit into a uint8_t. - */ - -#if !defined(CONFIG_DAC_FIFOSIZE) -# define CONFIG_DAC_FIFOSIZE 8 -#elif CONFIG_DAC_FIFOSIZE > 255 -# undef CONFIG_DAC_FIFOSIZE -# define CONFIG_DAC_FIFOSIZE 255 -#endif - -/************************************************************************************ - * Public Types - ************************************************************************************/ - -struct dac_msg_s -{ - uint8_t am_channel; /* The 8-bit DAC Channel */ - int32_t am_data; /* DAC convert result (4 bytes) */ -}; - -struct dac_fifo_s -{ - sem_t af_sem; /* Counting semaphore */ - uint8_t af_head; /* Index to the head [IN] index in the circular buffer */ - uint8_t af_tail; /* Index to the tail [OUT] index in the circular buffer */ - /* Circular buffer of CAN messages */ - struct dac_msg_s af_buffer[CONFIG_DAC_FIFOSIZE]; -}; - -/* This structure defines all of the operations providd by the architecture specific - * logic. All fields must be provided with non-NULL function pointers by the - * caller of dac_register(). - */ - -struct dac_dev_s; -struct dac_ops_s -{ - /* Reset the DAC device. Called early to initialize the hardware. This - * is called, before ao_setup() and on error conditions. - */ - - CODE void (*ao_reset)(FAR struct dac_dev_s *dev); - - /* Configure the DAC. This method is called the first time that the DAC - * device is opened. This will occur when the port is first opened. - * This setup includes configuring and attaching DAC interrupts. Interrupts - * are all disabled upon return. - */ - - CODE int (*ao_setup)(FAR struct dac_dev_s *dev); - - /* Disable the DAC. This method is called when the DAC device is closed. - * This method reverses the operation the setup method. - */ - CODE void (*ao_shutdown)(FAR struct dac_dev_s *dev); - - /* Call to enable or disable TX interrupts */ - - CODE void (*ao_txint)(FAR struct dac_dev_s *dev, bool enable); - - /* This method will send one message on the DAC */ - - CODE int (*ao_send)(FAR struct dac_dev_s *dev, FAR struct dac_msg_s *msg); - - /* All ioctl calls will be routed through this method */ - - CODE int (*ao_ioctl)(FAR struct dac_dev_s *dev, int cmd, unsigned long arg); - -}; - -/* This is the device structure used by the driver. The caller of - * dac_register() must allocate and initialize this structure. The - * calling logic need only set all fields to zero except: - * - * The elements of 'ad_ops', and 'ad_priv' - * - * The common logic will initialize all semaphores. - */ - -struct dac_dev_s -{ - uint8_t ad_ocount; /* The number of times the device has been opened */ - uint8_t ad_nchannel; /* Number of dac channel */ - sem_t ad_closesem; /* Locks out new opens while close is in progress */ - struct dac_fifo_s ad_xmit; /* Describes receive FIFO */ - const struct dac_ops_s *ad_ops; /* Arch-specific operations */ - void *ad_priv; /* Used by the arch-specific logic */ -}; - -/************************************************************************************ - * Public Data - ************************************************************************************/ - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -#if defined(__cplusplus) -extern "C" { -#endif - -/************************************************************************************ - * Name: dac_register - * - * Description: - * Register a dac driver. - * - * Input Parameters: - * path - The full path to the DAC device to be registered. This could be, as an - * example, "/dev/dac0" - * dev - An instance of the device-specific DAC interface - * - * Returned Value: - * Zero on success; A negated errno value on failure. - * - ************************************************************************************/ - -int dac_register(FAR const char *path, FAR struct dac_dev_s *dev); - -/************************************************************************************ - * Name: dac_txdone - * - * Description: - * Called from the DAC interrupt handler at the completion of a send operation. - * - * Input Parameters: - * dev - An instance of the device-specific DAC interface - * - * Return: - * OK on success; a negated errno on failure. - * - ************************************************************************************/ - -int dac_txdone(FAR struct dac_dev_s *dev); - -/************************************************************************************ - * DAC Initialization functions - * - * Architecture-specific versions will have prototypes in architect-specific header - * files. Common DAC implementations in drivers/analog will have prototypes listed - * below. - * - ************************************************************************************/ - -FAR struct dac_dev_s *up_ad5410initialize(FAR struct spi_dev_s *spi, unsigned int devno); - -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_ANALOG_DAC_H */ diff --git a/nuttx/include/nuttx/analog/pga11x.h b/nuttx/include/nuttx/analog/pga11x.h deleted file mode 100644 index 8b04dee19..000000000 --- a/nuttx/include/nuttx/analog/pga11x.h +++ /dev/null @@ -1,390 +0,0 @@ -/**************************************************************************** - * include/nuttx/analog/pga11x.h - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Authors: Gregory Nutt - * - * References: - * "PGA112, PGA113, PGA116, PGA117: Zerø-Drift PROGRAMMABLE GAIN AMPLIFIER - * with MUX", SBOS424B, March 2008, Revised September 2008, Texas - * Instruments Incorporated" - * - * 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_NUTTX_ANALOG_PGA11X_H -#define __INCLUDE_NUTTX_ANALOG_PGA11X_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#if defined(CONFIG_ADC) && defined(CONFIG_ADC_PGA11X) - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* Prerequisites: - * CONFIG_ADC=y is needed to enable support for analog input devices - * - * CONFIG_ADC_PGA11X - * Enables support for the PGA11X driver (Needs CONFIG_ADC) - * CONFIG_PGA11X_SPIFREQUENCY - * SPI frequency. Default 1MHz - * CONFIG_PGA11X_DAISYCHAIN - * Use two PGA116/7's in Daisy Chain commands. - * CONFIG_PGA11X_SPIMODE - * SPI Mode. The specification says that the device operates in Mode 0 or - * Mode 3. But sometimes you need to tinker with this to get things to - * work correctly. Default: Mode 0 - * CONFIG_PGA11X_MULTIPLE - * Can be defined to support multiple PGA11X devices on board. Each - * device will require a customized SPI interface to distinguish them - * When SPI_SELECT is called with devid=SPIDEV_MUX. - * - * Other settings that effect the driver: - * CONFIG_SPI_OWNBUS -- If the PGA117 is enabled, this must be set to 'y' - * if the PGA117 is the only device on the SPI bus; - * CONFIG_DEBUG_SPI -- With CONFIG_DEBUG and CONFIG_DEBUG_VERBOSE, - * this will enable debug output from the PGA117 driver. - */ - -#ifndef CONFIG_PGA11X_SPIFREQUENCY -# define CONFIG_PGA11X_SPIFREQUENCY 1000000 -#endif - -#ifndef CONFIG_PGA11X_SPIMODE -# define CONFIG_PGA11X_SPIMODE SPIDEV_MODE0 -#endif - -/* PGA11x Commands **********************************************************/ -/* Write command Gain Selection Bits (PGA112/PGA113) - * - * the PGA112 and PGA116 provide binary gain selections (1, 2, 4, 8, 16, 32, - * 64, 128); the PGA113 and PGA117 provide scope gain selections (1, 2, 5, 10, - * 20, 50, 100, 200). - */ - -#define PGA11X_GAIN_1 (0) /* Gain=1: Scope Gain=1 */ -#define PGA11X_GAIN_2 (1) /* Gain=2: Scope Gain=2 */ -#define PGA11X_GAIN_4 (2) /* Gain=4: Scope Gain=5 */ -#define PGA11X_GAIN_5 (2) /* Gain=4: Scope Gain=5 */ -#define PGA11X_GAIN_8 (3) /* Gain=8: Scope Gain=10 */ -#define PGA11X_GAIN_10 (3) /* Gain=8: Scope Gain=10 */ -#define PGA11X_GAIN_16 (4) /* Gain=16: Scope Gain=20 */ -#define PGA11X_GAIN_20 (4) /* Gain=16: Scope Gain=20 */ -#define PGA11X_GAIN_32 (5) /* Gain=32: Scope Gain=50 */ -#define PGA11X_GAIN_50 (5) /* Gain=32: Scope Gain=50 */ -#define PGA11X_GAIN_64 (6) /* Gain=64: Scope Gain=100 */ -#define PGA11X_GAIN_100 (6) /* Gain=64: Scope Gain=100 */ -#define PGA11X_GAIN_128 (7) /* Gain=128: Scope Gain=200 */ -#define PGA11X_GAIN_200 (7) /* Gain=128: Scope Gain=200 */ - -/* Write command Mux Channel Selection Bits - * - * The PGA112/PGA113 have a two-channel input MUX; the PGA116/PGA117 have a - * 10-channel input MUX. - */ - -#define PGA11X_CHAN_VCAL (0) /* VCAL/CH0 */ -#define PGA11X_CHAN_CH0 (0) /* VCAL/CH0 */ -#define PGA11X_CHAN_CH1 (1) /* CH1 */ -#define PGA11X_CHAN_CH2 (2) /* CH2 (PGA116/PGA117 only) */ -#define PGA11X_CHAN_CH3 (3) /* CH3 (PGA116/PGA117 only) */ -#define PGA11X_CHAN_CH4 (4) /* CH4 (PGA116/PGA117 only) */ -#define PGA11X_CHAN_CH5 (5) /* CH5 (PGA116/PGA117 only) */ -#define PGA11X_CHAN_CH6 (6) /* CH6 (PGA116/PGA117 only) */ -#define PGA11X_CHAN_CH7 (7) /* CH7 (PGA116/PGA117 only) */ -#define PGA11X_CHAN_CH8 (8) /* CH8 (PGA116/PGA117 only) */ -#define PGA11X_CHAN_CH9 (9) /* CH9 (PGA116/PGA117 only) */ -#define PGA11X_CHAN_CAL1 (12) /* CAL1: connects to GND */ -#define PGA11X_CHAN_CAL2 (13) /* CAL2: connects to 0.9VCAL */ -#define PGA11X_CHAN_CAL3 (14) /* CAL3: connects to 0.1VCAL */ -#define PGA11X_CHAN_CAL4 (15) /* CAL4: connects to VREF */ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* Handle used to reference the particular PGA11X instance */ - -typedef FAR void *PGA11X_HANDLE; - -/* Settings for one device in a daisy-chain */ - -#ifdef CONFIG_PGA11X_DAISYCHAIN -struct pga11x_usettings_s -{ - uint8_t channel; /* See PGA11X_CHAN_* definitions */ - uint8_t gain; /* See PGA11X_GAIN_* definitions */ -}; -#endif - -/* These structures are used to encode gain and channel settings. This - * includes both devices in the case of a daisy-chained configuration. - * NOTE: This this logic is currently limited to only 2 devices in the - * daisy-chain. - */ - -struct pga11x_settings_s -{ -#ifndef CONFIG_PGA11X_DAISYCHAIN - uint8_t channel; /* See PGA11X_CHAN_* definitions */ - uint8_t gain; /* See PGA11X_GAIN_* definitions */ -#else - struct - { - uint8_t channel; /* See PGA11X_CHAN_* definitions */ - uint8_t gain; /* See PGA11X_GAIN_* definitions */ - } u1; - - struct - { - uint8_t channel; /* See PGA11X_CHAN_* definitions */ - uint8_t gain; /* See PGA11X_GAIN_* definitions */ - } u2; -#endif -}; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: pga11x_initialize - * - * Description: - * Initialize the PGA117 amplifier/multiplexer(s). - * - * Input Parameters: - * spi - An SPI "bottom half" device driver instance - * - * Returned Value: - * On success, a non-NULL opaque handle is returned; a NULL is returned - * on any failure. This handle may be used with the other PGA117 interface - * functions to control the multiplexer - * - ****************************************************************************/ - -EXTERN PGA11X_HANDLE pga11x_initialize(FAR struct spi_dev_s *spi); - -/**************************************************************************** - * Name: pga11x_select - * - * Description: - * Select an input channel and gain for all PGA11xs. - * - * If CONFIG_PGA11X_DAISYCHAIN is defined, then pga11x_select() configures - * both chips in the daisy-chain. pga11x_uselect() is provided to support - * configuring the parts in the daisychain independently. - * - * Input Parameters: - * spi - An SPI "bottom half" device driver instance - * settings - New channel and gain settings - * - * Returned Value: - * Zero on sucess; a negated errno value on failure. - * - ****************************************************************************/ - -EXTERN int pga11x_select(PGA11X_HANDLE handle, - FAR const struct pga11x_settings_s *settings); - -/**************************************************************************** - * Name: pga11x_uselect - * - * Description: - * Select an input channel and gain for one PGA11x. - * - * If CONFIG_PGA11X_DAISYCHAIN is defined, then pga11x_uselect() configures - * one chips in the daisy-chain. - * - * Input Parameters: - * spi - An SPI "bottom half" device driver instance - * pos - Position of the chip in the daisy chain (0 or 1) - * settings - New channel and gain settings - * - * Returned Value: - * Zero on sucess; a negated errno value on failure. - * - ****************************************************************************/ - -#ifdef CONFIG_PGA11X_DAISYCHAIN -EXTERN int pga11x_uselect(PGA11X_HANDLE handle, int pos, - FAR const struct pga11x_usettings_s *settings); -#endif - -/**************************************************************************** - * Name: pga11x_read - * - * Description: - * Read from all PGA117 amplifier/multiplexers. - * - * If CONFIG_PGA11X_DAISYCHAIN is defined, then pga11x_read() reads from - * both chips in the daisy-chain. pga11x_uread() is provided to support - * accessing the parts independently. - * - * Input Parameters: - * spi - An SPI "bottom half" device driver instance - * settings - Returned channel and gain settings - * - * Returned Value: - * Zero on sucess; a negated errno value on failure. - * - ****************************************************************************/ - -EXTERN int pga11x_read(PGA11X_HANDLE handle, - FAR struct pga11x_settings_s *settings); - -/**************************************************************************** - * Name: pga11x_uread - * - * Description: - * Read from one PGA117 amplifier/multiplexer. - * - * If CONFIG_PGA11X_DAISYCHAIN is defined, then pga11x_read() reads - * the parts independently. - * - * Input Parameters: - * spi - An SPI "bottom half" device driver instance - * pos - Position of the chip in the daisy chain (0 or 1) - * settings - Returned channel and gain settings - * - * Returned Value: - * Zero on sucess; a negated errno value on failure. - * - ****************************************************************************/ - -#ifdef CONFIG_PGA11X_DAISYCHAIN -EXTERN int pga11x_uread(PGA11X_HANDLE handle, int pos, - FAR struct pga11x_usettings_s *settings); -#endif - -/**************************************************************************** - * Name: pga11x_shutdown - * - * Description: - * Put all PGA11x;'s in shutdown down mode. - * - * If CONFIG_PGA11X_DAISYCHAIN is defined, then pga11x_shutdown() controls - * both chips in the daisy-chain. pga11x_ushutdown() is provided to - * control the parts independently. - * - * Input Parameters: - * spi - An SPI "bottom half" device driver instance - * - * Returned Value: - * Zero on sucess; a negated errno value on failure. - * - ****************************************************************************/ - -EXTERN int pga11x_shutdown(PGA11X_HANDLE handle); - -/**************************************************************************** - * Name: pga11x_ushutdown - * - * Description: - * Put one PGA11x in shutdown down mode. - * - * If CONFIG_PGA11X_DAISYCHAIN is defined, then pga11x_ushutdown() is - * provided to shutdown the parts independently. - * - * Input Parameters: - * spi - An SPI "bottom half" device driver instance - * pos - Position of the chip in the daisy chain (0 or 1) - * - * Returned Value: - * Zero on sucess; a negated errno value on failure. - * - ****************************************************************************/ - -#ifdef CONFIG_PGA11X_DAISYCHAIN -EXTERN int pga11x_ushutdown(PGA11X_HANDLE handle, int pos); -#endif - -/**************************************************************************** - * Name: pga11x_enable - * - * Description: - * Take all PGA11x's out of shutdown down mode. - * - * If CONFIG_PGA11X_DAISYCHAIN is defined, then pga11x_enable() controls - * both chips in the daisy-chain. pga11x_uenable() is provided to - * control the parts independently. - * - * Input Parameters: - * spi - An SPI "bottom half" device driver instance - * - * Returned Value: - * Zero on sucess; a negated errno value on failure. - * - ****************************************************************************/ - -EXTERN int pga11x_enable(PGA11X_HANDLE handle); - -/**************************************************************************** - * Name: pga11x_uenable - * - * Description: - * Take one PGA11x out of shutdown down mode. - * - * If CONFIG_PGA11X_DAISYCHAIN is defined, then pga11x_uenable() is - * provided to enable the parts independently. - * - * Input Parameters: - * spi - An SPI "bottom half" device driver instance - * pos - Position of the chip in the daisy chain (0 or 1) - * - * Returned Value: - * Zero on sucess; a negated errno value on failure. - * - ****************************************************************************/ - -#ifdef CONFIG_PGA11X_DAISYCHAIN -EXTERN int pga11x_uenable(PGA11X_HANDLE handle, int pos); -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_ADC && CONFIG_ADC_PGA11X */ -#endif /* __INCLUDE_NUTTX_ANALOG_PGA11X_H */ diff --git a/nuttx/include/nuttx/arch.h b/nuttx/include/nuttx/arch.h deleted file mode 100644 index 958986472..000000000 --- a/nuttx/include/nuttx/arch.h +++ /dev/null @@ -1,867 +0,0 @@ -/**************************************************************************** - * include/nuttx/arch.h - * - * Copyright (C) 2007-2013 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_NUTTX_ARCH_H -#define __INCLUDE_NUTTX_ARCH_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include -#include - -#include - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -typedef CODE void (*sig_deliver_t)(FAR _TCB *tcb); - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -extern "C" -{ -#endif - -/**************************************************************************** - * These are standard interfaces that must be exported to the - * scheduler from architecture-specific code. - ****************************************************************************/ - -/**************************************************************************** - * Name: up_initialize - * - * Description: - * up_initialize will be called once during OS - * initialization after the basic OS services have been - * initialized. The architecture specific details of - * initializing the OS will be handled here. Such things as - * setting up interrupt service routines, starting the - * clock, and registering device drivers are some of the - * things that are different for each processor and hardware - * platform. - * - * up_initialize is called after the OS initialized but - * before the init process has been started and before the - * libraries have been initialized. OS services and driver - * services are available. - * - ****************************************************************************/ - -void up_initialize(void); - -/**************************************************************************** - * Name: up_idle - * - * Description: - * up_idle() is the logic that will be executed - * when their is no other ready-to-run task. This is processor - * idle time and will continue until some interrupt occurs to - * cause a context switch from the idle task. - * - * Processing in this state may be processor-specific. e.g., - * this is where power management operations might be performed. - * - ****************************************************************************/ - -void up_idle(void); - -/**************************************************************************** - * Name: up_initial_state - * - * Description: - * A new thread is being started and a new TCB - * has been created. This function is called to initialize - * the processor specific portions of the new TCB. - * - * This function must setup the intial architecture registers - * and/or stack so that execution will begin at tcb->start - * on the next context switch. - * - ****************************************************************************/ - -void up_initial_state(FAR _TCB *tcb); - -/**************************************************************************** - * Name: up_create_stack - * - * Description: - * Allocate a stack for a new thread and setup - * up stack-related information in the TCB. - * - * The following TCB fields must be initialized: - * adj_stack_size: Stack size after adjustment for hardware, - * processor, etc. This value is retained only for debug - * purposes. - * stack_alloc_ptr: Pointer to allocated stack - * adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The - * initial value of the stack pointer. - * - * Inputs: - * tcb: The TCB of new task - * stack_size: The requested stack size. At least this much - * must be allocated. - * - ****************************************************************************/ - -#ifndef CONFIG_CUSTOM_STACK -int up_create_stack(FAR _TCB *tcb, size_t stack_size); -#endif - -/**************************************************************************** - * Name: up_use_stack - * - * Description: - * Setup up stack-related information in the TCB - * using pre-allocated stack memory - * - * The following TCB fields must be initialized: - * adj_stack_size: Stack size after adjustment for hardware, - * processor, etc. This value is retained only for debug - * purposes. - * stack_alloc_ptr: Pointer to allocated stack - * adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The - * initial value of the stack pointer. - * - * Inputs: - * tcb: The TCB of new task - * stack_size: The allocated stack size. - * - ****************************************************************************/ - -#ifndef CONFIG_CUSTOM_STACK -int up_use_stack(FAR _TCB *tcb, FAR void *stack, size_t stack_size); -#endif - -/**************************************************************************** - * Name: up_release_stack - * - * Description: - * A task has been stopped. Free all stack - * related resources retained int the defunct TCB. - * - ****************************************************************************/ - -#ifndef CONFIG_CUSTOM_STACK -void up_release_stack(FAR _TCB *dtcb); -#endif - -/**************************************************************************** - * Name: up_unblock_task - * - * Description: - * A task is currently in an inactive task list - * but has been prepped to execute. Move the TCB to the - * ready-to-run list, restore its context, and start execution. - * - * This function is called only from the NuttX scheduling - * logic. Interrupts will always be disabled when this - * function is called. - * - * Inputs: - * tcb: Refers to the tcb to be unblocked. This tcb is - * in one of the waiting tasks lists. It must be moved to - * the ready-to-run list and, if it is the highest priority - * ready to run taks, executed. - * - ****************************************************************************/ - -void up_unblock_task(FAR _TCB *tcb); - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task at the head of - * the ready to run list must be stopped. Save its context - * and move it to the inactive list specified by task_state. - * - * This function is called only from the NuttX scheduling - * logic. Interrupts will always be disabled when this - * function is called. - * - * Inputs: - * tcb: Refers to a task in the ready-to-run list (normally - * the task at the head of the list). It most be - * stopped, its context saved and moved into one of the - * waiting task lists. It it was the task at the head - * of the ready-to-run list, then a context to the new - * ready to run task must be performed. - * task_state: Specifies which waiting task list should be - * hold the blocked task TCB. - * - ****************************************************************************/ - -void up_block_task(FAR _TCB *tcb, tstate_t task_state); - -/**************************************************************************** - * Name: up_release_pending - * - * Description: - * When tasks become ready-to-run but cannot run because - * pre-emption is disabled, they are placed into a pending - * task list. This function releases and makes ready-to-run - * all of the tasks that have collected in the pending task - * list. This can cause a context switch if a new task is - * placed at the head of the ready to run list. - * - * This function is called only from the NuttX scheduling - * logic when pre-emptioni is re-enabled. Interrupts will - * always be disabled when this function is called. - * - ****************************************************************************/ - -void up_release_pending(void); - -/**************************************************************************** - * Name: up_reprioritize_rtr - * - * Description: - * Called when the priority of a running or - * ready-to-run task changes and the reprioritization will - * cause a context switch. Two cases: - * - * 1) The priority of the currently running task drops and the next - * task in the ready to run list has priority. - * 2) An idle, ready to run task's priority has been raised above the - * the priority of the current, running task and it now has the - * priority. - * - * This function is called only from the NuttX scheduling - * logic. Interrupts will always be disabled when this - * function is called. - * - * Inputs: - * tcb: The TCB of the task that has been reprioritized - * priority: The new task priority - * - ****************************************************************************/ - -void up_reprioritize_rtr(FAR _TCB *tcb, uint8_t priority); - -/**************************************************************************** - * Name: _exit - * - * Description: - * This function causes the currently executing task to cease - * to exist. This is a special case of task_delete() where the task to - * be deleted is the currently executing task. It is more complex because - * a context switch must be perform to the next ready to run task. - * - * Unlike other UP APIs, this function may be called directly from user - * programs in various states. The implementation of this function should - * disable interrupts before performing scheduling operations. - * - ****************************************************************************/ -/* Prototype is in unistd.h */ - -/**************************************************************************** - * Name: up_assert and up_assert_code - * - * Description: - * Assertions may be handled in an architecture-specific - * way. - * - ****************************************************************************/ -/* Prototype is in assert.h */ - -/**************************************************************************** - * Name: up_schedule_sigaction - * - * Description: - * This function is called by the OS when one or more - * signal handling actions have been queued for execution. - * The architecture specific code must configure things so - * that the 'igdeliver' callback is executed on the thread - * specified by 'tcb' as soon as possible. - * - * This function may be called from interrupt handling logic. - * - * This operation should not cause the task to be unblocked - * nor should it cause any immediate execution of sigdeliver. - * Typically, a few cases need to be considered: - * - * (1) This function may be called from an interrupt handler - * During interrupt processing, all xcptcontext structures - * should be valid for all tasks. That structure should - * be modified to invoke sigdeliver() either on return - * from (this) interrupt or on some subsequent context - * switch to the recipient task. - * (2) If not in an interrupt handler and the tcb is NOT - * the currently executing task, then again just modify - * the saved xcptcontext structure for the recipient - * task so it will invoke sigdeliver when that task is - * later resumed. - * (3) If not in an interrupt handler and the tcb IS the - * currently executing task -- just call the signal - * handler now. - * - ****************************************************************************/ - -#ifndef CONFIG_DISABLE_SIGNALS -void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver); -#endif - -/**************************************************************************** - * Name: up_allocate_heap - * - * Description: - * The heap may be statically allocated by defining CONFIG_HEAP_BASE and - * CONFIG_HEAP_SIZE. If these are not defined, then this function will be - * called to dynamically set aside the heap region. - * - ****************************************************************************/ - -#ifndef CONFIG_HEAP_BASE -void up_allocate_heap(FAR void **heap_start, size_t *heap_size); -#endif - -/**************************************************************************** - * Name: up_setpicbase, up_getpicbase - * - * Description: - * It NXFLAT external modules (or any other binary format that requires) - * PIC) are supported, then these macros must defined to (1) get or get - * the PIC base register value. These must be implemented with in-line - * assembly. - * - ****************************************************************************/ - -#ifndef CONFIG_PIC -# define up_setpicbase(picbase) -# define up_getpicbase(ppicbase) -#endif - -/**************************************************************************** - * Address Environment Interfaces - * - * Low-level interfaces used in binfmt/ to instantiate tasks with address - * environments. These interfaces all operate on type task_addrenv_t which - * is an abstract representation of a task's address environment and must be - * defined in arch/arch.h if CONFIG_ADDRENV is defined. - * - * up_addrenv_create - Create an address environment - * up_addrenv_vaddr - Returns the virtual base address of the address - * environment - * up_addrenv_select - Instantiate an address environment - * up_addrenv_restore - Restore an address environment - * up_addrenv_destroy - Destroy an address environment. - * up_addrenv_assign - Assign an address environment to a TCB - * - * Higher-level interfaces used by the tasking logic. These interfaces are - * used by the functions in sched/ and all operate on the TCB which as been - * assigned an address environment by up_addrenv_assign(). - * - * up_addrenv_share - Clone the address environment assigned to one TCB - * to another. This operation is done when a pthread - * is created that share's the same address - * environment. - * up_addrenv_release - Release the TCBs reference to an address - * environment when a task/thread exits. - * - ****************************************************************************/ -/**************************************************************************** - * Name: up_addrenv_create - * - * Description: - * This function is called from the binary loader logic when a new - * task is created in order to instantiate an address environment for the - * task. up_addrenv_create is essentially the allocator of the physical - * memory for the new task. - * - * Input Parameters: - * envsize - The size (in bytes) of the address environment needed by the - * task. - * addrenv - The location to return the representation of the task address - * environment. - * - * Returned Value: - * Zero (OK) on success; a negated errno value on failure. - * - ****************************************************************************/ - -#ifdef CONFIG_ADDRENV -int up_addrenv_create(size_t envsize, FAR task_addrenv_t *addrenv); -#endif - -/**************************************************************************** - * Name: up_addrenv_vaddr - * - * Description: - * Return the virtual address associated with the newly create address - * environment. This function is used by the binary loaders in order - * get an address that can be used to initialize the new task. - * - * Input Parameters: - * addrenv - The representation of the task address environment previously - * returned by up_addrenv_create. - * vaddr - The location to return the virtual address. - * - * Returned Value: - * Zero (OK) on success; a negated errno value on failure. - * - ****************************************************************************/ - -#ifdef CONFIG_ADDRENV -int up_addrenv_vaddr(FAR task_addrenv_t addrenv, FAR void **vaddr); -#endif - -/**************************************************************************** - * Name: up_addrenv_select - * - * Description: - * After an address environment has been established for a task (via - * up_addrenv_create(). This function may be called to to instantiate - * that address environment in the virtual address space. this might be - * necessary, for example, to load the code for the task from a file or - * to access address environment private data. - * - * Input Parameters: - * addrenv - The representation of the task address environment previously - * returned by up_addrenv_create. - * oldenv - * The address environment that was in place before up_addrenv_select(). - * This may be used with up_addrenv_restore() to restore the original - * address environment that was in place before up_addrenv_select() was - * called. Note that this may be a task agnostic, hardware - * representation that is different from task_addrenv_t. - * - * Returned Value: - * Zero (OK) on success; a negated errno value on failure. - * - ****************************************************************************/ - -#ifdef CONFIG_ADDRENV -int up_addrenv_select(task_addrenv_t addrenv, hw_addrenv_t *oldenv); -#endif - -/**************************************************************************** - * Name: up_addrenv_restore - * - * Description: - * After an address environment has been temporarilty instantiated by - * up_addrenv_select, this function may be called to to restore the - * original address environment. - * - * Input Parameters: - * oldenv - The hardware representation of the address environment - * previously returned by up_addrenv_select. - * - * Returned Value: - * Zero (OK) on success; a negated errno value on failure. - * - ****************************************************************************/ - -#ifdef CONFIG_ADDRENV -int up_addrenv_restore(hw_addrenv_t oldenv); -#endif - -/**************************************************************************** - * Name: up_addrenv_destroy - * - * Description: - * Called from the binary loader loader during error handling to destroy - * the address environment previously created by up_addrenv_create(). - * - * Input Parameters: - * addrenv - The representation of the task address environment previously - * returned by up_addrenv_create. - * - * Returned Value: - * Zero (OK) on success; a negated errno value on failure. - * - ****************************************************************************/ - -#ifdef CONFIG_ADDRENV -int up_addrenv_destroy(task_addrenv_t addrenv); -#endif - -/**************************************************************************** - * Name: up_addrenv_assign - * - * Description: - * Assign an address environment to a TCB. - * - * Input Parameters: - * addrenv - The representation of the task address environment previously - * returned by up_addrenv_create. - * tcb - The TCB of the task to receive the address environment. - * - * Returned Value: - * Zero (OK) on success; a negated errno value on failure. - * - ****************************************************************************/ - -#ifdef CONFIG_ADDRENV -int up_addrenv_assign(task_addrenv_t addrenv, FAR _TCB *tcb); -#endif - -/**************************************************************************** - * Name: up_addrenv_share - * - * Description: - * This function is called from the core scheduler logic when a thread - * is created that needs to share the address ennvironment of its parent - * task. In this case, the parent's address environment needs to be - * "cloned" for the child. - * - * Input Parameters: - * ptcb - The TCB of the parent task that has the address environment. - * ctcb - The TCB of the child thread needing the address environment. - * - * Returned Value: - * Zero (OK) on success; a negated errno value on failure. - * - ****************************************************************************/ - -#ifdef CONFIG_ADDRENV -int up_addrenv_share(FAR const _TCB *ptcb, FAR _TCB *ctcb); -#endif - -/**************************************************************************** - * Name: up_addrenv_release - * - * Description: - * This function is called when a task or thread exits in order to release - * its reference to an address environment. When there are no further - * references to an address environment, that address environment should - * be destroyed. - * - * Input Parameters: - * tcb - The TCB of the task or thread whose the address environment will - * be released. - * - * Returned Value: - * Zero (OK) on success; a negated errno value on failure. - * - ****************************************************************************/ - -#ifdef CONFIG_ADDRENV -int up_addrenv_release(FAR _TCB *tcb); -#endif - -/**************************************************************************** - * Name: up_interrupt_context - * - * Description: - * Return true is we are currently executing in - * the interrupt handler context. - * - ****************************************************************************/ - -bool up_interrupt_context(void); - -/**************************************************************************** - * Name: up_enable_irq - * - * Description: - * On many architectures, there are three levels of interrupt enabling: (1) - * at the global level, (2) at the level of the interrupt controller, - * and (3) at the device level. In order to receive interrupts, they - * must be enabled at all three levels. - * - * This function implements enabling of the device specified by 'irq' - * at the interrupt controller level if supported by the architecture - * (irqrestore() supports the global level, the device level is hardware - * specific). - * - * Since this API is not supported on all architectures, it should be - * avoided in common implementations where possible. - * - ****************************************************************************/ - -#ifndef CONFIG_ARCH_NOINTC -void up_enable_irq(int irq); -#endif - -/**************************************************************************** - * Name: up_disable_irq - * - * Description: - * This function implements disabling of the device specified by 'irq' - * at the interrupt controller level if supported by the architecture - * (irqsave() supports the global level, the device level is hardware - * specific). - * - * Since this API is not supported on all architectures, it should be - * avoided in common implementations where possible. - * - ****************************************************************************/ - -#ifndef CONFIG_ARCH_NOINTC -void up_disable_irq(int irq); -#endif - -/**************************************************************************** - * Name: up_prioritize_irq - * - * Description: - * Set the priority of an IRQ. - * - * Since this API is not supported on all architectures, it should be - * avoided in common implementations where possible. - * - ****************************************************************************/ - -#ifdef CONFIG_ARCH_IRQPRIO -int up_prioritize_irq(int irq, int priority); -#endif - -/**************************************************************************** - * Name: up_romgetc - * - * Description: - * In Harvard architectures, data accesses and instruction accesses occur - * on different busses, perhaps concurrently. All data accesses are - * performed on the data bus unless special machine instructions are - * used to read data from the instruction address space. Also, in the - * typical MCU, the available SRAM data memory is much smaller that the - * non-volatile FLASH instruction memory. So if the application requires - * many constant strings, the only practical solution may be to store - * those constant strings in FLASH memory where they can only be accessed - * using architecture-specific machine instructions. - * - * A similar case is where strings are retained in "external" memory such - * as EEPROM or serial FLASH. This case is similar only in that again - * special operations are required to obtain the string data; it cannot - * be accessed directly from a string pointer. - * - * If CONFIG_ARCH_ROMGETC is defined, then the architecture logic must - * export the function up_romgetc(). up_romgetc() will simply read one - * byte of data from the instruction space. - * - * If CONFIG_ARCH_ROMGETC, certain C stdio functions are effected: (1) - * All format strings in printf, fprintf, sprintf, etc. are assumed to - * lie in FLASH (string arguments for %s are still assumed to reside in - * SRAM). And (2), the string argument to puts and fputs is assumed to - * reside in FLASH. Clearly, these assumptions may have to modified for - * the particular needs of your environment. There is no "one-size-fits-all" - * solution for this problem. - * - ****************************************************************************/ - -#ifdef CONFIG_ARCH_ROMGETC -char up_romgetc(FAR const char *ptr); -#else -# define up_romgetc(ptr) (*ptr) -#endif - -/**************************************************************************** - * Name: up_mdelay and up_udelay - * - * Description: - * Some device drivers may require that the plaform-specific logic - * provide these timing loops for short delays. - * - ***************************************************************************/ - -void up_mdelay(unsigned int milliseconds); -void up_udelay(useconds_t microseconds); - -/**************************************************************************** - * Name: up_cxxinitialize - * - * Description: - * If C++ and C++ static constructors are supported, then this function - * must be provided by board-specific logic in order to perform - * initialization of the static C++ class instances. - * - * This function should then be called in the application-specific - * user_start logic in order to perform the C++ initialization. NOTE - * that no component of the core NuttX RTOS logic is involved; This - * function definition only provides the 'contract' between application - * specific C++ code and platform-specific toolchain support - * - ***************************************************************************/ - -#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE) -void up_cxxinitialize(void); -#endif - -/**************************************************************************** - * These are standard interfaces that are exported by the OS - * for use by the architecture specific logic - ****************************************************************************/ - -/**************************************************************************** - * Name: sched_process_timer - * - * Description: - * This function handles system timer events. - * The timer interrupt logic itself is implemented in the - * architecture specific code, but must call the following OS - * function periodically -- the calling interval must be - * MSEC_PER_TICK. - * - ****************************************************************************/ - -void sched_process_timer(void); - -/**************************************************************************** - * Name: irq_dispatch - * - * Description: - * This function must be called from the achitecture- - * specific logic in order to dispatch an interrupt to - * the appropriate, registered handling logic. - * - ***************************************************************************/ - -void irq_dispatch(int irq, FAR void *context); - -/**************************************************************************** - * Board-specific button interfaces exported by the board-specific logic - ****************************************************************************/ - -/**************************************************************************** - * Name: up_buttoninit - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * NOTE: This interface may or may not be supported by board-specific - * logic. If the board supports button interfaces, then CONFIG_ARCH_BUTTONS - * will be defined. - * - ****************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -void up_buttoninit(void); -#endif - -/**************************************************************************** - * Name: up_buttons - * - * Description: - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. A bit set to "1" means that the - * button is depressed; a bit set to "0" means that the button is released. - * The correspondence of the each button bit and physical buttons is board- - * specific. - * - * NOTE: This interface may or may not be supported by board-specific - * logic. If the board supports button interfaces, then CONFIG_ARCH_BUTTONS - * will be defined - * - ****************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -uint8_t up_buttons(void); -#endif - -/**************************************************************************** - * Name: up_irqbutton - * - * Description: - * This function may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. - * The previous interrupt handler address is returned (so that it may - * restored, if so desired). - * - * NOTE: This interface may or may not be supported by board-specific - * logic. If the board supports any button interfaces, then - * CONFIG_ARCH_BUTTONS will be defined; If the board supports interrupt - * buttons, then CONFIG_ARCH_IRQBUTTONS will also be defined. - * - ****************************************************************************/ - -#ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif - -/************************************************************************************ - * Relay control functions - * - * Description: - * Non-standard functions for relay control. - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_RELAYS -void up_relaysinit(void); -void relays_setstat(int relays, bool stat); -bool relays_getstat(int relays); -void relays_setstats(uint32_t relays_stat); -uint32_t relays_getstats(void); -void relays_onoff(int relays, uint32_t mdelay); -void relays_onoffs(uint32_t relays_stat, uint32_t mdelay); -void relays_resetmode(int relays); -void relays_powermode(int relays); -void relays_resetmodes(uint32_t relays_stat); -void relays_powermodes(uint32_t relays_stat); -#endif - -/**************************************************************************** - * Debug interfaces exported by the architecture-specific logic - ****************************************************************************/ - -/**************************************************************************** - * Name: up_putc - * - * Description: - * Output one character on the console - * - ****************************************************************************/ - -int up_putc(int ch); - -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_ARCH_H */ - diff --git a/nuttx/include/nuttx/ascii.h b/nuttx/include/nuttx/ascii.h deleted file mode 100644 index bfecff520..000000000 --- a/nuttx/include/nuttx/ascii.h +++ /dev/null @@ -1,200 +0,0 @@ -/**************************************************************************** - * include/nuttx/ascii.h - * ASCII Control Codes - * - * Copyright (C) 2012 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_NUTTX_ASCII_H -#define __INCLUDE_NUTTX_ASCII_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* All 7-bit ASCII codes */ - -#define ASCII_NUL 0x00 /* Null character (^@) */ -#define ASCII_SOH 0x01 /* Start of header (^A) */ -#define ASCII_STX 0x02 /* Start of tex (^B) */ -#define ASCII_ETX 0x03 /* End of text (^C) */ -#define ASCII_EOT 0x04 /* End of transmission (^D) */ -#define ASCII_ENQ 0x05 /* Enquiry (^E) */ -#define ASCII_ACK 0x06 /* Acknowledge (^F) */ -#define ASCII_BEL 0x07 /* Bell (^G) */ -#define ASCII_BS 0x08 /* Backspace (^H) */ -#define ASCII_TAB 0x09 /* Horizontal tab (^I) */ -#define ASCII_LF 0x0a /* Line Feed (^J) */ -#define ASCII_VT 0x0b /* Vertical tab(^K) */ -#define ASCII_FF 0x0c /* Form Feed (^L) */ -#define ASCII_CR 0x0d /* Carriage Return (^M) */ -#define ASCII_SO 0x0e /* Shift Out (^N) */ -#define ASCII_SI 0x0f /* Shift In (^O) */ - -#define ASCII_DLE 0x10 /* Data link escape (^P) */ -#define ASCII_DC1 0x11 /* XON (^Q) */ -#define ASCII_DC2 0x12 /* Device control 2, block-mode flow control (^R) */ -#define ASCII_DC3 0x13 /* XOFF (^S) */ -#define ASCII_DC4 0x14 /* Device control 4 (^T) */ -#define ASCII_NAK 0x15 /* Negative acknowledge (^U) */ -#define ASCII_SYN 0x16 /* Synchronous idle (^V) */ -#define ASCII_ETB 0x17 /* End transmission block(^W) */ -#define ASCII_CAN 0x18 /* Cancel line(^X) */ -#define ASCII_EM 0x19 /* End of medium(^Y) */ -#define ASCII_SUB 0x1a /* Substitute (^Z) */ -#define ASCII_ESC 0x1b /* Escape (^[) */ -#define ASCII_FS 0x1c /* File separator (^\) */ -#define ASCII_GS 0x1d /* Group separator (^]) */ -#define ASCII_RS 0x1e /* Record separator, block-mode terminator (^^) */ -#define ASCII_US 0x1f /* Unit separator (^_) */ - -#define ASCII_SPACE 0x20 /* Space ( ) */ -#define ASCII_EXCLAM 0x21 /* Exclamation mark (!) */ -#define ASCII_QUOTE 0x22 /* Quotation mark (") */ -#define ASCII_NUMBER 0x23 /* Number sign (#) */ -#define ASCII_HASH 0x23 /* Hash (#) */ -#define ASCII_DOLLAR 0x24 /* Dollar sign ($) */ -#define ASCII_PERCENT 0x25 /* Percent sign (%) */ -#define ASCII_AMPERSAND 0x26 /* Ampersand (&) */ -#define ASCII_RSQUOTE 0x27 /* Closing single quote (') */ -#define ASCII_APOSTROPHE 0x27 /* Apostrophe (') */ -#define ASCII_LPAREN 0x28 /* Opening parenthesis (() */ -#define ASCII_RPAREN 0x29 /* Closing parenthesis ()) */ -#define ASCII_ASTERISK 0x2a /* Asterisk (*) */ -#define ASCII_PLUS 0x2b /* Plus sign (+) */ -#define ASCII_COMMA 0x2c /* Comma (,) */ -#define ASCII_HYPHEN 0x2d /* Hyphen (-) */ -#define ASCII_DASH 0x2d /* Dash (-) */ -#define ASCII_MINUS 0x2d /* Minus sign (-) */ -#define ASCII_PERIOD 0x2e /* Period (.) */ -#define ASCII_SLASH 0x2f /* Forward Slash (/) */ -#define ASCII_DIVIDE 0x2f /* Divide (/) */ - -#define ASCII_0 0x30 /* Numbers */ -#define ASCII_1 0x31 /* " " */ -#define ASCII_2 0x32 /* " " */ -#define ASCII_3 0x33 /* " " */ -#define ASCII_4 0x34 /* " " */ -#define ASCII_5 0x35 /* " " */ -#define ASCII_6 0x36 /* " " */ -#define ASCII_7 0x37 /* " " */ -#define ASCII_8 0x38 /* " " */ -#define ASCII_9 0x39 /* " " */ -#define ASCII_COLON 0x3a /* Colon (:) */ -#define ASCII_SEMICOLON 0x3b /* Semicolon (;) */ -#define ASCII_LT 0x3c /* Less than (<) */ -#define ASCII_EQUAL 0x3d /* Equal (=) */ -#define ASCII_GT 0x3e /* Greater than (>) */ -#define ASCII_QUESTION 0x3f /* Question mark (?) */ - -#define ASCII_AT 0x40 /* At sign (@) */ -#define ASCII_A 0x41 /* Upper case letters */ -#define ASCII_B 0x42 /* " " " " " " */ -#define ASCII_C 0x43 /* " " " " " " */ -#define ASCII_D 0x44 /* " " " " " " */ -#define ASCII_E 0x45 /* " " " " " " */ -#define ASCII_F 0x46 /* " " " " " " */ -#define ASCII_G 0x47 /* " " " " " " */ -#define ASCII_H 0x48 /* " " " " " " */ -#define ASCII_I 0x49 /* " " " " " " */ -#define ASCII_J 0x4a /* " " " " " " */ -#define ASCII_K 0x4b /* " " " " " " */ -#define ASCII_L 0x4c /* " " " " " " */ -#define ASCII_M 0x4d /* " " " " " " */ -#define ASCII_N 0x4e /* " " " " " " */ -#define ASCII_O 0x4f /* " " " " " " */ - -#define ASCII_P 0x50 /* " " " " " " */ -#define ASCII_Q 0x51 /* " " " " " " */ -#define ASCII_R 0x52 /* " " " " " " */ -#define ASCII_S 0x53 /* " " " " " " */ -#define ASCII_T 0x54 /* " " " " " " */ -#define ASCII_U 0x55 /* " " " " " " */ -#define ASCII_V 0x56 /* " " " " " " */ -#define ASCII_W 0x57 /* " " " " " " */ -#define ASCII_X 0x58 /* " " " " " " */ -#define ASCII_Y 0x59 /* " " " " " " */ -#define ASCII_Z 0x5a /* " " " " " " */ -#define ASCII_LBRACKET 0x5b /* Left bracket ([) */ -#define ASCII_BACKSLASH 0x5c /* Back slash (\) */ -#define ASCII_RBRACKET 0x5d /* Right bracket (]) */ -#define ASCII_CARET 0x5c /* Caret (^) */ -#define ASCII_CIRCUMFLEX 0x5c /* Circumflex (^) */ -#define ASCII_UNDERSCORE 0x5f /* Underscore (_) */ - -#define ASCII_RSQUOT 0x60 /* Closing single quote */ -#define ASCII_a 0x61 /* Lower case letters */ -#define ASCII_b 0x62 /* " " " " " " */ -#define ASCII_c 0x63 /* " " " " " " */ -#define ASCII_d 0x64 /* " " " " " " */ -#define ASCII_e 0x65 /* " " " " " " */ -#define ASCII_f 0x66 /* " " " " " " */ -#define ASCII_g 0x67 /* " " " " " " */ -#define ASCII_h 0x68 /* " " " " " " */ -#define ASCII_i 0x69 /* " " " " " " */ -#define ASCII_j 0x6a /* " " " " " " */ -#define ASCII_k 0x6b /* " " " " " " */ -#define ASCII_l 0x6c /* " " " " " " */ -#define ASCII_m 0x6d /* " " " " " " */ -#define ASCII_n 0x6e /* " " " " " " */ -#define ASCII_o 0x6f /* " " " " " " */ - -#define ASCII_p 0x70 /* " " " " " " */ -#define ASCII_q 0x71 /* " " " " " " */ -#define ASCII_r 0x72 /* " " " " " " */ -#define ASCII_s 0x73 /* " " " " " " */ -#define ASCII_t 0x74 /* " " " " " " */ -#define ASCII_u 0x75 /* " " " " " " */ -#define ASCII_v 0x76 /* " " " " " " */ -#define ASCII_w 0x77 /* " " " " " " */ -#define ASCII_x 0x78 /* " " " " " " */ -#define ASCII_y 0x79 /* " " " " " " */ -#define ASCII_z 0x7a /* " " " " " " */ -#define ASCII_LBRACE 0x7b /* Left brace ({) */ -#define ASCII_VERTBAR 0x7c /* Vertical bar (|) */ -#define ASCII_PIPE 0x7c /* Pipe (|) */ -#define ASCII_RBRACE 0x7d /* Right brace (}) */ -#define ASCII_TILDE 0x7e /* Tilde (~) */ -#define ASCII_DEL 0x7f /* Delete (rubout) */ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#endif /* __INCLUDE_NUTTX_ASCII_H */ diff --git a/nuttx/include/nuttx/binfmt/binfmt.h b/nuttx/include/nuttx/binfmt/binfmt.h deleted file mode 100644 index 590d88402..000000000 --- a/nuttx/include/nuttx/binfmt/binfmt.h +++ /dev/null @@ -1,385 +0,0 @@ -/**************************************************************************** - * include/nuttx/binfmt/binfmt.h - * - * Copyright (C) 2009, 2012 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_NUTTX_BINFMT_BINFMT_H -#define __INCLUDE_NUTTX_BINFMT_BINFMT_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define BINFMT_NALLOC 3 - -/**************************************************************************** - * Public Types - ****************************************************************************/ -/* EXEPATH_HANDLE is an opaque handle used to traverse the absolute paths - * assigned to the PATH environment variable. - */ - -#if !defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_BINFMT_EXEPATH) -typedef FAR void *EXEPATH_HANDLE; -#endif - -/* The type of one C++ constructor or destructor */ - -typedef FAR void (*binfmt_ctor_t)(void); -typedef FAR void (*binfmt_dtor_t)(void); - -/* This describes the file to be loaded. - * - * NOTE 1: The 'filename' must be the full, absolute path to the file to be - * executed unless CONFIG_BINFMT_EXEPATH is defined. In that case, - * 'filename' may be a relative path; a set of candidate absolute paths - * will be generated using the PATH environment variable and load_module() - * will attempt to load each file that is found at those absolute paths. - */ - -struct symtab_s; -struct binary_s -{ - /* If CONFIG_SCHED_HAVE_PARENT is defined then schedul_unload() will - * manage instances of struct binary_s allocated with kmalloc. It - * will keep the binary data in a link list and when SIGCHLD is received - * (meaning that the task has exit'ed, schedul_unload() will find the - * data, unload the module, and free the structure. - */ - -#ifdef CONFIG_SCHED_HAVE_PARENT - FAR struct binary_s *flink; /* Supports a singly linked list */ - pid_t pid; /* Task ID of the child task */ -#endif - - /* Information provided to the loader to load and bind a module */ - - FAR const char *filename; /* Full path to the binary to be loaded (See NOTE 1 above) */ - FAR const char **argv; /* Argument list */ - FAR const struct symtab_s *exports; /* Table of exported symbols */ - int nexports; /* The number of symbols in exports[] */ - - /* Information provided from the loader (if successful) describing the - * resources used by the loaded module. - */ - - main_t entrypt; /* Entry point into a program module */ - FAR void *mapped; /* Memory-mapped, address space */ - FAR void *alloc[BINFMT_NALLOC]; /* Allocated address spaces */ - - /* Constructors/destructors */ - -#ifdef CONFIG_BINFMT_CONSTRUCTORS - FAR binfmt_ctor_t *ctors; /* Pointer to a list of constructors */ - FAR binfmt_dtor_t *dtors; /* Pointer to a list of destructors */ - uint16_t nctors; /* Number of constructors in the list */ - uint16_t ndtors; /* Number of destructors in the list */ -#endif - - /* Address environment. - * - * addrenv - This is the handle created by up_addrenv_create() that can be - * used to manage the tasks address space. - */ - -#ifdef CONFIG_ADDRENV - task_addrenv_t addrenv; /* Task address environment */ -#endif - - size_t mapsize; /* Size of the mapped address region (needed for munmap) */ - - /* Start-up information that is provided by the loader, but may be modified - * by the caller between load_module() and exec_module() calls. - */ - - uint8_t priority; /* Task execution priority */ - size_t stacksize; /* Size of the stack in bytes (unallocated) */ -}; - -/* This describes one binary format handler */ - -struct binfmt_s -{ - FAR struct binfmt_s *next; /* Supports a singly-linked list */ - int (*load)(FAR struct binary_s *bin); /* Verify and load binary into memory */ -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Name: register_binfmt - * - * Description: - * Register a loader for a binary format - * - * Returned Value: - * This is a NuttX internal function so it follows the convention that - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -int register_binfmt(FAR struct binfmt_s *binfmt); - -/**************************************************************************** - * Name: unregister_binfmt - * - * Description: - * Register a loader for a binary format - * - * Returned Value: - * This is a NuttX internal function so it follows the convention that - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -int unregister_binfmt(FAR struct binfmt_s *binfmt); - -/**************************************************************************** - * Name: load_module - * - * Description: - * Load a module into memory, bind it to an exported symbol take, and - * prep the module for execution. - * - * Returned Value: - * This is an end-user function, so it follows the normal convention: - * Returns 0 (OK) on success. On failure, it returns -1 (ERROR) with - * errno set appropriately. - * - ****************************************************************************/ - -int load_module(FAR struct binary_s *bin); - -/**************************************************************************** - * Name: unload_module - * - * Description: - * Unload a (non-executing) module from memory. If the module has - * been started (via exec_module) and has not exited, calling this will - * be fatal. - * - * However, this function must be called after the module exist. How - * this is done is up to your logic. Perhaps you register it to be - * called by on_exit()? - * - * Returned Value: - * This is a NuttX internal function so it follows the convention that - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -int unload_module(FAR const struct binary_s *bin); - -/**************************************************************************** - * Name: exec_module - * - * Description: - * Execute a module that has been loaded into memory by load_module(). - * - * 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. - * - ****************************************************************************/ - -int exec_module(FAR const struct binary_s *bin); - -/**************************************************************************** - * Name: schedule_unload - * - * Description: - * If CONFIG_SCHED_HAVE_PARENT is defined, this function may be called by - * the parent of the the newly created task to automatically unload the - * module when the task exits. This assumes that (1) the caller is the - * parent of the created task, (2) that bin was allocated with kmalloc() - * or friends. It will also automatically free the structure with kfree() - * after unloading the module. - * - * Input Parameter: - * pid - The task ID of the child task - * bin - This structure must have been allocated with kmalloc() and must - * persist until the task unloads - * - * Returned Value: - * This is an end-user function, so it follows the normal convention: - * It returns 0 (OK) if the callback was successfully scheduled. On - * failure, it returns -1 (ERROR) and sets errno appropriately. - * - ****************************************************************************/ - -#ifdef CONFIG_SCHED_HAVE_PARENT -int schedule_unload(pid_t pid, FAR struct binary_s *bin); -#endif - -/**************************************************************************** - * Name: exec - * - * Description: - * This is a convenience function that wraps load_ and exec_module into - * one call. If CONFIG_SCHED_ONEXIT is also defined, this function will - * automatically call schedule_unload() to unload the module when task - * exits. - * - * Input Parameter: - * filename - Fulll path to the binary to be loaded - * argv - Argument list - * exports - Table of exported symbols - * nexports - The number of symbols in exports - * - * Returned Value: - * This is an end-user function, so it follows the normal convention: - * It returns the PID of the exec'ed module. On failure, it returns - * -1 (ERROR) and sets errno appropriately. - * - ****************************************************************************/ - -int exec(FAR const char *filename, FAR const char **argv, - FAR const struct symtab_s *exports, int nexports); - -/**************************************************************************** - * Name: exepath_init - * - * Description: - * Initialize for the traversal of each value in the PATH variable. The - * usage is sequence is as follows: - * - * 1) Call exepath_init() to initialize for the traversal. exepath_init() - * will return an opaque handle that can then be provided to - * exepath_next() and exepath_release(). - * 2) Call exepath_next() repeatedly to examine every file that lies - * in the directories of the PATH variable - * 3) Call exepath_release() to free resources set aside by exepath_init(). - * - * Input Parameters: - * None - * - * Returned Value: - * On success, exepath_init() return a non-NULL, opaque handle that may - * subsequently be used in calls to exepath_next() and exepath_release(). - * On error, a NULL handle value will be returned. The most likely cause - * of an error would be that the there is no value associated with the - * PATH variable. - * - ****************************************************************************/ - -#if !defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_BINFMT_EXEPATH) -EXEPATH_HANDLE exepath_init(void); -#endif - -/**************************************************************************** - * Name: exepath_next - * - * Description: - * Traverse all possible values in the PATH variable in attempt to find - * the full path to an executable file when only a relative path is - * provided. - * - * Input Parameters: - * handle - The handle value returned by exepath_init - * relpath - The relative path to the file to be found. - * - * Returned Value: - * On success, a non-NULL pointer to a null-terminated string is provided. - * This is the full path to a file that exists in the file system. This - * function will verify that the file exists (but will not verify that it - * is marked executable). - * - * NOTE: The string pointer return in the success case points to allocated - * memory. This memory must be freed by the called by calling kfree(). - * - * NULL is returned if no path is found to any file with the provided - * 'relpath' from any absolute path in the PATH variable. In this case, - * there is no point in calling exepath_next() further; exepath_release() - * must be called to release resources set aside by expath_init(). - * - ****************************************************************************/ - -#if !defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_BINFMT_EXEPATH) -FAR char *exepath_next(EXEPATH_HANDLE handle, FAR const char *relpath); -#endif - -/**************************************************************************** - * Name: exepath_release - * - * Description: - * Release all resources set aside by exepath_init() when the handle value - * was created. The handle value is invalid on return from this function. - * Attempts to all exepath_next() or exepath_release() with such a 'stale' - * handle will result in undefined (i.e., not good) behavior. - * - * Input Parameters: - * handle - The handle value returned by exepath_init - * - * Returned Value: - * None - * - ****************************************************************************/ - -#if !defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_BINFMT_EXEPATH) -void exepath_release(EXEPATH_HANDLE handle); -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_BINFMT_BINFMT_H */ - diff --git a/nuttx/include/nuttx/binfmt/builtin.h b/nuttx/include/nuttx/binfmt/builtin.h deleted file mode 100644 index 6ff565395..000000000 --- a/nuttx/include/nuttx/binfmt/builtin.h +++ /dev/null @@ -1,178 +0,0 @@ -/**************************************************************************** - * include/nuttx/binfmt/builtin.h - * - * Originally by: - * - * Copyright (C) 2011 Uros Platise. All rights reserved. - * Author: Uros Platise - * - * With subsequent updates, modifications, and general maintenance by: - * - * Copyright (C) 2012-2013 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_NUTTX_BINFMT_BUILTIN_H -#define __INCLUDE_NUTTX_BINFMT_BUILTIN_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -struct builtin_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 - ****************************************************************************/ - -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: builtin_initialize - * - * Description: - * Builtin support is built unconditionally. However, it order to - * use this binary format, this function must be called during system - * format in order to register the builtin binary format. - * - * Returned Value: - * This is a NuttX internal function so it follows the convention that - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -int builtin_initialize(void); - -/**************************************************************************** - * Name: builtin_uninitialize - * - * Description: - * Unregister the builtin binary loader - * - * Returned Value: - * None - * - ****************************************************************************/ - -void builtin_uninitialize(void); - -/**************************************************************************** - * Utility Functions Provided to Applications by binfmt/libbuiltin - ****************************************************************************/ -/**************************************************************************** - * Name: builtin_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. - * - ****************************************************************************/ - -int builtin_isavail(FAR const char *appname); - -/**************************************************************************** - * Name: builtin_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. - * - ****************************************************************************/ - -FAR const char *builtin_getname(int index); - -/**************************************************************************** - * Data Set Access Functions Provided to Applications by binfmt/libbuiltin - ****************************************************************************/ -/**************************************************************************** - * Name: builtin_for_index - * - * Description: - * Returns the builtin_s structure for the selected builtin. - * If support for builtin functions is enabled in the NuttX configuration, - * then this function must be provided by the application code. - * - * Input Parameter: - * index, from 0 and on... - * - * Returned Value: - * Returns valid pointer pointing to the builtin_s structure if index is - * valid. - * Otherwise, NULL is returned. - * - ****************************************************************************/ - -EXTERN FAR const struct builtin_s *builtin_for_index(int index); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_BINFMT_BUILTIN_H */ - diff --git a/nuttx/include/nuttx/binfmt/elf.h b/nuttx/include/nuttx/binfmt/elf.h deleted file mode 100644 index 6b6851934..000000000 --- a/nuttx/include/nuttx/binfmt/elf.h +++ /dev/null @@ -1,340 +0,0 @@ -/**************************************************************************** - * include/nuttx/binfmt/elf.h - * - * Copyright (C) 2012 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_NUTTX_BINFMT_ELF_H -#define __INCLUDE_NUTTX_BINFMT_ELF_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include - -#include -#include -#include - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ - -#ifndef CONFIG_ELF_ALIGN_LOG2 -# define CONFIG_ELF_ALIGN_LOG2 2 -#endif - -#ifndef CONFIG_ELF_STACKSIZE -# define CONFIG_ELF_STACKSIZE 2048 -#endif - -#ifndef CONFIG_ELF_BUFFERSIZE -# define CONFIG_ELF_BUFFERSIZE 128 -#endif - -#ifndef CONFIG_ELF_BUFFERINCR -# define CONFIG_ELF_BUFFERINCR 32 -#endif - -/* Allocation array size and indices */ - -#define LIBELF_ELF_ALLOC 0 -#ifdef CONFIG_BINFMT_CONSTRUCTORS -# define LIBELF_CTORS_ALLOC 1 -# define LIBELF_CTPRS_ALLOC 2 -# define LIBELF_NALLOC 3 -#else -# define LIBELF_NALLOC 1 -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* This struct provides a desciption of the currently loaded instantiation - * of an ELF binary. - */ - -struct elf_loadinfo_s -{ - /* elfalloc is the base address of the memory that is allocated to hold the - * ELF program image. - * - * If CONFIG_ADDRENV=n, elfalloc will be allocated using kmalloc() (or - * kzalloc()). If CONFIG_ADDRENV-y, then elfalloc will be allocated using - * up_addrenv_create(). In either case, there will be a unique instance - * of elfalloc (and stack) for each instance of a process. - * - * The alloc[] array in struct binary_s will hold memory that persists after - * the ELF module has been loaded. - */ - - uintptr_t elfalloc; /* Memory allocated when ELF file was loaded */ - size_t elfsize; /* Size of the ELF memory allocation */ - off_t filelen; /* Length of the entire ELF file */ - Elf32_Ehdr ehdr; /* Buffered ELF file header */ - FAR Elf32_Shdr *shdr; /* Buffered ELF section headers */ - uint8_t *iobuffer; /* File I/O buffer */ - - /* Constructors and destructors */ - -#ifdef CONFIG_BINFMT_CONSTRUCTORS - FAR void *ctoralloc; /* Memory allocated for ctors */ - FAR void *dtoralloc; /* Memory allocated dtors */ - FAR binfmt_ctor_t *ctors; /* Pointer to a list of constructors */ - FAR binfmt_dtor_t *dtors; /* Pointer to a list of destructors */ - uint16_t nctors; /* Number of constructors */ - uint16_t ndtors; /* Number of destructors */ -#endif - - /* Address environment. - * - * addrenv - This is the handle created by up_addrenv_create() that can be - * used to manage the tasks address space. - * oldenv - This is a value returned by up_addrenv_select() that must be - * used to restore the current hardware address environment. - */ - -#ifdef CONFIG_ADDRENV - task_addrenv_t addrenv; /* Task address environment */ - hw_addrenv_t oldenv; /* Saved hardware address environment */ -#endif - - uint16_t symtabidx; /* Symbol table section index */ - uint16_t strtabidx; /* String table section index */ - uint16_t buflen; /* size of iobuffer[] */ - int filfd; /* Descriptor for the file being loaded */ -}; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * These are APIs exported by libelf (but are used only by the binfmt logic): - ****************************************************************************/ - -/**************************************************************************** - * Name: elf_init - * - * Description: - * This function is called to configure the library to process an ELF - * program binary. - * - * Returned Value: - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -EXTERN int elf_init(FAR const char *filename, - FAR struct elf_loadinfo_s *loadinfo); - -/**************************************************************************** - * Name: elf_uninit - * - * Description: - * Releases any resources committed by elf_init(). This essentially - * undoes the actions of elf_init. - * - * Returned Value: - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -EXTERN int elf_uninit(FAR struct elf_loadinfo_s *loadinfo); - -/**************************************************************************** - * Name: elf_load - * - * Description: - * Loads the binary into memory, allocating memory, performing relocations - * and inializing the data and bss segments. - * - * Returned Value: - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -EXTERN int elf_load(FAR struct elf_loadinfo_s *loadinfo); - -/**************************************************************************** - * Name: elf_bind - * - * Description: - * Bind the imported symbol names in the loaded module described by - * 'loadinfo' using the exported symbol values provided by 'symtab'. - * - * Returned Value: - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -struct symtab_s; -EXTERN int elf_bind(FAR struct elf_loadinfo_s *loadinfo, - FAR const struct symtab_s *exports, int nexports); - -/**************************************************************************** - * Name: elf_unload - * - * Description: - * This function unloads the object from memory. This essentially undoes - * the actions of elf_load. It is called only under certain error - * conditions after the the module has been loaded but not yet started. - * - * Returned Value: - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -EXTERN int elf_unload(struct elf_loadinfo_s *loadinfo); - -/**************************************************************************** - * These are APIs used outside of binfmt by NuttX: - ****************************************************************************/ -/**************************************************************************** - * Name: elf_initialize - * - * Description: - * ELF support is built unconditionally. However, it order to - * use this binary format, this function must be called during system - * format in order to register the ELF binary format. - * - * Returned Value: - * This is a NuttX internal function so it follows the convention that - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -EXTERN int elf_initialize(void); - -/**************************************************************************** - * Name: elf_uninitialize - * - * Description: - * Unregister the ELF binary loader - * - * Returned Value: - * None - * - ****************************************************************************/ - -EXTERN void elf_uninitialize(void); - -/**************************************************************************** - * These are APIs must be provided by architecture-specific logic: - ****************************************************************************/ -/**************************************************************************** - * Name: arch_checkarch - * - * Description: - * Given the ELF header in 'hdr', verify that the ELF file is appropriate - * for the current, configured architecture. Every architecture that uses - * the ELF loader must provide this function. - * - * Input Parameters: - * hdr - The ELF header read from the ELF file. - * - * Returned Value: - * True if the architecture supports this ELF file. - * - ****************************************************************************/ - -EXTERN bool arch_checkarch(FAR const Elf32_Ehdr *hdr); - -/**************************************************************************** - * Name: arch_relocate and arch_relocateadd - * - * Description: - * Perform on architecture-specific ELF relocation. Every architecture - * that uses the ELF loader must provide this function. - * - * Input Parameters: - * rel - The relocation type - * sym - The ELF symbol structure containing the fully resolved value. - * addr - The address that requires the relocation. - * - * Returned Value: - * Zero (OK) if the relocation was successful. Otherwise, a negated errno - * value indicating the cause of the relocation failure. - * - ****************************************************************************/ - -EXTERN int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, - uintptr_t addr); -EXTERN int arch_relocateadd(FAR const Elf32_Rela *rel, - FAR const Elf32_Sym *sym, uintptr_t addr); - -/**************************************************************************** - * Name: arch_flushicache - * - * Description: - * Flush the instruction cache. - * - * Input Parameters: - * addr - Start address to flush - * len - Number of bytes to flush - * - * Returned Value: - * True if the architecture supports this ELF file. - * - ****************************************************************************/ - -#ifdef CONFIG_ELF_ICACHE -EXTERN bool arch_flushicache(FAR void *addr, size_t len); -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_BINFMT_ELF_H */ diff --git a/nuttx/include/nuttx/binfmt/nxflat.h b/nuttx/include/nuttx/binfmt/nxflat.h deleted file mode 100644 index db396771b..000000000 --- a/nuttx/include/nuttx/binfmt/nxflat.h +++ /dev/null @@ -1,287 +0,0 @@ -/**************************************************************************** - * include/nuttx/binfmt/nxflat.h - * - * Copyright (C) 2009, 2012 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_NUTTX_BINFMT_NXFLAT_H -#define __INCLUDE_NUTTX_BINFMT_NXFLAT_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* This struct provides a desciption of the currently loaded instantiation - * of an nxflat binary. - */ - -struct nxflat_loadinfo_s -{ - /* Instruction Space (ISpace): This region contains the nxflat file header - * plus everything from the text section. - * - * The ISpace region is allocated using mmap() and, thus, can be shared by - * multiple tasks. Ideally, will have only one mmap'ed text section - * instance in the system for each module. - */ - - uintptr_t ispace; /* Address where hdr/text is loaded */ - uint32_t entryoffs; /* Offset from ispace to entry point */ - uint32_t isize; /* Size of ispace. */ - - /* Data Space (DSpace): This region contains all information that is - * referenced as data (other than the stack which is separately allocated). - * - * If CONFIG_ADDRENV=n, DSpace will be allocated using kmalloc() (or - * kzalloc()). If CONFIG_ADDRENV-y, then DSpace will be allocated using - * up_addrenv_create(). In either case, there will be a unique instance - * of DSpace (and stack) for each instance of a process. - */ - - struct dspace_s *dspace; /* Allocated D-Space (data/bss/etc) */ - uint32_t datasize; /* Size of data segment in dspace */ - uint32_t bsssize; /* Size of bss segment in dspace */ - uint32_t stacksize; /* Size of stack (not allocated) */ - uint32_t dsize; /* Size of dspace (may be large than parts) */ - - /* This is temporary memory where relocation records will be loaded. */ - - uint32_t relocstart; /* Start of array of struct flat_reloc */ - uint16_t reloccount; /* Number of elements in reloc array */ - - /* Address environment. - * - * addrenv - This is the handle created by up_addrenv_create() that can be - * used to manage the tasks address space. - * oldenv - This is a value returned by up_addrenv_select() that must be - * used to restore the current hardware address environment. - */ - -#ifdef CONFIG_ADDRENV - task_addrenv_t addrenv; /* Task address environment */ - hw_addrenv_t oldenv; /* Saved hardware address environment */ -#endif - - /* File descriptors */ - - int filfd; /* Descriptor for the file being loaded */ - - /* This is a copy of the NXFLAT header (still in network order) */ - - struct nxflat_hdr_s header; -}; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * These are APIs exported by libnxflat (and may be used outside of NuttX): - ****************************************************************************/ - -/**************************************************************************** - * Name: nxflat_verifyheader - * - * Description: - * Given the header from a possible NXFLAT executable, verify that it is - * an NXFLAT executable. - * - * Returned Value: - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -EXTERN int nxflat_verifyheader(const struct nxflat_hdr_s *header); - -/**************************************************************************** - * Name: nxflat_init - * - * Description: - * This function is called to configure the library to process an NXFLAT - * program binary. - * - * Returned Value: - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -EXTERN int nxflat_init(const char *filename, - struct nxflat_loadinfo_s *loadinfo); - -/**************************************************************************** - * Name: nxflat_uninit - * - * Description: - * Releases any resources committed by nxflat_init(). This essentially - * undoes the actions of nxflat_init. - * - * Returned Value: - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -EXTERN int nxflat_uninit(struct nxflat_loadinfo_s *loadinfo); - -/**************************************************************************** - * Name: nxflat_load - * - * Description: - * Loads the binary specified by nxflat_init into memory, mapping - * the I-space executable regions, allocating the D-Space region, - * and inializing the data segment (relocation information is - * temporarily loaded into the BSS region. BSS will be cleared - * by nxflat_bind() after the relocation data has been processed). - * - * Returned Value: - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -EXTERN int nxflat_load(struct nxflat_loadinfo_s *loadinfo); - -/**************************************************************************** - * Name: nxflat_read - * - * Description: - * Read 'readsize' bytes from the object file at 'offset' - * - * Returned Value: - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -EXTERN int nxflat_read(struct nxflat_loadinfo_s *loadinfo, char *buffer, - int readsize, int offset); - -/**************************************************************************** - * Name: nxflat_bind - * - * Description: - * Bind the imported symbol names in the loaded module described by - * 'loadinfo' using the exported symbol values provided by 'symtab' - * After binding the module, clear the BSS region (which held the relocation - * data) in preparation for execution. - * - * Returned Value: - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -struct symtab_s; -EXTERN int nxflat_bind(FAR struct nxflat_loadinfo_s *loadinfo, - FAR const struct symtab_s *exports, int nexports); - -/**************************************************************************** - * Name: nxflat_unload - * - * Description: - * This function unloads the object from memory. This essentially undoes - * the actions of nxflat_load. It is called only under certain error - * conditions after the the module has been loaded but not yet started. - * - * Returned Value: - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -EXTERN int nxflat_unload(struct nxflat_loadinfo_s *loadinfo); - -/**************************************************************************** - * These are APIs used internally only by NuttX: - ****************************************************************************/ -/**************************************************************************** - * Name: nxflat_initialize - * - * Description: - * NXFLAT support is built unconditionally. However, it order to - * use this binary format, this function must be called during system - * format in order to register the NXFLAT binary format. - * - * Returned Value: - * This is a NuttX internal function so it follows the convention that - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - ****************************************************************************/ - -EXTERN int nxflat_initialize(void); - -/**************************************************************************** - * Name: nxflat_uninitialize - * - * Description: - * Unregister the NXFLAT binary loader - * - * Returned Value: - * None - * - ****************************************************************************/ - -EXTERN void nxflat_uninitialize(void); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_BINFMT_NXFLAT_H */ diff --git a/nuttx/include/nuttx/binfmt/symtab.h b/nuttx/include/nuttx/binfmt/symtab.h deleted file mode 100644 index 346c6099f..000000000 --- a/nuttx/include/nuttx/binfmt/symtab.h +++ /dev/null @@ -1,163 +0,0 @@ -/**************************************************************************** - * include/nuttx/binfmt/symtab.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 __INCLUDE_NUTTX_BINFMT_SYMTAB_H -#define __INCLUDE_NUTTX_BINFMT_SYMTAB_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* struct symbtab_s describes one entry in the symbol table. A symbol table - * is a fixed size array of struct symtab_s. The information is intentionally - * minimal and supports only: - * - * 1. Function pointers as sym_values. Of other kinds of values need to be - * supported, then typing information would also need to be included in - * the structure. - * - * 2. Fixed size arrays. There is no explicit provisional for dyanamically - * adding or removing entries from the symbol table (realloc might be - * used for that purpose if needed). The intention is to support only - * fixed size arrays completely defined at compilation or link time. - */ - -struct symtab_s -{ - FAR const char *sym_name; /* A pointer to the symbol name string */ - FAR const void *sym_value; /* The value associated witht the string */ -}; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: symtab_findbyname - * - * Description: - * Find the symbol in the symbol table with the matching name. - * This version assumes that table is not ordered with respect to symbol - * name and, hence, access time will be linear with respect to nsyms. - * - * Returned Value: - * A reference to the symbol table entry if an entry with the matching - * name is found; NULL is returned if the entry is not found. - * - ****************************************************************************/ - -EXTERN FAR const struct symtab_s * -symtab_findbyname(FAR const struct symtab_s *symtab, - FAR const char *name, int nsyms); - -/**************************************************************************** - * Name: symtab_findorderedbyname - * - * Description: - * Find the symbol in the symbol table with the matching name. - * This version assumes that table ordered with respect to symbol name. - * - * Returned Value: - * A reference to the symbol table entry if an entry with the matching - * name is found; NULL is returned if the entry is not found. - * - ****************************************************************************/ - -EXTERN FAR const struct symtab_s * -symtab_findorderedbyname(FAR const struct symtab_s *symtab, - FAR const char *name, int nsyms); - -/**************************************************************************** - * Name: symtab_findbyvalue - * - * Description: - * Find the symbol in the symbol table whose value closest (but not greater - * than), the provided value. This version assumes that table is not ordered - * with respect to symbol name and, hence, access time will be linear with - * respect to nsyms. - * - * Returned Value: - * A reference to the symbol table entry if an entry with the matching - * name is found; NULL is returned if the entry is not found. - * - ****************************************************************************/ - -EXTERN FAR const struct symtab_s * -symtab_findbyvalue(FAR const struct symtab_s *symtab, - FAR void *value, int nsyms); - -/**************************************************************************** - * Name: symtab_findorderedbyvalue - * - * Description: - * Find the symbol in the symbol table whose value closest (but not greater - * than), the provided value. This version assumes that table is ordered - * with respect to symbol name. - * - * Returned Value: - * A reference to the symbol table entry if an entry with the matching - * name is found; NULL is returned if the entry is not found. - * - ****************************************************************************/ - -EXTERN FAR const struct symtab_s * -symtab_findorderedbyvalue(FAR const struct symtab_s *symtab, - FAR void *value, int nsyms); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_BINFMT_SYMTAB_H */ - diff --git a/nuttx/include/nuttx/can.h b/nuttx/include/nuttx/can.h deleted file mode 100644 index 31d34478e..000000000 --- a/nuttx/include/nuttx/can.h +++ /dev/null @@ -1,374 +0,0 @@ -/************************************************************************************ - * include/nuttx/can.h - * - * Copyright (C) 2008, 2009, 2011-2012 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_NUTTX_CAN_H -#define _INCLUDE_NUTTX_CAN_H - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include -#include - -#include -#include -#include -#include - -#include - -#ifdef CONFIG_CAN - -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ -/* Configuration ********************************************************************/ -/* CONFIG_CAN - Enables CAN support (one or both of CONFIG_STM32_CAN1 or - * CONFIG_STM32_CAN2 must also be defined) - * CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default - * Standard 11-bit IDs. - * CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages. - * Default: 8 - * CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests. - * Default: 4 - * CONFIG_CAN_LOOPBACK - A CAN driver may or may not support a loopback - * mode for testing. If the driver does support loopback mode, the setting - * will enable it. (If the driver does not, this setting will have no effect). - */ - -/* Default configuration settings that may be overridden in the NuttX configuration - * file or in the board configuration file. The configured size is limited to 255 - * to fit into a uint8_t. - */ - -#if !defined(CONFIG_CAN_FIFOSIZE) -# define CONFIG_CAN_FIFOSIZE 8 -#elif CONFIG_CAN_FIFOSIZE > 255 -# undef CONFIG_CAN_FIFOSIZE -# define CONFIG_CAN_FIFOSIZE 255 -#endif - -#if !defined(CONFIG_CAN_NPENDINGRTR) -# define CONFIG_CAN_NPENDINGRTR 4 -#elif CONFIG_CAN_NPENDINGRTR > 255 -# undef CONFIG_CAN_NPENDINGRTR -# define CONFIG_CAN_NPENDINGRTR 255 -#endif - -/* Convenience macros */ - -#define dev_reset(dev) dev->cd_ops->co_reset(dev) -#define dev_setup(dev) dev->cd_ops->co_setup(dev) -#define dev_shutdown(dev) dev->cd_ops->co_shutdown(dev) -#define dev_txint(dev,enable) dev->cd_ops->co_txint(dev,enable) -#define dev_rxint(dev,enable) dev->cd_ops->co_rxint(dev,enable) -#define dev_ioctl(dev,cmd,arg) dev->cd_ops->co_ioctl(dev,cmd,arg) -#define dev_remoterequest(dev,id) dev->cd_ops->co_remoterequest(dev,id) -#define dev_send(dev,m) dev->cd_ops->co_send(dev,m) -#define dev_txready(dev) dev->cd_ops->co_txready(dev) -#define dev_txempty(dev) dev->cd_ops->co_txempty(dev) - -/* CAN message support */ - -#define CAN_MAXDATALEN 8 -#define CAN_MAX_MSGID 0x07ff -#define CAN_MAX_EXTMSGID 0x1fffffff - -#define CAN_MSGLEN(nbytes) (sizeof(struct can_msg_s) - CAN_MAXDATALEN + (nbytes)) - -/* Built-in ioctl commands - * - * CANIOCTL_RTR: Send the remote transmission request and wait for the response. - */ - -#define CANIOCTL_RTR 1 /* Argument is a reference to struct canioctl_rtr_s */ - -/* CANIOCTL_USER: Device specific ioctl calls can be supported with cmds greater - * than this value - */ - -#define CANIOCTL_USER 2 - -/************************************************************************************ - * Public Types - ************************************************************************************/ -/* CAN-message Format (without Extended ID suppport) - * - * One based CAN-message is represented with a maximum of 10 bytes. A message is - * composed of at least the first 2 bytes (when there are no data bytes present). - * - * Bytes 0-1: Hold a 16-bit value in host byte order - * Bits 0-3: Data Length Code (DLC) - * Bit 4: Remote Tranmission Request (RTR) - * Bits 5-15: The 11-bit CAN identifier - * - * Bytes 2-9: CAN data - * - * CAN-message Format (with Extended ID suppport) - * - * One CAN-message consists of a maximum of 13 bytes. A message is composed of at - * least the first 5 bytes (when there are no data bytes). - * - * Bytes 0-3: Hold 11- or 29-bit CAN ID in host byte order - * Byte 4: Bits 0-3: Data Length Code (DLC) - * Bit 4: Remote Tranmission Request (RTR) - * Bit 5: Extended ID indication - * Bits 6-7: Unused - * Bytes 5-12: CAN data - * - * The struct can_msg_s holds this information in a user-friendly, unpacked form. - * This is the form that is used at the read() and write() driver interfaces. The - * message structure is actually variable length -- the true length is given by - * the CAN_MSGLEN macro. - */ - -#ifdef CONFIG_CAN_EXTID -struct can_hdr_s -{ - uint32_t ch_id; /* 11- or 29-bit ID (3-bits unsed) */ - uint8_t ch_dlc : 4; /* 4-bit DLC */ - uint8_t ch_rtr : 1; /* RTR indication */ - uint8_t ch_extid : 1; /* Extended ID indication */ - uint8_t ch_unused : 2; /* Unused */ -} packed_struct; -#else -struct can_hdr_s -{ - uint16_t ch_dlc : 4; /* 4-bit DLC */ - uint16_t ch_rtr : 1; /* RTR indication */ - uint16_t ch_id : 11; /* 11-bit standard ID */ -} packed_struct; -#endif - -struct can_msg_s -{ - struct can_hdr_s cm_hdr; /* The CAN header */ - uint8_t cm_data[CAN_MAXDATALEN]; /* CAN message data (0-8 byte) */ -} packed_struct; - -/* This structure defines a CAN message FIFO. */ - -struct can_rxfifo_s -{ - sem_t rx_sem; /* Counting semaphore */ - uint8_t rx_head; /* Index to the head [IN] in the circular buffer */ - uint8_t rx_tail; /* Index to the tail [OUT] in the circular buffer */ - /* Circular buffer of CAN messages */ - struct can_msg_s rx_buffer[CONFIG_CAN_FIFOSIZE]; -}; - -struct can_txfifo_s -{ - sem_t tx_sem; /* Counting semaphore */ - uint8_t tx_head; /* Index to the head [IN] in the circular buffer */ - uint8_t tx_queue; /* Index to next message to send */ - uint8_t tx_tail; /* Index to the tail [OUT] in the circular buffer */ - /* Circular buffer of CAN messages */ - struct can_msg_s tx_buffer[CONFIG_CAN_FIFOSIZE]; -}; - -/* The following structure define the logic to handle one RTR message transaction */ - -struct can_rtrwait_s -{ - sem_t cr_sem; /* Wait for RTR response */ - uint16_t cr_id; /* The ID that is waited for */ - FAR struct can_msg_s *cr_msg; /* This is where the RTR reponse goes */ -}; - -/* This structure defines all of the operations providd by the architecture specific - * logic. All fields must be provided with non-NULL function pointers by the - * caller of can_register(). - */ - -struct can_dev_s; -struct can_ops_s -{ - /* Reset the CAN device. Called early to initialize the hardware. This - * is called, before co_setup() and on error conditions. - */ - - CODE void (*co_reset)(FAR struct can_dev_s *dev); - - /* Configure the CAN. This method is called the first time that the CAN - * device is opened. This will occur when the port is first opened. - * This setup includes configuring and attaching CAN interrupts. All CAN - * interrupts are disabled upon return. - */ - - CODE int (*co_setup)(FAR struct can_dev_s *dev); - - /* Disable the CAN. This method is called when the CAN device is closed. - * This method reverses the operation the setup method. - */ - - CODE void (*co_shutdown)(FAR struct can_dev_s *dev); - - /* Call to enable or disable RX interrupts */ - - CODE void (*co_rxint)(FAR struct can_dev_s *dev, bool enable); - - /* Call to enable or disable TX interrupts */ - - CODE void (*co_txint)(FAR struct can_dev_s *dev, bool enable); - - /* All ioctl calls will be routed through this method */ - - CODE int (*co_ioctl)(FAR struct can_dev_s *dev, int cmd, unsigned long arg); - - /* Send a remote request */ - - CODE int (*co_remoterequest)(FAR struct can_dev_s *dev, uint16_t id); - - /* This method will send one message on the CAN */ - - CODE int (*co_send)(FAR struct can_dev_s *dev, FAR struct can_msg_s *msg); - - /* Return true if the CAN hardware can accept another TX message. */ - - CODE bool (*co_txready)(FAR struct can_dev_s *dev); - - /* Return true if all message have been sent. If for example, the CAN - * hardware implements FIFOs, then this would mean the transmit FIFO is - * empty. This method is called when the driver needs to make sure that - * all characters are "drained" from the TX hardware before calling co_shutdown(). - */ - - CODE bool (*co_txempty)(FAR struct can_dev_s *dev); -}; - -/* This is the device structure used by the driver. The caller of - * can_register() must allocate and initialize this structure. The - * calling logic need only set all fields to zero except: - * - * The elements of 'cd_ops', and 'cd_priv' - * - * The common logic will initialize all semaphores. - */ - -struct can_dev_s -{ - uint8_t cd_ocount; /* The number of times the device has been opened */ - uint8_t cd_npendrtr; /* Number of pending RTR messages */ - uint8_t cd_ntxwaiters; /* Number of threads waiting to enqueue a message */ - sem_t cd_closesem; /* Locks out new opens while close is in progress */ - sem_t cd_recvsem; /* Used to wakeup user waiting for space in cd_recv.buffer */ - struct can_txfifo_s cd_xmit; /* Describes transmit FIFO */ - struct can_rxfifo_s cd_recv; /* Describes receive FIFO */ - /* List of pending RTR requests */ - struct can_rtrwait_s cd_rtr[CONFIG_CAN_NPENDINGRTR]; - FAR const struct can_ops_s *cd_ops; /* Arch-specific operations */ - FAR void *cd_priv; /* Used by the arch-specific logic */ -}; - -/* Structures used with ioctl calls */ - -struct canioctl_rtr_s -{ - uint16_t ci_id; /* The 11-bit ID to use in the RTR message */ - FAR struct can_msg_s *ci_msg; /* The location to return the RTR response */ -}; - -/************************************************************************************ - * Public Data - ************************************************************************************/ - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/************************************************************************************ - * Name: can_register - * - * Description: - * Register a CAN driver. - * - ************************************************************************************/ - -EXTERN int can_register(FAR const char *path, FAR struct can_dev_s *dev); - -/************************************************************************************ - * Name: can_receive - * - * Description: - * Called from the CAN interrupt handler when new read data is available - * - * Parameters: - * dev - The specifi CAN device - * hdr - The 16-bit CAN header - * data - An array contain the CAN data. - * - * Return: - * OK on success; a negated errno on failure. - * - ************************************************************************************/ - -EXTERN int can_receive(FAR struct can_dev_s *dev, FAR struct can_hdr_s *hdr, - FAR uint8_t *data); - -/************************************************************************************ - * Name: can_txdone - * - * Description: - * Called from the CAN interrupt handler at the completion of a send operation. - * - * Parameters: - * dev - The specifi CAN device - * hdr - The 16-bit CAN header - * data - An array contain the CAN data. - * - * Return: - * OK on success; a negated errno on failure. - * - ************************************************************************************/ - -EXTERN int can_txdone(FAR struct can_dev_s *dev); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* CONFIG_CAN */ -#endif /* _INCLUDE_NUTTX_CAN_H */ diff --git a/nuttx/include/nuttx/clock.h b/nuttx/include/nuttx/clock.h deleted file mode 100644 index e640ecd2e..000000000 --- a/nuttx/include/nuttx/clock.h +++ /dev/null @@ -1,251 +0,0 @@ -/**************************************************************************** - * include/nuttx/clock.h - * - * Copyright (C) 2007-2009, 2011-2012 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_NUTTX_CLOCK_H -#define _INCLUDE_NUTTX_CLOCK_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include - -/**************************************************************************** - * Pro-processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* Efficient, direct access to OS global timer variables will be supported - * if the execution environment has direct access to kernel global data. - * The code in this execution context can access the kernel global data - * directly if: (1) this is an un-protected, non-kernel build, or (2) - * this code is being built for execution within the kernel. - */ - -#undef __HAVE_KERNEL_GLOBALS -#if !defined(CONFIG_NUTTX_KERNEL) || defined(__KERNEL__) -# define __HAVE_KERNEL_GLOBALS 1 -#else -# define __HAVE_KERNEL_GLOBALS 0 -#endif - -/* If CONFIG_SYSTEM_TIME64 is selected and the CPU supports long long types, - * then a 64-bit system time will be used. - */ - -#ifndef CONFIG_HAVE_LONG_LONG -# undef CONFIG_SYSTEM_TIME64 -#endif - -/* Timing constants *********************************************************/ - -#define NSEC_PER_SEC 1000000000 -#define USEC_PER_SEC 1000000 -#define MSEC_PER_SEC 1000 -#define DSEC_PER_SEC 10 -#define NSEC_PER_DSEC 100000000 -#define USEC_PER_DSEC 100000 -#define MSEC_PER_DSEC 100 -#define NSEC_PER_MSEC 1000000 -#define USEC_PER_MSEC 1000 -#define NSEC_PER_USEC 1000 - -/* The interrupt interval of the system timer is given by MSEC_PER_TICK. - * This is the expected number of milliseconds between calls from the - * processor-specific logic to sched_process_timer(). The default value - * of MSEC_PER_TICK is 10 milliseconds (100KHz). However, this default - * setting can be overridden by defining the interval in milliseconds as - * CONFIG_MSEC_PER_TICK in the board configuration file. - * - * The following calculations are only accurate when (1) there is no - * truncation involved and (2) the underlying system timer is an even - * multiple of milliseconds. If (2) is not true, you will probably want - * to redefine all of the following. - */ - -#ifdef CONFIG_MSEC_PER_TICK -# define MSEC_PER_TICK (CONFIG_MSEC_PER_TICK) -#else -# define MSEC_PER_TICK (10) -#endif - -#define TICK_PER_DSEC (MSEC_PER_DSEC / MSEC_PER_TICK) /* Truncates! */ -#define TICK_PER_SEC (MSEC_PER_SEC / MSEC_PER_TICK) /* Truncates! */ -#define NSEC_PER_TICK (MSEC_PER_TICK * NSEC_PER_MSEC) /* Exact */ -#define USEC_PER_TICK (MSEC_PER_TICK * USEC_PER_MSEC) /* Exact */ - -#define NSEC2TICK(nsec) (((nsec)+(NSEC_PER_TICK/2))/NSEC_PER_TICK) /* Rounds */ -#define USEC2TICK(usec) (((usec)+(USEC_PER_TICK/2))/USEC_PER_TICK) /* Rounds */ -#define MSEC2TICK(msec) (((msec)+(MSEC_PER_TICK/2))/MSEC_PER_TICK) /* Rounds */ -#define DSEC2TICK(dsec) MSEC2TICK((dsec)*MSEC_PER_DSEC) -#define SEC2TICK(sec) MSEC2TICK((sec)*MSEC_PER_SEC) /* Exact */ - -#define TICK2NSEC(tick) ((tick)*NSEC_PER_TICK) /* Exact */ -#define TICK2USEC(tick) ((tick)*USEC_PER_TICK) /* Exact */ -#define TICK2MSEC(tick) ((tick)*MSEC_PER_TICK) /* Exact */ -#define TICK2DSEC(tick) (((tick)+(TICK_PER_DSEC/2))/TICK_PER_DSEC) /* Rounds */ -#define TICK2SEC(tick) (((tick)+(TICK_PER_SEC/2))/TICK_PER_SEC) /* Rounds */ - -/**************************************************************************** - * Global Data - ****************************************************************************/ - -#if !defined(CONFIG_DISABLE_CLOCK) - -/* Access to raw system clock ***********************************************/ -/* Direct access to the system timer/counter is supported only if (1) the - * system timer counter is available (i.e., we are not configured to use - * a hardware periodic timer), and (2) the execution environment has direct - * access to kernel global data - */ - -#if __HAVE_KERNEL_GLOBALS -# ifdef CONFIG_SYSTEM_TIME64 - -extern volatile uint64_t g_system_timer; -#define clock_systimer() (uint32_t)(g_system_timer & 0x00000000ffffffff) -#define clock_systimer64() g_system_timer - -# else - -extern volatile uint32_t g_system_timer; -#define clock_systimer() g_system_timer - -# endif -#endif - -/**************************************************************************** - * Global Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Function: clock_synchronize - * - * Description: - * Synchronize the system timer to a hardware RTC. This operation is - * normally performed automatically by the system during clock - * initialization. However, the user may also need to explicitly re- - * synchronize the system timer to the RTC under certain conditions where - * the system timer is known to be in error. For example, in certain low- - * power states, the system timer may be stopped but the RTC will continue - * keep correct time. After recovering from such low-power state, this - * function should be called to restore the correct system time. - * - * Calling this function could result in system time going "backward" in - * time, especially with certain lower resolution RTC implementations. - * Time going backward could have bad consequences if there are ongoing - * timers and delays. So use this interface with care. - * - * Parameters: - * None - * - * Return Value: - * None - * - * Assumptions: - * - ****************************************************************************/ - -#ifdef CONFIG_RTC -EXTERN void clock_synchronize(void); -#endif - -/**************************************************************************** - * Function: clock_systimer - * - * Description: - * Return the current value of the 32-bit system timer counter. Indirect - * access to the system timer counter is required through this function if - * the execution environment does not have direct access to kernel global - * data - * - * Parameters: - * None - * - * Return Value: - * The current value of the system timer counter - * - * Assumptions: - * - ****************************************************************************/ - -#if !__HAVE_KERNEL_GLOBALS -# ifdef CONFIG_SYSTEM_TIME64 -# define clock_systimer() (uint32_t)(clock_systimer64() & 0x00000000ffffffff) -# else -EXTERN uint32_t clock_systimer(void); -# endif -#endif - -/**************************************************************************** - * Function: clock_systimer64 - * - * Description: - * Return the current value of the 64-bit system timer counter. Indirect - * access to the system timer counter is required through this function if - * the execution environment does not have direct access to kernel global - * data - * - * Parameters: - * None - * - * Return Value: - * The current value of the system timer counter - * - * Assumptions: - * - ****************************************************************************/ - -#if !__HAVE_KERNEL_GLOBALS && defined(CONFIG_SYSTEM_TIME64) -EXTERN uint64_t clock_systimer64(void); -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* !CONFIG_DISABLE_CLOCK */ -#endif /* _INCLUDE_NUTTX_CLOCK_H */ diff --git a/nuttx/include/nuttx/compiler.h b/nuttx/include/nuttx/compiler.h deleted file mode 100644 index 6ad51ad0f..000000000 --- a/nuttx/include/nuttx/compiler.h +++ /dev/null @@ -1,477 +0,0 @@ -/**************************************************************************** - * include/nuttx/compiler.h - * - * Copyright (C) 2007-2009, 2012 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_NUTTX_COMPILER_H -#define __INCLUDE_NUTTX_COMPILER_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* GCC-specific definitions *************************************************/ - -#ifdef __GNUC__ - -/* Pre-processor */ - -# define CONFIG_CPP_HAVE_VARARGS 1 /* Supports variable argument macros */ -# define CONFIG_CPP_HAVE_WARNING 1 /* Supports #warning */ - -/* Intriniscs */ - -# define CONFIG_HAVE_FUNCTIONNAME 1 /* Has __FUNCTION__ */ -# define CONFIG_HAVE_FILENAME 1 /* Has __FILE__ */ - -/* Attributes - * - * GCC supports weak symbols which can be used to reduce code size because - * unnecessary "weak" functions can be excluded from the link. - */ - -# ifndef __CYGWIN__ -# define CONFIG_HAVE_WEAKFUNCTIONS 1 -# define weak_alias(name, aliasname) \ - extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); -# define weak_function __attribute__ ((weak)) -# define weak_const_function __attribute__ ((weak, __const__)) -# else -# undef CONFIG_HAVE_WEAKFUNCTIONS -# define weak_alias(name, aliasname) -# define weak_function -# define weak_const_function -#endif - -/* The noreturn attribute informs GCC that the function will not return. */ - -# define noreturn_function __attribute__ ((noreturn)) - -/* The packed attribute informs GCC that the stucture elements are packed, - * ignoring other alignment rules. - */ - -# define packed_struct __attribute__ ((packed)) - -/* GCC does not support the reentrant attribute */ - -# define reentrant_function - -/* The naked attribute informs GCC that the programmer will take care of - * the function prolog and epilog. - */ - -# define naked_function __attribute__ ((naked,no_instrument_function)) - -/* The inline_function attribute informs GCC that the function should always - * be inlined, regardless of the level of optimization. The noinline_function - * indicates that the function should never be inlined. - */ - -# define inline_function __attribute__ ((always_inline,no_instrument_function)) -# define noinline_function __attribute__ ((noinline)) - -/* GCC has does not use storage classes to qualify addressing */ - -# define FAR -# define NEAR -# define DSEG -# define CODE - -/* Handle cases where sizeof(int) is 16-bits, sizeof(long) is 32-bits, and - * pointers are 16-bits. - */ - -#if defined(__m32c__) -/* Select the small, 16-bit addressing model */ - -# define CONFIG_SMALL_MEMORY 1 - -/* Long and int are not the same size */ - -# define CONFIG_LONG_IS_NOT_INT 1 - -/* Pointers and int are the same size */ - -# undef CONFIG_PTR_IS_NOT_INT - -#elif defined(__AVR__) -/* Select the small, 16-bit addressing model */ - -# define CONFIG_SMALL_MEMORY 1 - -/* Long and int are not the same size */ - -# define CONFIG_LONG_IS_NOT_INT 1 - -/* Pointers and int are the same size */ - -# undef CONFIG_PTR_IS_NOT_INT - -/* Uses a 32-bit FAR pointer only from accessing data outside of the 16-bit - * data space. - */ - -# define CONFIG_HAVE_FARPOINTER 1 - -#elif defined(__mc68hc1x__) -/* Select the small, 16-bit addressing model */ - -# define CONFIG_SMALL_MEMORY 1 - -/* Normally, mc68hc1x code is compiled with the -mshort option - * which results in a 16-bit integer. If -mnoshort is defined - * then an integer is 32-bits. GCC will defined __INT__ accordingly: - */ - -# if __INT__ == 16 -/* int is 16-bits, long is 32-bits */ - -# define CONFIG_LONG_IS_NOT_INT 1 - -/* Pointers and int are the same size (16-bits) */ - -# undef CONFIG_PTR_IS_NOT_INT -#else -/* int and long are both 32-bits */ - -# undef CONFIG_LONG_IS_NOT_INT - -/* Pointers and int are NOT the same size */ - -# define CONFIG_PTR_IS_NOT_INT 1 -#endif - -#else -/* Select the large, 32-bit addressing model */ - -# undef CONFIG_SMALL_MEMORY - -/* Long and int are (probably) the same size (32-bits) */ - -# undef CONFIG_LONG_IS_NOT_INT - -/* Pointers and int are the same size (32-bits) */ - -# undef CONFIG_PTR_IS_NOT_INT -#endif - -/* GCC supports inlined functions */ - -# define CONFIG_HAVE_INLINE 1 - -/* GCC supports both types double and long long */ - -# define CONFIG_HAVE_LONG_LONG 1 -# define CONFIG_HAVE_FLOAT 1 -# define CONFIG_HAVE_DOUBLE 1 -# define CONFIG_HAVE_LONG_DOUBLE 1 - -/* Structures and unions can be assigned and passed as values */ - -# define CONFIG_CAN_PASS_STRUCTS 1 - -/* SDCC-specific definitions ************************************************/ - -#elif defined(SDCC) - -/* Pre-processor */ - -# define CONFIG_CPP_HAVE_VARARGS 1 /* Supports variable argument macros */ -# define CONFIG_CPP_HAVE_WARNING 1 /* Supports #warning */ - -/* Intriniscs */ - -# define CONFIG_HAVE_FUNCTIONNAME 1 /* Has __FUNCTION__ */ -# define CONFIG_HAVE_FILENAME 1 /* Has __FILE__ */ - -/* Pragmas - * - * Disable warnings for unused function arguments */ - -# pragma disable_warning 85 - -/* Attributes - * - * SDCC does not support weak symbols */ - -# undef CONFIG_HAVE_WEAKFUNCTIONS -# define weak_alias(name, aliasname) -# define weak_function -# define weak_const_function - -/* SDCC does not support the noreturn or packed attributes */ - -# define noreturn_function -# define packed_struct - -/* SDCC does support "naked" functions */ - -# define naked_function __naked - -/* SDCC does not support forced inlining. */ - -# define inline_function -# define noinline_function - -/* The reentrant attribute informs SDCC that the function - * must be reentrant. In this case, SDCC will store input - * arguments on the stack to support reentrancy. - */ - -# define reentrant_function __reentrant - -/* It is assumed that the system is build using the small - * data model with storage defaulting to internal RAM. - * The NEAR storage class can also be used to address data - * in internal RAM; FAR can be used to address data in - * external RAM. - */ - -#if defined(__SDCC_z80) || defined(__SDCC_z180) || defined(__SDCC_gbz80) -# define FAR -# define NEAR -# define CODE -# define DSEG -#else -# define FAR __xdata -# define NEAR __data -# define CODE __code -# if defined(SDCC_MODEL_SMALL) -# define DSEG __data -# else -# define DSEG __xdata -# endif -#endif - -/* Select small, 16-bit address model */ - -# define CONFIG_SMALL_MEMORY 1 - -/* Long and int are not the same size */ - -# define CONFIG_LONG_IS_NOT_INT 1 - -/* The generic pointer and int are not the same size - * (for some SDCC architectures) - */ - -#if !defined(__z80) && !defined(__gbz80) -# define CONFIG_PTR_IS_NOT_INT 1 -#endif - -/* SDCC does not support inline functions */ - -# undef CONFIG_HAVE_INLINE -# define inline - -/* SDCC does not support type long long or type double */ - -# undef CONFIG_HAVE_LONG_LONG -# define CONFIG_HAVE_FLOAT 1 -# undef CONFIG_HAVE_DOUBLE -# undef CONFIG_HAVE_LONG_DOUBLE - -/* Structures and unions cannot be passed as values or used - * in assignments. - */ - -# undef CONFIG_CAN_PASS_STRUCTS - -/* Zilog-specific definitions ***********************************************/ - -#elif defined(__ZILOG__) - -/* At present, only the following Zilog compilers are recognized */ - -# if !defined(__ZNEO__) && !defined(__EZ8__) && !defined(__EZ80__) -# warning "Unrecognized Zilog compiler" -# endif - -/* Pre-processor */ - -# undef CONFIG_CPP_HAVE_VARARGS /* No variable argument macros */ -# undef CONFIG_CPP_HAVE_WARNING /* Does not support #warning */ - -/* Intrinsics */ - -# define CONFIG_HAVE_FUNCTIONNAME 1 /* Has __FUNCTION__ */ -# define CONFIG_HAVE_FILENAME 1 /* Has __FILE__ */ - -/* Attributes - * - * The Zilog compiler does not support weak symbols - */ - -# undef CONFIG_HAVE_WEAKFUNCTIONS -# define weak_alias(name, aliasname) -# define weak_function -# define weak_const_function - -/* The Zilog compiler does not support the noreturn, packed, naked attributes */ - -# define noreturn_function -# define packed_struct -# define naked_function -# define inline_function -# define noinline_function - -/* The Zilog compiler does not support the reentrant attribute */ - -# define reentrant_function - -/* Addressing. - * - * Z16F ZNEO: Far is 24-bits; near is 16-bits of address. - * The supported model is (1) all code on ROM, and (2) all data - * and stacks in external (far) RAM. - * Z8Encore!: Far is 16-bits; near is 8-bits of address. - * The supported model is (1) all code on ROM, and (2) all data - * and stacks in internal (far) RAM. - * Z8Acclaim: In Z80 mode, all pointers are 16-bits. In ADL mode, all pointers - * are 24 bits. - */ - -# if defined(__ZNEO__) -# define FAR _Far -# define NEAR _Near -# define DSEG _Far -# define CODE _Erom -# undef CONFIG_SMALL_MEMORY /* Select the large, 32-bit addressing model */ -# undef CONFIG_LONG_IS_NOT_INT /* Long and int are the same size */ -# undef CONFIG_PTR_IS_NOT_INT /* FAR pointers and int are the same size */ -# elif defined(__EZ8__) -# define FAR far -# define NEAR near -# define DSEG far -# define CODE rom -# define CONFIG_SMALL_MEMORY 1 /* Select small, 16-bit address model */ -# define CONFIG_LONG_IS_NOT_INT 1 /* Long and int are not the same size */ -# undef CONFIG_PTR_IS_NOT_INT /* FAR pointers and int are the same size */ -# elif defined(__EZ80__) -# define FAR -# define NEAR -# define DSEG -# define CODE -# undef CONFIG_SMALL_MEMORY /* Select the large, 32-bit addressing model */ -# define CONFIG_LONG_IS_NOT_INT 1 /* Long and int are not the same size */ -# ifdef CONFIG_EZ80_Z80MODE -# define CONFIG_PTR_IS_NOT_INT 1 /* Pointers and int are not the same size */ -# else -# undef CONFIG_PTR_IS_NOT_INT /* Pointers and int are the same size */ -# endif -# endif - -/* The Zilog compiler does not support inline functions */ - -# undef CONFIG_HAVE_INLINE -# define inline - -/* Older Zilog compilers support both types double and long long, but the size - * is 32-bits (same as long and single precision) so it is safer to say that - * they are not supported. Later versions are more ANSII compliant and - * simply do not support long long or double. - */ - -# undef CONFIG_HAVE_LONG_LONG -# define CONFIG_HAVE_FLOAT 1 -# undef CONFIG_HAVE_DOUBLE -# undef CONFIG_HAVE_LONG_DOUBLE - -/* Structures and unions can be assigned and passed as values */ - -# define CONFIG_CAN_PASS_STRUCTS 1 - -/* Unknown compiler *********************************************************/ - -#else - -# undef CONFIG_CPP_HAVE_VARARGS -# undef CONFIG_CPP_HAVE_WARNING -# undef CONFIG_HAVE_FUNCTIONNAME -# undef CONFIG_HAVE_FILENAME -# undef CONFIG_HAVE_WEAKFUNCTIONS -# define weak_alias(name, aliasname) -# define weak_function -# define weak_const_function -# define noreturn_function -# define packed_struct -# define reentrant_function -# define naked_function -# define inline_function -# define noinline_function - -# define FAR -# define NEAR -# define DSEG -# define CODE - -# undef CONFIG_SMALL_MEMORY -# undef CONFIG_LONG_IS_NOT_INT -# undef CONFIG_PTR_IS_NOT_INT -# undef CONFIG_HAVE_INLINE -# define inline 1 -# undef CONFIG_HAVE_LONG_LONG -# define CONFIG_HAVE_FLOAT 1 -# undef CONFIG_HAVE_DOUBLE -# undef CONFIG_HAVE_LONG_DOUBLE -# undef CONFIG_CAN_PASS_STRUCTS - -#endif - -/**************************************************************************** - * Global Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Global Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_COMPILER_H */ diff --git a/nuttx/include/nuttx/fb.h b/nuttx/include/nuttx/fb.h deleted file mode 100644 index ddff4edf8..000000000 --- a/nuttx/include/nuttx/fb.h +++ /dev/null @@ -1,354 +0,0 @@ -/**************************************************************************** - * include/nuttx/fb.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 _INCLUDE_NUTTX_FB_H -#define _INCLUDE_NUTTX_FB_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Pre-processor definitions - ****************************************************************************/ - -/* Color format definitions. The pretty much define the color pixel processing - * organization of the video controller. - */ - -/* Monochrome Formats *******************************************************/ - -#define FB_FMT_Y1 0 /* BPP=1, monochrome */ -#define FB_FMT_Y4 1 /* BPP=4, 4-bit uncompressed greyscale */ -#define FB_FMT_Y8 2 /* BPP=8, 8-bit uncompressed greyscale */ -#define FB_FMT_Y16 3 /* BPP=16, 16-bit uncompressed greyscale */ -#define FB_FMT_GREY FB_FMT_Y8 /* BPP=8 */ -#define FB_FMT_Y800 FB_FMT_Y8 /* BPP=8 */ - -#define FB_ISMONO(f) ((f) >= FB_FMT_Y4) && (f) <= FB_FMT_Y16) - -/* RGB video formats ********************************************************/ - -/* Standard RGB */ - -#define FB_FMT_RGB1 FB_FMT_Y1 /* BPP=1 */ -#define FB_FMT_RGB4 4 /* BPP=4 */ -#define FB_FMT_RGB8 5 /* BPP=8 RGB palette index */ -#define FB_FMT_RGB8_332 6 /* BPP=8 R=3, G=3, B=2 */ -#define FB_FMT_RGB12_444 7 /* BPP=12 R=4, G=4, B=4 */ -#define FB_FMT_RGB16_555 8 /* BPP=16 R=5, G=5, B=5 (1 unused bit) */ -#define FB_FMT_RGB16_565 9 /* BPP=16 R=6, G=6, B=5 */ -#define FB_FMT_RGB24 10 /* BPP=24 */ -#define FB_FMT_RGB32 11 /* BPP=32 */ - -/* Run length encoded RGB */ - -#define FB_FMT_RGBRLE4 12 /* BPP=4 */ -#define FB_FMT_RGBRLE8 13 /* BPP=8 */ - -/* Raw RGB */ - -#define FB_FMT_RGBRAW 14 /* BPP=? */ - -/* Raw RGB with arbitrary sample packing within a pixel. Packing and precision - * of R, G and B components is determined by bit masks for each. - */ - -#define FB_FMT_RGBBTFLD16 15 /* BPP=16 */ -#define FB_FMT_RGBBTFLD24 16 /* BPP=24 */ -#define FB_FMT_RGBBTFLD32 17 /* BPP=32 */ -#define FB_FMT_RGBA16 18 /* BPP=16 Raw RGB with alpha */ -#define FB_FMT_RGBA32 19 /* BPP=32 Raw RGB with alpha */ - -/* Raw RGB with a transparency field. Layout is as for stanadard RGB at 16 and - * 32 bits per pixel but the msb in each pixel indicates whether the pixel is - * transparent or not. - */ - -#define FB_FMT_RGBT16 20 /* BPP=16 */ -#define FB_FMT_RGBT32 21 /* BPP=32 */ - -#define FB_ISRGB(f) ((f) >= FB_FMT_RGB1) && (f) <= FB_FMT_RGBT32) - -/* Packed YUV Formats *******************************************************/ - -#define FB_FMT_AYUV 22 /* BPP=32 Combined YUV and alpha */ -#define FB_FMT_CLJR 23 /* BPP=8 4 pixels packed into a uint32_t. - * YUV 4:1:1 with l< 8 bits per YUV sample */ -#define FB_FMT_CYUV 24 /* BPP=16 UYVY except that height is reversed */ -#define FB_FMT_IRAW 25 /* BPP=? Intel uncompressed YUV */ -#define FB_FMT_IUYV 26 /* BPP=16 Interlaced UYVY (line order - * 0,2,4,.., 1,3,5...) */ -#define FB_FMT_IY41 27 /* BPP=12 Interlaced Y41P (line order - * 0,2,4,.., 1,3,5...) */ -#define FB_FMT_IYU2 28 /* BPP=24 */ -#define FB_FMT_HDYC 29 /* BPP=16 UYVY except uses the BT709 color space */ -#define FB_FMT_UYVP 30 /* BPP=24? YCbCr 4:2:2, 10-bits per component in U0Y0V0Y1 order */ -#define FB_FMT_UYVY 31 /* BPP=16 YUV 4:2:2 */ -#define FB_FMT_UYNV FB_FMT_UYVY /* BPP=16 */ -#define FB_FMT_Y422 FB_FMT_UYVY /* BPP=16 */ -#define FB_FMT_V210 32 /* BPP=32 10-bit 4:2:2 YCrCb */ -#define FB_FMT_V422 33 /* BPP=16 Upside down version of UYVY */ -#define FB_FMT_V655 34 /* BPP=16? 16-bit YUV 4:2:2 */ -#define FB_FMT_VYUY 35 /* BPP=? ATI Packed YUV Data */ -#define FB_FMT_YUYV 36 /* BPP=16 YUV 4:2:2 */ -#define FB_FMT_YUY2 FB_FMT_YUYV /* BPP=16 YUV 4:2:2 */ -#define FB_FMT_YUNV FB_FMT_YUYV /* BPP=16 YUV 4:2:2 */ -#define FB_FMT_YVYU 37 /* BPP=16 YUV 4:2:2 */ -#define FB_FMT_Y41P 38 /* BPP=12 YUV 4:1:1 */ -#define FB_FMT_Y411 39 /* BPP=12 YUV 4:1:1 */ -#define FB_FMT_Y211 40 /* BPP=8 */ -#define FB_FMT_Y41T 41 /* BPP=12 Y41P LSB for transparency */ -#define FB_FMT_Y42T 42 /* BPP=16 UYVY LSB for transparency */ -#define FB_FMT_YUVP 43 /* BPP=24? YCbCr 4:2:2 Y0U0Y1V0 order */ - -#define FB_ISYUVPACKED(f) ((f) >= FB_FMT_AYUV) && (f) <= FB_FMT_YUVP) - -/* Packed Planar YUV Formats ************************************************/ - -#define FB_FMT_YVU9 44 /* BPP=9 8-bit Y followed by 8-bit 4x4 VU */ -#define FB_FMT_YUV9 45 /* BPP=9? */ -#define FB_FMT_IF09 46 /* BPP=9.5 YVU9 + 4x4 plane of delta relative to tframe. */ -#define FB_FMT_YV16 47 /* BPP=16 8-bit Y followed by 8-bit 2x1 VU */ -#define FB_FMT_YV12 48 /* BPP=12 8-bit Y followed by 8-bit 2x2 VU */ -#define FB_FMT_I420 49 /* BPP=12 8-bit Y followed by 8-bit 2x2 UV */ -#define FB_FMT_IYUV FB_FMT_I420 /* BPP=12 */ -#define FB_FMT_NV12 50 /* BPP=12 8-bit Y followed by an interleaved 2x2 UV */ -#define FB_FMT_NV21 51 /* BPP=12 NV12 with UV reversed */ -#define FB_FMT_IMC1 52 /* BPP=12 YV12 except UV planes ame stride as Y */ -#define FB_FMT_IMC2 53 /* BPP=12 IMC1 except UV lines interleaved at half stride boundaries */ -#define FB_FMT_IMC3 54 /* BPP=12 As IMC1 except that UV swapped */ -#define FB_FMT_IMC4 55 /* BPP=12 As IMC2 except that UV swapped */ -#define FB_FMT_CLPL 56 /* BPP=12 YV12 but including a level of indirection. */ -#define FB_FMT_Y41B 57 /* BPP=12? 4:1:1 planar. */ -#define FB_FMT_Y42B 58 /* BPP=16? YUV 4:2:2 planar. */ -#define FB_FMT_CXY1 59 /* BPP=12 */ -#define FB_FMT_CXY2 60 /* BPP=16 */ - -#define FB_ISYUVPLANAR(f) ((f) >= FB_FMT_AYUV) && (f) <= FB_FMT_YUVP) -#define FB_ISYUV(f) (FB_ISYUVPACKED(f) || FB_ISYUVPLANAR(f)) - -/* Hardware cursor control **************************************************/ - -#ifdef CONFIG_FB_HWCURSOR -#define FB_CUR_ENABLE 0x01 /* Enable the cursor */ -#define FB_CUR_SETIMAGE 0x02 /* Set the cursor image */ -#define FB_CUR_SETPOSITION 0x04 /* Set the position of the cursor */ -#define FB_CUR_SETSIZE 0x08 /* Set the size of the cursor */ -#define FB_CUR_XOR 0x10 /* Use XOR vs COPY ROP on image */ -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* If any dimension of the display exceeds 65,536 pixels, then the following - * type will need to change: - */ - -typedef uint16_t fb_coord_t; - -/* This structure describes the overall video controller */ - -struct fb_videoinfo_s -{ - uint8_t fmt; /* see FB_FMT_* */ - fb_coord_t xres; /* Horizontal resolution in pixel columns */ - fb_coord_t yres; /* Vertical resolution in pixel rows */ - uint8_t nplanes; /* Number of color planes supported */ -}; - -/* This structure describes one color plane. Some YUV formats may support - * up to 4 planes - */ - -struct fb_planeinfo_s -{ - FAR void *fbmem; /* Start of frame buffer memory */ - uint32_t fblen; /* Length of frame buffer memory in bytes */ - fb_coord_t stride; /* Length of a line in bytes */ - uint8_t bpp; /* Bits per pixel */ -}; - -/* On video controllers that support mapping of a pixel palette value - * to an RGB encoding, the following structure may be used to define - * that mapping. - */ - -#ifdef CONFIG_FB_CMAP -struct fb_cmap_s -{ - uint16_t first; /* Offset offset first color entry in tables */ - uint16_t len; /* Number of color entries in tables */ - - /* Tables of color component. Any may be NULL if not used */ - - uint8_t *red; /* Table of 8-bit red values */ - uint8_t *green; /* Table of 8-bit green values */ - uint8_t *blue; /* Table of 8-bit blue values */ -#ifdef CONFIG_FB_TRANSPARENCY - uint8_t *transp; /* Table of 8-bit transparency */ -#endif -}; -#endif - -/* If the video controller hardware supports a hardware cursor and - * that hardware cursor supports user-provided images, then the - * following structure may be used to provide the cursor image - */ - -#ifdef CONFIG_FB_HWCURSOR -#ifdef CONFIG_FB_HWCURSORIMAGE -struct fb_cursorimage_s -{ - fb_coord_t width; /* Width of the cursor image in pixels */ - fb_coord_t height /* Height of the curor image in pixels */ - const uint8_t *image; /* Pointer to image data */ -}; -#endif - -/* The following structure defines the cursor position/size */ - -struct fb_cursorpos_s -{ - fb_coord_t x; /* X position in pixels */ - fb_coord_t y; /* Y position in rows */ -}; - -/* If the hardware supports setting the cursor size, then this structure - * is used to provide the size. - */ - -#ifdef CONFIG_FB_HWCURSORSIZE -struct fb_cursorsize_s -{ - fb_coord_t h; /* Height in rows */ - fb_coord_t w; /* Width in pixels */ -}; -#endif - -/* The following is used to get the cursor attributes */ - -struct fb_cursorattrib_s -{ -#ifdef CONFIG_FB_HWCURSORIMAGE - uint8_t fmt; /* Video format of cursor */ -#endif - struct fb_cursorpos_s pos; /* Current cursor position */ -#ifdef CONFIG_FB_HWCURSORSIZE - struct fb_cursorsize_s mxsize; /* Maximum cursor size */ - struct fb_cursorsize_s size; /* Current size */ -#endif -}; - -struct fb_setcursor_s -{ - uint8_t flags; /* See FB_CUR_* definitions */ - struct fb_cursorpos_s pos; /* Cursor position */ -#ifdef CONFIG_FB_HWCURSORSIZE - struct fb_cursorsize_s size; /* Cursor size */ -#endif -#ifdef CONFIG_FB_HWCURSORIMAGE - struct fb_cursorimage_s img; /* Cursor image */ -#endif -}; -#endif - -/* The framebuffer "driver" under NuttX is not a driver at all, but simply - * a driver "object" that is accessed through the following vtable: - */ - -struct fb_vtable_s -{ - /* Get information about the video controller configuration and the configuration - * of each color plane. - */ - - int (*getvideoinfo)(FAR struct fb_vtable_s *vtable, FAR struct fb_videoinfo_s *vinfo); - int (*getplaneinfo)(FAR struct fb_vtable_s *vtable, int planeno, FAR struct fb_planeinfo_s *pinfo); - - /* The following are provided only if the video hardware supports RGB color mapping */ - -#ifdef CONFIG_FB_CMAP - int (*getcmap)(FAR struct fb_vtable_s *vtable, FAR struct fb_cmap_s *cmap); - int (*putcmap)(FAR struct fb_vtable_s *vtable, FAR const struct fb_cmap_s *cmap); -#endif - /* The following are provided only if the video hardware supports a hardware cursor */ - -#ifdef CONFIG_FB_HWCURSOR - int (*getcursor)(FAR struct fb_vtable_s *vtable, FAR struct fb_cursorattrib_s *attrib); - int (*setcursor)(FAR struct fb_vtable_s *vtable, FAR struct fb_setcursor_s *settings); -#endif -}; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: up_fbinitialize, up_fbuninitialize, up_fbgetvplane - * - * Description: - * If an architecture supports a framebuffer, then it must provide APIs - * to access the framebuffer as follows: - * - * up_fbinitialize - Initialize the framebuffer video hardware - * up_fbgetvplane - Return a a reference to the framebuffer object for - * the specified video plane. Most OSDs support - * multiple planes of video. - * up_fbuninitialize - Unitialize the framebuffer support - * - ***************************************************************************/ - -EXTERN int up_fbinitialize(void); -EXTERN FAR struct fb_vtable_s *up_fbgetvplane(int vplane); -EXTERN void fb_uninitialize(void); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* _INCLUDE_NUTTX_FB_H */ diff --git a/nuttx/include/nuttx/float.h b/nuttx/include/nuttx/float.h deleted file mode 100644 index a8e4aa28b..000000000 --- a/nuttx/include/nuttx/float.h +++ /dev/null @@ -1,225 +0,0 @@ -/**************************************************************************** - * include/nuttx/float.h - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Reference: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/float.h.html - * - * 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_NUTTX_FLOAT_H -#define __INCLUDE_NUTTX_FLOAT_H - -/* TODO: These values could vary with architectures toolchains. This - * logic should be move at least to the include/arch directory. - */ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Radix of exponent representation, b. */ - -#define FLT_RADIX 2 - -/* Number of base-FLT_RADIX digits in the floating-point significand, p. */ - -#define FLT_MANT_DIG 24 - -#if CONFIG_HAVE_DOUBLE -# define DBL_MANT_DIG 53 -#else -# define DBL_MANT_DIG FLT_MANT_DIG -#endif - -#ifdef CONFIG_HAVE_LONG_DOUBLE -# define LDBL_MANT_DIG DBL_MANT_DIG /* FIX ME */ -#else -# define LDBL_MANT_DIG DBL_MANT_DIG -#endif - -/* Number of decimal digits, n, such that any floating-point number in the - * widest supported floating type with pmax radix b digits can be rounded - * to a floating-point number with n decimal digits and back again without - * change to the value. - */ - -#define DECIMAL_DIG 10 - -/* Number of decimal digits, q, such that any floating-point number with q - * decimal digits can be rounded into a floating-point number with p radix - * b digits and back again without change to the q decimal digits. - */ - -#define FLT_DIG 6 - -#if CONFIG_HAVE_DOUBLE -# define DBL_DIG 15 /* 10 */ -#else -# define DBL_DIG FLT_DIG -#endif - -#ifdef CONFIG_HAVE_LONG_DOUBLE -# define LDBL_DIG DBL_DIG /* FIX ME */ -#else -# define LDBL_DIG DBL_DIG -#endif - -/* Minimum negative integer such that FLT_RADIX raised to that power minus - * 1 is a normalized floating-point number, emin. - */ - -#define FLT_MIN_EXP (-125) - -#if CONFIG_HAVE_DOUBLE -# define DBL_MIN_EXP (-1021) -#else -# define DBL_MIN_EXP FLT_MIN_EXP -#endif - -#ifdef CONFIG_HAVE_LONG_DOUBLE -# define LDBL_MIN_EXP DBL_MIN_EXP /* FIX ME */ -#else -# define LDBL_MIN_EXP DBL_MIN_EXP -#endif - -/* inimum negative integer such that 10 raised to that power is in the range - * of normalized floating-point numbers. - */ - -#define FLT_MIN_10_EXP (-37) - -#if CONFIG_HAVE_DOUBLE -# define DBL_MIN_10_EXP (-307) /* -37 */ -#else -# define DBL_MIN_10_EXP FLT_MIN_10_EXP -#endif - -#ifdef CONFIG_HAVE_LONG_DOUBLE -# define LDBL_MIN_10_EXP DBL_MIN_10_EXP /* FIX ME */ -#else -# define LDBL_MIN_10_EXP DBL_MIN_10_EXP -#endif - -/* Maximum integer such that FLT_RADIX raised to that power minus 1 is a - * representable finite floating-point number, emax. - */ - -#define FLT_MAX_EXP 128 - -#if CONFIG_HAVE_DOUBLE -# define DBL_MAX_EXP 1024 -#else -# define DBL_MAX_EXP FLT_MAX_EXP -#endif - -#ifdef CONFIG_HAVE_LONG_DOUBLE -# define LDBL_MAX_EXP DBL_MAX_EXP /* FIX ME */ -#else -# define LDBL_MAX_EXP DBL_MAX_EXP -#endif - -/* Maximum integer such that 10 raised to that power is in the range of - * representable finite floating-point numbers. - */ - -#define FLT_MAX_10_EXP 38 /* 37 */ - -#if CONFIG_HAVE_DOUBLE -# define DBL_MAX_10_EXP 308 /* 37 */ -#else -# define DBL_MAX_10_EXP FLT_MAX_10_EXP -#endif - -#ifdef CONFIG_HAVE_LONG_DOUBLE -# define LDBL_MAX_10_EXP DBL_MAX_10_EXP /* FIX ME */ -#else -# define LDBL_MAX_10_EXP DBL_MAX_10_EXP -#endif - -/* Maximum representable finite floating-point number. */ - -#define FLT_MAX 3.40282347e+38F /* 1E+37 */ - -#if CONFIG_HAVE_DOUBLE -# define DBL_MAX 1.7976931348623157e+308 /* 1E+37 */ -#else -# define DBL_MAX FLT_MAX -#endif - -#ifdef CONFIG_HAVE_LONG_DOUBLE -# define LDBL_MAX DBL_MAX /* FIX ME */ -#else -# define LDBL_MAX DBL_MAX -#endif - -/* The difference between 1 and the least value greater than 1 that is - * representable in the given floating-point type, b1-p. - */ - -#define FLT_EPSILON 1.1920929e-07F /* 1E-5 */ - -#if CONFIG_HAVE_DOUBLE -# define DBL_EPSILON 2.2204460492503131e-16 /* 1E-9 */ -#else -# define DBL_EPSILON FLT_EPSILON -#endif - -#ifdef CONFIG_HAVE_LONG_DOUBLE -# define LDBL_EPSILON DBL_EPSILON /* FIX ME */ -#else -# define LDBL_EPSILON DBL_EPSILON -#endif - -/* Minimum normalized positive floating-point number, bemin -1. */ - -#define FLT_MIN 1.17549435e-38F /* 1E-37 */ - -#if CONFIG_HAVE_DOUBLE -#define DBL_MIN 2.2250738585072014e-308 /* 1E-37 */ -#else -# define DBL_MIN FLT_MIN -#endif - -#ifdef CONFIG_HAVE_LONG_DOUBLE -# define LDBL_MIN DBL_MIN /* FIX ME */ -#else -# define LDBL_MIN DBL_MIN -#endif - -#endif /* __INCLUDE_NUTTX_FLOAT_H */ diff --git a/nuttx/include/nuttx/fs/binfs.h b/nuttx/include/nuttx/fs/binfs.h deleted file mode 100644 index d967506d8..000000000 --- a/nuttx/include/nuttx/fs/binfs.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** - * include/nuttx/fs/binfs.h - * - * Copyright (C) 2013 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_NUTTX_FS_BINFS_H -#define __INCLUDE_NUTTX_FS_BINFS_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#ifdef CONFIG_FS_BINFS - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/* The "bindir" is file system that supports access to the builtin applications. - * It is typically mounted under /bin. - */ - -EXTERN mountpt_operations; -EXTERN const struct mountpt_operations binfs_operations; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_FS_BINFS */ -#endif /* __INCLUDE_NUTTX_FS_BINFS_H */ diff --git a/nuttx/include/nuttx/fs/dirent.h b/nuttx/include/nuttx/fs/dirent.h deleted file mode 100644 index f8d356850..000000000 --- a/nuttx/include/nuttx/fs/dirent.h +++ /dev/null @@ -1,221 +0,0 @@ -/**************************************************************************** - * include/nuttx/fs/dirent.h - * - * Copyright (C) 2007, 2009, 2011-2013 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_NUTTX_FS_DIRENT_H -#define __INCLUDE_NUTTX_FS_DIRENT_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#ifdef CONFIG_NFS -# define DIRENT_NFS_MAXHANDLE 64 /* Maximum length of an NFSv3 file handle */ -# define DIRENT_NFS_VERFLEN 8 /* Length of the copy verifier */ -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* The internal representation of type DIR is just a container for an inode - * reference, a position, a dirent structure, and file-system-specific - * information. - * - * For the root pseudo-file system, we need retain only the 'next' inode - * need for the next readdir() operation. We hold a reference on this - * inode so we know that it will persist until closedir is called. - */ - -struct fs_pseudodir_s -{ - struct inode *fd_next; /* The inode for the next call to readdir() */ -}; - -#ifndef CONFIG_DISABLE_MOUNTPOINT -#ifdef CONFIG_FS_FAT -/* For fat, we need to return the start cluster, current cluster, current - * sector and current directory index. - */ - -struct fs_fatdir_s -{ - off_t fd_startcluster; /* Start cluster number of the directory */ - off_t fd_currcluster; /* Current cluster number being read */ - off_t fd_currsector; /* Current sector being read */ - unsigned int fd_index; /* Current index of the directory entry to read */ -}; -#endif /* CONFIG_FS_FAT */ - -#ifdef CONFIG_FS_ROMFS -/* For ROMFS, we need to return the offset to the current and start positions - * of the directory entry being read - */ - -struct fs_romfsdir_s -{ - off_t fr_firstoffset; /* Offset to the first entry in the directory */ - off_t fr_curroffset; /* Current offset into the directory contents */ -}; -#endif /* CONFIG_FS_ROMFS */ - -#ifdef CONFIG_FS_BINFS -/* The apps/ pseudo bin/ directory. The state value is simply an index */ - -struct fs_binfsdir_s -{ - unsigned int fb_index; /* Index to the next named entry point */ -}; -#endif - -#ifdef CONFIG_FS_NXFFS -/* NXFFS is the tiny NuttX wear-leveling FLASH file system. The state value is - * the offset in FLASH memory to the next inode entry. - */ - -struct fs_nxffsdir_s -{ - off_t nx_offset; /* Offset to the next inode */ -}; -#endif - -#ifdef CONFIG_NFS -/* The NFS client file system */ - -struct nfsdir_s -{ - uint8_t nfs_fhsize; /* Length of the file handle */ - uint8_t nfs_fhandle[DIRENT_NFS_MAXHANDLE]; /* File handle (max size allocated) */ - uint8_t nfs_verifier[DIRENT_NFS_VERFLEN]; /* Cookie verifier */ - uint32_t nfs_cookie[2]; /* Cookie */ -}; -#endif - -#endif /* CONFIG_DISABLE_MOUNTPOINT */ - -struct fs_dirent_s -{ - /* This is the node that was opened by opendir. The type of the inode - * determines the way that the readdir() operations are performed. For the - * pseudo root pseudo-file system, it is also used to support rewind. - * - * We hold a reference on this inode so we know that it will persist until - * closedir() is called (although inodes linked to this inode may change). - */ - - struct inode *fd_root; - - /* At present, only mountpoints require special handling flags */ - -#ifndef CONFIG_DISABLE_MOUNTPOINT - unsigned int fd_flags; -#endif - - /* This keeps track of the current directory position for telldir */ - - off_t fd_position; - - /* Retained control information depends on the type of file system that - * provides is provides the mountpoint. Ideally this information should - * be hidden behind an opaque, file-system-dependent void *, but we put - * the private definitions in line here for now to reduce allocations. - */ - - union - { - /* Private data used by the built-in pseudo-file system */ - - struct fs_pseudodir_s pseudo; - - /* Private data used by other file systems */ - -#ifndef CONFIG_DISABLE_MOUNTPOINT -#ifdef CONFIG_FS_FAT - struct fs_fatdir_s fat; -#endif -#ifdef CONFIG_FS_ROMFS - struct fs_romfsdir_s romfs; -#endif -#ifdef CONFIG_FS_BINFS - struct fs_binfsdir_s binfs; -#endif -#ifdef CONFIG_FS_NXFFS - struct fs_nxffsdir_s nxffs; -#endif -#ifdef CONFIG_NFS - struct nfsdir_s nfs; -#endif -#endif /* !CONFIG_DISABLE_MOUNTPOINT */ - } u; - - /* In any event, this the actual struct dirent that is returned by readdir */ - - struct dirent fd_dir; /* Populated when readdir is called */ -}; - -/**************************************************************************** - * Global Variables - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_FS_DIRENT_H */ - diff --git a/nuttx/include/nuttx/fs/fat.h b/nuttx/include/nuttx/fs/fat.h deleted file mode 100644 index ac85c502f..000000000 --- a/nuttx/include/nuttx/fs/fat.h +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** - * include/nuttx/fs/fat.h - * - * Copyright (C) 2007-2009, 2012 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_NUTTX_FS_FAT_H -#define __INCLUDE_NUTTX_FS_FAT_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* File attribute bits in FAT directory entry */ - -#define FATATTR_READONLY 0x01 -#define FATATTR_HIDDEN 0x02 -#define FATATTR_SYSTEM 0x04 -#define FATATTR_VOLUMEID 0x08 -#define FATATTR_DIRECTORY 0x10 -#define FATATTR_ARCHIVE 0x20 - -#define FATATTR_LONGNAME \ - (FATATTR_READONLY|FATATTR_HIDDEN|FATATTR_SYSTEM|FATATTR_VOLUMEID) - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ - -typedef uint8_t fat_attrib_t; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: fat_getattrib and fat_setattrib - * - * Description: - * Non-standard functions to get and set FAT file/directory attributes - * - ****************************************************************************/ - -EXTERN int fat_getattrib(const char *path, fat_attrib_t *attrib); -EXTERN int fat_setattrib(const char *path, fat_attrib_t setbits, fat_attrib_t clearbits); - -/**************************************************************************** - * Name: fat_dma_alloc and fat_dma_free - * - * Description: - * The FAT file system allocates two I/O buffers for data transfer, each - * are the size of one device sector. One of the buffers is allocated - * once for each FAT volume that is mounted; the other buffers are - * allocated each time a FAT file is opened. - * - * Some hardware, however, may require special DMA-capable memory in - * order to perform the the transfers. If CONFIG_FAT_DMAMEMORY is defined - * then the architecture-specific hardware must provide the funtions - * fat_dma_alloc() and fat_dma_free() as prototyped below: fat_dma_alloc() - * will allocate DMA-capable memory of the specified size; fat_dma_free() - * is the corresponding function that will be called to free the DMA- - * capable memory. - * - * This functions may be simple wrappers around gran_alloc() and gran_free() - * (See nuttx/gran.h). - * - ****************************************************************************/ - -#ifdef CONFIG_FAT_DMAMEMORY -EXTERN FAR void *fat_dma_alloc(size_t size); -EXTERN void fat_dma_free(FAR void *memory, size_t size); -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_FS_FAT_H */ diff --git a/nuttx/include/nuttx/fs/fs.h b/nuttx/include/nuttx/fs/fs.h deleted file mode 100644 index 93ca2a334..000000000 --- a/nuttx/include/nuttx/fs/fs.h +++ /dev/null @@ -1,745 +0,0 @@ -/**************************************************************************** - * include/nuttx/fs/fs.h - * - * Copyright (C) 2007-2009, 2011-2013 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_NUTTX_FS_FS_H -#define __INCLUDE_NUTTX_FS_FS_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#include -#include -#include -#include - -/**************************************************************************** - * Definitions - ****************************************************************************/ -/* Stream flags for the fs_flags field of in struct file_struct */ - -#define __FS_FLAG_EOF (1 << 0) /* EOF detected by a read operation */ -#define __FS_FLAG_ERROR (1 << 1) /* Error detected by any operation */ - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ - -/* This structure is provided by devices when they are registered with the - * system. It is used to call back to perform device specific operations. - */ - -struct file; -struct pollfd; - -struct file_operations -{ - /* The device driver open method differs from the mountpoint open method */ - - int (*open)(FAR struct file *filp); - - /* The following methods must be identical in signature and position because - * the struct file_operations and struct mountp_operations are treated like - * unions. - */ - - int (*close)(FAR struct file *filp); - ssize_t (*read)(FAR struct file *filp, FAR char *buffer, size_t buflen); - ssize_t (*write)(FAR struct file *filp, FAR const char *buffer, size_t buflen); - off_t (*seek)(FAR struct file *filp, off_t offset, int whence); - int (*ioctl)(FAR struct file *filp, int cmd, unsigned long arg); -#ifndef CONFIG_DISABLE_POLL - int (*poll)(FAR struct file *filp, struct pollfd *fds, bool setup); -#endif - - /* The two structures need not be common after this point */ -}; - -/* This structure provides information about the state of a block driver */ - -#ifndef CONFIG_DISABLE_MOUNTPOUNT -struct geometry -{ - bool geo_available; /* true: The device is vailable */ - bool geo_mediachanged; /* true: The media has changed since last query */ - bool geo_writeenabled; /* true: It is okay to write to this device */ - size_t geo_nsectors; /* Number of sectors on the device */ - size_t geo_sectorsize; /* Size of one sector */ -}; - -/* This structure is provided by block devices when they register with the - * system. It is used by file systems to perform filesystem transfers. It - * differs from the normal driver vtable in several ways -- most notably in - * that it deals in struct inode vs. struct filep. - */ - -struct inode; -struct block_operations -{ - int (*open)(FAR struct inode *inode); - int (*close)(FAR struct inode *inode); - ssize_t (*read)(FAR struct inode *inode, FAR unsigned char *buffer, - size_t start_sector, unsigned int nsectors); - ssize_t (*write)(FAR struct inode *inode, FAR const unsigned char *buffer, - size_t start_sector, unsigned int nsectors); - int (*geometry)(FAR struct inode *inode, FAR struct geometry *geometry); - int (*ioctl)(FAR struct inode *inode, int cmd, unsigned long arg); -}; - -/* This structure is provided by a filesystem to describe a mount point. - * Note that this structure differs from file_operations ONLY in the form of - * the open method. Once the file is opened, it can be accessed either as a - * struct file_operations or struct mountpt_operations - */ - -struct inode; -struct fs_dirent_s; -struct stat; -struct statfs; -struct mountpt_operations -{ - /* The mountpoint open method differs from the driver open method - * because it receives (1) the inode that contains the mountpoint - * private data, (2) the relative path into the mountpoint, and (3) - * information to manage privileges. - */ - - int (*open)(FAR struct file *filp, FAR const char *relpath, - int oflags, mode_t mode); - - /* The following methods must be identical in signature and position because - * the struct file_operations and struct mountp_operations are treated like - * unions. - */ - - int (*close)(FAR struct file *filp); - ssize_t (*read)(FAR struct file *filp, FAR char *buffer, size_t buflen); - ssize_t (*write)(FAR struct file *filp, FAR const char *buffer, size_t buflen); - off_t (*seek)(FAR struct file *filp, off_t offset, int whence); - int (*ioctl)(FAR struct file *filp, int cmd, unsigned long arg); - - /* The two structures need not be common after this point. The following - * are extended methods needed to deal with the unique needs of mounted - * file systems. - * - * Additional open-file-specific mountpoint operations: - */ - - int (*sync)(FAR struct file *filp); - int (*dup)(FAR const struct file *oldp, FAR struct file *newp); - - /* Directory operations */ - - int (*opendir)(FAR struct inode *mountpt, FAR const char *relpath, FAR struct fs_dirent_s *dir); - int (*closedir)(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir); - int (*readdir)(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir); - int (*rewinddir)(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir); - - /* General volume-related mountpoint operations: */ - - int (*bind)(FAR struct inode *blkdriver, FAR const void *data, FAR void **handle); - int (*unbind)(FAR void *handle, FAR struct inode **blkdriver); - - int (*statfs)(FAR struct inode *mountpt, FAR struct statfs *buf); - - /* Operations on paths */ - - int (*unlink)(FAR struct inode *mountpt, FAR const char *relpath); - int (*mkdir)(FAR struct inode *mountpt, FAR const char *relpath, mode_t mode); - int (*rmdir)(FAR struct inode *mountpt, FAR const char *relpath); - int (*rename)(FAR struct inode *mountpt, FAR const char *oldrelpath, FAR const char *newrelpath); - int (*stat)(FAR struct inode *mountpt, FAR const char *relpath, FAR struct stat *buf); - - /* NOTE: More operations will be needed here to support: disk usage stats - * file stat(), file attributes, file truncation, etc. - */ -}; -#endif /* CONFIG_DISABLE_MOUNTPOUNT */ - -/* These are the various kinds of operations that can be associated with - * an inode. - */ - -union inode_ops_u -{ - FAR const struct file_operations *i_ops; /* Driver operations for inode */ -#ifndef CONFIG_DISABLE_MOUNTPOUNT - FAR const struct block_operations *i_bops; /* Block driver operations */ - FAR const struct mountpt_operations *i_mops; /* Operations on a mountpoint */ -#endif -}; - -/* This structure represents one inode in the Nuttx pseudo-file system */ - -struct inode -{ - FAR struct inode *i_peer; /* Pointer to same level inode */ - FAR struct inode *i_child; /* Pointer to lower level inode */ - int16_t i_crefs; /* References to inode */ - uint16_t i_flags; /* Flags for inode */ - union inode_ops_u u; /* Inode operations */ -#ifdef CONFIG_FILE_MODE - mode_t i_mode; /* Access mode flags */ -#endif - FAR void *i_private; /* Per inode driver private data */ - char i_name[1]; /* Name of inode (variable) */ -}; -#define FSNODE_SIZE(n) (sizeof(struct inode) + (n)) - -/* This is the underlying representation of an open file. A file - * descriptor is an index into an array of such types. The type associates - * the file descriptor to the file state and to a set of inode operations. - */ - -struct file -{ - int f_oflags; /* Open mode flags */ - off_t f_pos; /* File position */ - FAR struct inode *f_inode; /* Driver interface */ - void *f_priv; /* Per file driver private data */ -}; - -/* This defines a list of files indexed by the file descriptor */ - -#if CONFIG_NFILE_DESCRIPTORS > 0 -struct filelist -{ - sem_t fl_sem; /* Manage access to the file list */ - struct file fl_files[CONFIG_NFILE_DESCRIPTORS]; -}; -#endif - -/* The following structure defines the list of files used for standard C I/O. - * Note that NuttX can support the standard C APIs without or without buffering - * - * When buffering us used, the following described the usage of the I/O buffer. - * The buffer can be used for reading or writing -- but not both at the same time. - * An fflush is implied between each change in directionof access. - * - * The field fs_bufread determines whether the buffer is being used for reading or - * for writing as fillows: - * - * BUFFER - * +----------------------+ <- fs_bufstart Points to the beginning of the buffer. - * | WR: Buffered data | WR: Start of buffered write data. - * | RD: Already read | RD: Start of already read data. - * +----------------------+ - * | WR: Available buffer | <- fs_bufpos Points to next byte: - * | RD: Read-ahead data | WR: End+1 of buffered write data. - * | | RD: Points to next char to return - * +----------------------+ - * | WR: Available | <- fs_bufread Top+1 of buffered read data - * | RD: Available | WR: =bufstart buffer used for writing. - * | | RD: Pointer to last buffered read char+1 - * +----------------------+ - * <- fs_bufend Points to end end of the buffer+1 - */ - -#if CONFIG_NFILE_STREAMS > 0 -struct file_struct -{ - int fs_filedes; /* File descriptor associated with stream */ -#if CONFIG_STDIO_BUFFER_SIZE > 0 - sem_t fs_sem; /* For thread safety */ - pid_t fs_holder; /* Holder of sem */ - int fs_counts; /* Number of times sem is held */ - FAR unsigned char *fs_bufstart; /* Pointer to start of buffer */ - FAR unsigned char *fs_bufend; /* Pointer to 1 past end of buffer */ - FAR unsigned char *fs_bufpos; /* Current position in buffer */ - FAR unsigned char *fs_bufread; /* Pointer to 1 past last buffered read char. */ -#endif - uint16_t fs_oflags; /* Open mode flags */ - uint8_t fs_flags; /* Stream flags */ -#if CONFIG_NUNGET_CHARS > 0 - uint8_t fs_nungotten; /* The number of characters buffered for ungetc */ - unsigned char fs_ungotten[CONFIG_NUNGET_CHARS]; -#endif -}; - -struct streamlist -{ - sem_t sl_sem; /* For thread safety */ - struct file_struct sl_streams[CONFIG_NFILE_STREAMS]; -}; -#endif /* CONFIG_NFILE_STREAMS */ - -/* Callback used by foreach_mountpoints to traverse all mountpoints in the - * pseudo-file system. - */ - -#ifndef CONFIG_DISABLE_MOUNTPOUNT -struct statfs; /* Forward reference */ -typedef int (*foreach_mountpoint_t)(FAR const char *mountpoint, - FAR struct statfs *statbuf, - FAR void *arg); -#endif - -/**************************************************************************** - * Global Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" -{ -#else -#define EXTERN extern -#endif - -/* fs_inode.c ***************************************************************/ -/**************************************************************************** - * Name: fs_initialize - * - * Description: - * This is called from the OS initialization logic to configure the file - * system. - * - ****************************************************************************/ - -void weak_function fs_initialize(void); - -/* fs_foreachmountpoint.c ***************************************************/ -/**************************************************************************** - * Name: foreach_mountpoint - * - * Description: - * Visit each mountpoint in the pseudo-file system. The traversal is - * terminated when the callback 'handler' returns a non-zero value, or when - * all of the mountpoints have been visited. - * - * This is just a front end "filter" to foreach_inode() that forwards only - * mountpoint inodes. It is intended to support the mount() command to - * when the mount command is used to enumerate mounts. - * - * NOTE 1: Use with caution... The pseudo-file system is locked throughout - * the traversal. - * NOTE 2: The search algorithm is recursive and could, in principle, use - * an indeterminant amount of stack space. This will not usually be a - * real work issue. - * - ****************************************************************************/ - -#ifndef CONFIG_DISABLE_MOUNTPOUNT -int foreach_mountpoint(foreach_mountpoint_t handler, FAR void *arg); -#endif - -/* fs_registerdriver.c ******************************************************/ -/**************************************************************************** - * Name: register_driver - * - * Description: - * Register a character driver inode the pseudo file system. - * - * Input parameters: - * path - The path to the inode to create - * fops - The file operations structure - * mode - inmode priviledges (not used) - * priv - Private, user data that will be associated with the inode. - * - * Returned Value: - * Zero on success (with the inode point in 'inode'); A negated errno - * value is returned on a failure (all error values returned by - * inode_reserve): - * - * EINVAL - 'path' is invalid for this operation - * EEXIST - An inode already exists at 'path' - * ENOMEM - Failed to allocate in-memory resources for the operation - * - ****************************************************************************/ - -int register_driver(FAR const char *path, FAR const struct file_operations *fops, - mode_t mode, FAR void *priv); - -/* fs_registerblockdriver.c *************************************************/ -/**************************************************************************** - * Name: register_blockdriver - * - * Description: - * Register a block driver inode the pseudo file system. - * - * Input parameters: - * path - The path to the inode to create - * bops - The block driver operations structure - * mode - inmode priviledges (not used) - * priv - Private, user data that will be associated with the inode. - * - * Returned Value: - * Zero on success (with the inode point in 'inode'); A negated errno - * value is returned on a failure (all error values returned by - * inode_reserve): - * - * EINVAL - 'path' is invalid for this operation - * EEXIST - An inode already exists at 'path' - * ENOMEM - Failed to allocate in-memory resources for the operation - * - ****************************************************************************/ - -int register_blockdriver(FAR const char *path, - FAR const struct block_operations *bops, mode_t mode, - FAR void *priv); - -/* fs_unregisterdriver.c ****************************************************/ -/**************************************************************************** - * Name: unregister_driver - * - * Description: - * Remove the character driver inode at 'path' from the pseudo-file system - * - ****************************************************************************/ - -int unregister_driver(const char *path); - -/* fs_unregisterblockdriver.c ***********************************************/ -/**************************************************************************** - * Name: unregister_blockdriver - * - * Description: - * Remove the block driver inode at 'path' from the pseudo-file system - * - ****************************************************************************/ - -int unregister_blockdriver(const char *path); - -/* fs_open.c ****************************************************************/ -/**************************************************************************** - * Name: inode_checkflags - * - * Description: - * Check if the access described by 'oflags' is supported on 'inode' - * - ****************************************************************************/ - -int inode_checkflags(FAR struct inode *inode, int oflags); - -/* fs_files.c ***************************************************************/ -/**************************************************************************** - * Name: files_initlist - * - * Description: - * Initializes the list of files for a new task - * - ****************************************************************************/ - -#if CONFIG_NFILE_DESCRIPTORS > 0 -void files_initlist(FAR struct filelist *list); -#endif - -/**************************************************************************** - * Name: files_releaselist - * - * Description: - * Release a reference to the file list - * - ****************************************************************************/ - -#if CONFIG_NFILE_DESCRIPTORS > 0 -void files_releaselist(FAR struct filelist *list); -#endif - -/**************************************************************************** - * Name: files_dup - * - * Description: - * Assign an inode to a specific files structure. This is the heart of - * dup2. - * - ****************************************************************************/ - -#if CONFIG_NFILE_DESCRIPTORS > 0 -int files_dup(FAR struct file *filep1, FAR struct file *filep2); -#endif - -/* fs_filedup.c *************************************************************/ -/**************************************************************************** - * Name: file_dup OR dup - * - * Description: - * Clone a file descriptor 'fd' to an arbitray descriptor number (any value - * greater than or equal to 'minfd'). If socket descriptors are - * implemented, then this is called by dup() for the case of file - * descriptors. If socket descriptors are not implemented, then this - * function IS dup(). - * - * This alternative naming is used when dup could operate on both file and - * socket descritors to avoid drawing unused socket support into the link. - * - ****************************************************************************/ - -#if CONFIG_NFILE_DESCRIPTORS > 0 -int file_dup(int fd, int minfd); -#endif - -/* fs_filedup2.c ************************************************************/ -/**************************************************************************** - * Name: file_dup2 OR dup2 - * - * Description: - * Clone a file descriptor to a specific descriptor number. If socket - * descriptors are implemented, then this is called by dup2() for the - * case of file descriptors. If socket descriptors are not implemented, - * then this function IS dup2(). - * - * This alternative naming is used when dup2 could operate on both file and - * socket descritors to avoid drawing unused socket support into the link. - * - ****************************************************************************/ - -#if CONFIG_NFILE_DESCRIPTORS > 0 -#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 -int file_dup2(int fd1, int fd2); -#else -# define file_dup2(fd1, fd2) dup2(fd1, fd2) -#endif -#endif - -/* fs_openblockdriver.c *****************************************************/ -/**************************************************************************** - * Name: open_blockdriver - * - * Description: - * Return the inode of the block driver specified by 'pathname' - * - * Inputs: - * pathname - the full path to the block driver to be opened - * mountflags - if MS_RDONLY is not set, then driver must support write - * operations (see include/sys/mount.h) - * ppinode - address of the location to return the inode reference - * - * Return: - * Returns zero on success or a negated errno on failure: - * - * EINVAL - pathname or pinode is NULL - * ENOENT - No block driver of this name is registered - * ENOTBLK - The inode associated with the pathname is not a block driver - * EACCESS - The MS_RDONLY option was not set but this driver does not - * support write access - * - ****************************************************************************/ - -#if CONFIG_NFILE_DESCRIPTORS > 0 -int open_blockdriver(FAR const char *pathname, int mountflags, - FAR struct inode **ppinode); -#endif - -/* fs_closeblockdriver.c ****************************************************/ -/**************************************************************************** - * Name: close_blockdriver - * - * Description: - * Call the close method and release the inode - * - * Inputs: - * inode - reference to the inode of a block driver opened by open_blockdriver - * - * Return: - * Returns zero on success or a negated errno on failure: - * - * EINVAL - inode is NULL - * ENOTBLK - The inode is not a block driver - * - ****************************************************************************/ - -#if CONFIG_NFILE_DESCRIPTORS > 0 -int close_blockdriver(FAR struct inode *inode); -#endif - -/* fs_fdopen.c **************************************************************/ -/**************************************************************************** - * Name: fs_fdopen - * - * Description: - * This function does the core operations for fopen and fdopen. It is - * used by the OS to clone stdin, stdout, stderr - * - ****************************************************************************/ - -#if CONFIG_NFILE_STREAMS > 0 - -#ifndef __TCB_DEFINED__ -typedef struct _TCB _TCB; -#define __TCB_DEFINED__ -#endif - -FAR struct file_struct *fs_fdopen(int fd, int oflags, FAR _TCB *tcb); -#endif - -/* lib/stdio/lib_fflush.c **************************************************/ -/**************************************************************************** - * Name: lib_flushall - * - * Description: - * Called either (1) by the OS when a task exits, or (2) from fflush() - * when a NULL stream argument is provided. - * - ****************************************************************************/ - -#if CONFIG_NFILE_STREAMS > 0 -int lib_flushall(FAR struct streamlist *list); -#endif - -/* drivers/dev_null.c *******************************************************/ -/**************************************************************************** - * Name: devnull_register - * - * Description: - * Register /dev/null - * - ****************************************************************************/ - -void devnull_register(void); - -/* drivers/dev_zero.c *******************************************************/ -/**************************************************************************** - * Name: devzero_register - * - * Description: - * Register /dev/zero - * - ****************************************************************************/ - -void devzero_register(void); - -/* drivers/loop.c ***********************************************************/ -/**************************************************************************** - * Name: losetup - * - * Description: - * Setup the loop device so that it exports the file referenced by 'filename' - * as a block device. - * - ****************************************************************************/ - -int losetup(FAR const char *devname, FAR const char *filename, - uint16_t sectsize, off_t offset, bool readonly); - -/**************************************************************************** - * Name: loteardown - * - * Description: - * Undo the setup performed by losetup - * - ****************************************************************************/ - -int loteardown(FAR const char *devname); - -/* drivers/bch/bchdev_register.c ********************************************/ -/**************************************************************************** - * Name: bchdev_register - * - * Description: - * Setup so that it exports the block driver referenced by 'blkdev' as a - * character device 'chardev' - * - ****************************************************************************/ - -int bchdev_register(FAR const char *blkdev, FAR const char *chardev, - bool readonly); - -/* drivers/bch/bchdev_unregister.c ******************************************/ -/**************************************************************************** - * Name: bchdev_unregister - * - * Description: - * Unregister character driver access to a block device that was created - * by a previous call to bchdev_register(). - * - ****************************************************************************/ - -int bchdev_unregister(FAR const char *chardev); - -/* Low level, direct access. NOTE: low-level access and character driver access - * are incompatible. One and only one access method should be implemented. - */ - -/* drivers/bch/bchlib_setup.c ***********************************************/ -/**************************************************************************** - * Name: bchlib_setup - * - * Description: - * Setup so that the block driver referenced by 'blkdev' can be accessed - * similar to a character device. - * - ****************************************************************************/ - -int bchlib_setup(FAR const char *blkdev, bool readonly, FAR void **handle); - -/* drivers/bch/bchlib_teardown.c ********************************************/ -/**************************************************************************** - * Name: bchlib_teardown - * - * Description: - * Setup so that the block driver referenced by 'blkdev' can be accessed - * similar to a character device. - * - ****************************************************************************/ - -int bchlib_teardown(FAR void *handle); - -/* drivers/bch/bchlib_read.c ************************************************/ -/**************************************************************************** - * Name: bchlib_read - * - * Description: - * Read from the block device set-up by bchlib_setup as if it were a - * character device. - * - ****************************************************************************/ - -ssize_t bchlib_read(FAR void *handle, FAR char *buffer, size_t offset, - size_t len); - -/* drivers/bch/bchlib_write.c ***********************************************/ -/**************************************************************************** - * Name: bchlib_write - * - * Description: - * Write to the block device set-up by bchlib_setup as if it were a - * character device. - * - ****************************************************************************/ - -ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, size_t offset, - size_t len); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_FS_FS_H */ diff --git a/nuttx/include/nuttx/fs/ioctl.h b/nuttx/include/nuttx/fs/ioctl.h deleted file mode 100644 index a15de03b9..000000000 --- a/nuttx/include/nuttx/fs/ioctl.h +++ /dev/null @@ -1,234 +0,0 @@ -/**************************************************************************** - * include/nuttx/fs/ioctl.h - * - * Copyright (C) 2008, 2009, 2011-2012 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_NUTTX_FS_IOCTL_H -#define __INCLUDE_NUTTX_FS_IOCTL_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* General ioctl definitions ************************************************/ -/* Each NuttX ioctl commands are uint16_t's consisting of an 8-bit type - * identifier and an 8-bit command number. All comman type identifiers are - * defined below: - */ - -#define _TIOCBASE (0x0100) /* Terminal I/O ioctl commands */ -#define _WDIOCBASE (0x0200) /* Watchdog driver ioctl commands */ -#define _FIOCBASE (0x0300) /* File system ioctl commands */ -#define _DIOCBASE (0x0400) /* Character driver ioctl commands */ -#define _BIOCBASE (0x0500) /* Block driver ioctl commands */ -#define _MTDIOCBASE (0x0600) /* MTD ioctl commands */ -#define _SIOCBASE (0x0700) /* Socket ioctl commands */ -#define _ARPIOCBASE (0x0800) /* ARP ioctl commands */ -#define _TSIOCBASE (0x0900) /* Touchscreen ioctl commands */ -#define _SNIOCBASE (0x0a00) /* Sensor ioctl commands */ -#define _ANIOCBASE (0x0b00) /* Analog (DAC/ADC) ioctl commands */ -#define _PWMIOCBASE (0x0c00) /* PWM ioctl commands */ -#define _CAIOCBASE (0x0d00) /* CDC/ACM ioctl commands */ -#define _BATIOCBASE (0x0e00) /* Battery driver ioctl commands */ -#define _QEIOCBASE (0x0f00) /* Quadrature encoder ioctl commands */ - -/* Macros used to manage ioctl commands */ - -#define _IOC_MASK (0x00ff) -#define _IOC_TYPE(cmd) ((cmd)&~_IOC_MASK) -#define _IOC_NR(cmd) ((cmd)&_IOC_MASK) - -#define _IOC(type,nr) ((type)|(nr)) - -/* Terminal I/O ioctl commands **********************************************/ - -#define _TIOCVALID(c) (_IOC_TYPE(c)==_TIOCBASE) -#define _TIOC(nr) _IOC(_TIOCBASE,nr) - -/* Terminal I/O IOCTL definitions are retained in tioctl.h */ - -#include - -/* Watchdog driver ioctl commands *******************************************/ - -#define _WDIOCVALID(c) (_IOC_TYPE(c)==_WDIOCBASE) -#define _WDIOC(nr) _IOC(_WDIOCBASE,nr) - -/* NuttX file system ioctl definitions **************************************/ - -#define _FIOCVALID(c) (_IOC_TYPE(c)==_FIOCBASE) -#define _FIOC(nr) _IOC(_FIOCBASE,nr) - -#define FIOC_MMAP _FIOC(0x0001) /* IN: Location to return address (void **) - * OUT: If media is directly acccesible, - * return (void*) base address - * of file - */ -#define FIOC_REFORMAT _FIOC(0x0002) /* IN: None - * OUT: None - */ -#define FIOC_OPTIMIZE _FIOC(0x0003) /* IN: None - * OUT: None - */ -#define FIOC_FILENAME _FIOC(0x0004) /* IN: FAR const char ** pointer - * OUT: Pointer to a persistent file name - * (Guaranteed to persist while the file - * is open). - */ - -#define FIONREAD _FIOC(0x0004) /* IN: Location to return value (int *) - * OUT: Bytes readable from this fd - */ - -#define FIONWRITE _FIOC(0x0005) /* IN: Location to return value (int *) - * OUT: Bytes writable to this fd - */ - -/* NuttX file system ioctl definitions **************************************/ - -#define _DIOCVALID(c) (_IOC_TYPE(c)==_DIOCBASE) -#define _DIOC(nr) _IOC(_DIOCBASE,nr) - -#define DIOC_GETPRIV _DIOC(0x0001) /* IN: Location to return handle (void **) - * OUT: Reference to internal data - * structure. May have a reference - * incremented. - */ -#define DIOC_RELPRIV _DIOC(0x0003) /* IN: None - * OUT: None, reference obtained by - * FIOC_GETPRIV released. - */ - -/* NuttX block driver ioctl definitions *************************************/ - -#define _BIOCVALID(c) (_IOC_TYPE(c)==_BIOCBASE) -#define _BIOC(nr) _IOC(_BIOCBASE,nr) - -#define BIOC_XIPBASE _BIOC(0x0001) /* Perform mapping to random access memory. - * IN: Pointer to pointer to void in - * which to received the XIP base. - * OUT: If media is directly acccesible, - * return (void*) base address - * of device memory */ -#define BIOC_PROBE _BIOC(0x0002) /* Re-probe and interface; check for media - * in the slot - * IN: None - * OUT: None (ioctl return value provides - * success/failure indication). */ -#define BIOC_EJECT _BIOC(0x0003) /* Eject/disable media in the slot - * IN: None - * OUT: None (ioctl return value provides - * success/failure indication). */ - -/* NuttX MTD driver ioctl definitions ***************************************/ - -#define _MTDIOCVALID(c) (_IOC_TYPE(c)==_MTDIOCBASE) -#define _MTDIOC(nr) _IOC(_MTDIOCBASE,nr) - -#define MTDIOC_GEOMETRY _MTDIOC(0x0001) /* IN: Pointer to write-able struct - * mtd_geometry_s in which to receive - * receive geometry data (see mtd.h) - * OUT: Geometry structure is populated - * with data for the MTD */ -#define MTDIOC_XIPBASE _MTDIOC(0x0002) /* IN: Pointer to pointer to void in - * which to received the XIP base. - * OUT: If media is directly acccesible, - * return (void*) base address - * of device memory */ -#define MTDIOC_BULKERASE _MTDIOC(0x0003) /* IN: None - * OUT: None */ - -/* NuttX ARP driver ioctl definitions (see netinet/arp.h) *******************/ - -#define _ARPIOCVALID(c) (_IOC_TYPE(c)==_ARPIOCBASE) -#define _ARPIOC(nr) _IOC(_ARPIOCBASE,nr) - -/* NuttX touchscreen ioctl definitions (see nuttx/input/touchscreen.h) ******/ - -#define _TSIOCVALID(c) (_IOC_TYPE(c)==_TSIOCBASE) -#define _TSIOC(nr) _IOC(_TSIOCBASE,nr) - -/* NuttX sensor ioctl definitions (see nuttx/sensor/xxx.h) ******************/ - -#define _SNIOCVALID(c) (_IOC_TYPE(c)==_SNIOCBASE) -#define _SNIOC(nr) _IOC(_SNIOCBASE,nr) - -/* NuttX PWM ioctl definitions (see nuttx/pwm.h) ***************************/ - -#define _PWMIOCVALID(c) (_IOC_TYPE(c)==_PWMIOCBASE) -#define _PWMIOC(nr) _IOC(_PWMIOCBASE,nr) - -/* NuttX USB CDC/ACM serial driver ioctl definitions ************************/ -/* (see nuttx/usb/cdcacm.h) */ - -#define _CAIOCVALID(c) (_IOC_TYPE(c)==_CAIOCBASE) -#define _CAIOC(nr) _IOC(_CAIOCBASE,nr) - -/* NuttX USB CDC/ACM serial driver ioctl definitions ************************/ -/* (see nuttx/power/battery.h) */ - -#define _BATIOCVALID(c) (_IOC_TYPE(c)==_BATIOCBASE) -#define _BATIOC(nr) _IOC(_BATIOCBASE,nr) - -/* NuttX Quadrature Encoder driver ioctol definitions ***********************/ -/* (see nuttx/power/battery.h) */ - -#define _QEIOCVALID(c) (_IOC_TYPE(c)==_QEIOCBASE) -#define _QEIOC(nr) _IOC(_QEIOCBASE,nr) - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_FS_IOCTL_H */ diff --git a/nuttx/include/nuttx/fs/mkfatfs.h b/nuttx/include/nuttx/fs/mkfatfs.h deleted file mode 100644 index ccf5b7603..000000000 --- a/nuttx/include/nuttx/fs/mkfatfs.h +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** - * include/nuttx/fs/mkfatfs.h - * - * Copyright (C) 2008-2009, 2012 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_NUTTX_FS_MKFATFS_H -#define __INCLUDE_NUTTX_FS_MKFATFS_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define MKFATFS_DEFAULT_NFATS 2 /* 2: Default number of FATs */ -#define MKFATFS_DEFAULT_FATTYPE 0 /* 0: Autoselect FAT size */ -#define MKFATFS_DEFAULT_CLUSTSHIFT 0xff /* 0xff: Autoselect cluster size */ -#define MKFATFS_DEFAULT_VOLUMELABEL { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } -#define MKFATFS_DEFAULT_BKUPBOOT 0 /* 0: Determine sector number of the backup boot sector */ -#define MKFATFS_DEFAULT_ROOTDIRENTS 0 /* 0: Autoselect number of root directory entries */ -#define MKFATFS_DEFAULT_RSVDSECCOUNT 0 /* 0: Autoselect number reserved sectors (usually 32) */ -#define MKFATFS_DEFAULT_HIDSEC 0 /* No hidden sectors */ -#define MKFATFS_DEFAULT_VOLUMEID 0 /* No volume ID */ -#define MKFATFS_DEFAULT_NSECTORS 0 /* 0: Use all sectors on device */ - -#define FAT_FORMAT_INITIALIZER \ -{ \ - MKFATFS_DEFAULT_NFATS, \ - MKFATFS_DEFAULT_FATTYPE, \ - MKFATFS_DEFAULT_CLUSTSHIFT, \ - MKFATFS_DEFAULT_VOLUMELABEL, \ - MKFATFS_DEFAULT_BKUPBOOT, \ - MKFATFS_DEFAULT_ROOTDIRENTS, \ - MKFATFS_DEFAULT_RSVDSECCOUNT, \ - MKFATFS_DEFAULT_HIDSEC, \ - MKFATFS_DEFAULT_VOLUMEID, \ - MKFATFS_DEFAULT_NSECTORS \ -} - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* These are input parameters for the format. On return, these values may be - * overwritted with actual values used in the format. - */ - -struct fat_format_s -{ - uint8_t ff_nfats; /* Number of FATs */ - uint8_t ff_fattype; /* FAT size: 0 (autoselect), 12, 16, or 32 */ - uint8_t ff_clustshift; /* Log2 of sectors per cluster: 0-5, 0xff (autoselect) */ - uint8_t ff_volumelabel[11]; /* Volume label */ - uint16_t ff_backupboot; /* Sector number of the backup boot sector (0=use default)*/ - uint16_t ff_rootdirentries; /* Number of root directory entries */ - uint16_t ff_rsvdseccount; /* Reserved sectors */ - uint32_t ff_hidsec; /* Count of hidden sectors preceding fat */ - uint32_t ff_volumeid; /* FAT volume id */ - uint32_t ff_nsectors; /* Number of sectors from device to use: 0: Use all */ -}; - -/**************************************************************************** - * Global Variables - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: mkfatfs - * - * Description: - * Make a FAT file system image on the specified block device - * - * Inputs: - * pathname - the full path to a registered block driver - * fmt - Describes characteristics of the desired filesystem - * - * Return: - * Zero (OK) on success; -1 (ERROR) on failure with errno set appropriately: - * - * EINVAL - NULL block driver string, bad number of FATS in 'fmt', bad FAT - * size in 'fmt', bad cluster size in 'fmt' - * ENOENT - 'pathname' does not refer to anything in the filesystem. - * ENOTBLK - 'pathname' does not refer to a block driver - * EACCESS - block driver does not support write or geometry methods - * - * Assumptions: - * - The caller must assure that the block driver is not mounted and not in - * use when this function is called. The result of formatting a mounted - * device is indeterminate (but likely not good). - * - ****************************************************************************/ -EXTERN int mkfatfs(FAR const char *pathname, FAR struct fat_format_s *fmt); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_FS_MKFATFS_H */ diff --git a/nuttx/include/nuttx/fs/nfs.h b/nuttx/include/nuttx/fs/nfs.h deleted file mode 100644 index 31f97bd63..000000000 --- a/nuttx/include/nuttx/fs/nfs.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** - * include/nuttx/fs/nfs.h - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved. - * Author: Jose Pablo Rojas Vargas - * - * Some of the content of this file was leveraged from OpenBSD: - * - * Copyright (c) 1989, 1993, 1995 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Rick Macklem at The University of Guelph. - * - * 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 University 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 REGENTS 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 REGENTS 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_NUTTX_FS_NFS_H -#define __INCLUDE_NUTTX_FS_NFS_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* NFS mount option flags */ - -#define NFSMNT_SOFT (1 << 0) /* Soft mount (hard is default) */ -#define NFSMNT_WSIZE (1 << 1) /* Set write size */ -#define NFSMNT_RSIZE (1 << 2) /* Set read size */ -#define NFSMNT_TIMEO (1 << 3) /* Set initial timeout */ -#define NFSMNT_RETRANS (1 << 4) /* Set number of request retries */ -#define NFSMNT_READDIRSIZE (1 << 5) /* Set readdir size */ - -/* Default PMAP port number to provide */ - -#define NFS_PMAPPORT 111 - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -struct nfs_args -{ - uint8_t addrlen; /* Length of address */ - uint8_t sotype; /* Socket type */ - uint8_t flags; /* Flags, determines if following are valid: */ - uint8_t timeo; /* Time value in deciseconds (with NFSMNT_TIMEO) */ - uint8_t retrans; /* Times to retry send (with NFSMNT_RETRANS) */ - uint16_t wsize; /* Write size in bytes (with NFSMNT_WSIZE) */ - uint16_t rsize; /* Read size in bytes (with NFSMNT_RSIZE) */ - uint16_t readdirsize; /* readdir size in bytes (with NFSMNT_READDIRSIZE) */ - char *path; /* Server's path of the directory being mount */ - struct sockaddr_storage addr; /* File server address (requires 32-bit alignment) */ -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* _NFS_NFS_H */ diff --git a/nuttx/include/nuttx/fs/nxffs.h b/nuttx/include/nuttx/fs/nxffs.h deleted file mode 100644 index 79c5b1d94..000000000 --- a/nuttx/include/nuttx/fs/nxffs.h +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** - * include/nuttx/fs/nxffs.h - * - * Copyright (C) 2011-2012 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_NUTTX_FS_NXFFS_H -#define __INCLUDE_NUTTX_FS_NXFFS_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* If the erased state of FLASH memory is anything other than 0xff, then this - * configuration should be provided. - */ - -#ifndef CONFIG_NXFFS_ERASEDSTATE -# define CONFIG_NXFFS_ERASEDSTATE 0xff -#endif - -#if CONFIG_NXFFS_ERASEDSTATE != 0xff && CONFIG_NXFFS_ERASEDSTATE != 0x00 -# error "CONFIG_NXFFS_ERASEDSTATE must be either 0x00 or 0xff" -#endif - -/* Don't bother trying to pack things closer together than this. */ - -#ifndef CONFIG_NXFFS_PACKTHRESHOLD -# define CONFIG_NXFFS_PACKTHRESHOLD 32 -#endif - -/* This is how big an inode name is permitted to be. */ - -#ifndef CONFIG_NXFFS_MAXNAMLEN -# define CONFIG_NXFFS_MAXNAMLEN 255 -#endif - -/* Clean-up can either mean packing files together toward the end of the file - * or, if file are deleted at the end of the file, clean up can simply mean - * erasing the end of FLASH memory so that it can be re-used again. However, - * doing this can also harm the life of the FLASH part because it can mean - * that the tail end of the FLASH is re-used too often. - * - * This threshold determines if/when it is worth erased the tail end of FLASH - * and making it available for re-use (and possible over-wear). - */ - -#ifndef CONFIG_NXFFS_TAILTHRESHOLD -# define CONFIG_NXFFS_TAILTHRESHOLD (8*1024) -#endif - -/* At present, only a single pre-allocated NXFFS volume is supported. This - * is because here can be only a single NXFFS volume mounted at any time. - * This has to do with the fact that we bind to an MTD driver (instead of a - * block driver) and bypass all of the normal mount operations. - */ - -#undef CONFIG_NXFSS_PREALLOCATED -#define CONFIG_NXFSS_PREALLOCATED 1 - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: nxffs_initialize - * - * Description: - * Initialize to provide NXFFS on an MTD interface - * - * Input Parameters: - * mtd - The MTD device that supports the FLASH interface. - * - * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is - * returned to indicate the nature of the failure. - * - ****************************************************************************/ - -EXTERN int nxffs_initialize(FAR struct mtd_dev_s *mtd); - -/**************************************************************************** - * Name: nxffs_dump - * - * Description: - * Dump a summary of the contents of an NXFFS file system. CONFIG_DEBUG - * and CONFIG_DEBUG_FS must be enabled for this function to do anything. - * - * Input Parameters: - * mtd - The MTD device that provides the interface to NXFFS-formatted - * media. - * verbose - FALSE: only show errors - * - * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is - * returned to indicate the nature of the failure. - * - ****************************************************************************/ - -EXTERN int nxffs_dump(FAR struct mtd_dev_s *mtd, bool verbose); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_FS_NXFFS_H */ diff --git a/nuttx/include/nuttx/gran.h b/nuttx/include/nuttx/gran.h deleted file mode 100644 index 5e980dd9c..000000000 --- a/nuttx/include/nuttx/gran.h +++ /dev/null @@ -1,202 +0,0 @@ -/**************************************************************************** - * include/nuttx/gran.h - * General purpose granule memory allocator. - * - * Copyright (C) 2012 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_NUTTX_GRAN_H -#define __INCLUDE_NUTTX_GRAN_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -#ifdef CONFIG_GRAN - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* CONFIG_GRAN - Enable granual allocator support - * CONFIG_GRAN_SINGLE - Select if there is only one instance of the - * granule allocator (i.e., gran_initialize will be called only once. - * In this case, (1) there are a few optimizations that can can be done - * and (2) the GRAN_HANDLE is not needed. - * CONFIG_GRAN_INTR - Normally mutual exclusive access to granule allocator - * data is assured using a semaphore. If this option is set then, instead, - * mutual exclusion logic will disable interrupts. While this options is - * more invasive to system performance, it will also support use of the - * granule allocator from interrupt level logic. - * CONFIG_DEBUG_GRAN - Just like CONFIG_DEBUG_MM, but only generates ouput - * from the gran allocation logic. - */ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -#ifndef CONFIG_GRAN_SINGLE -typedef FAR void *GRAN_HANDLE; -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: gran_initialize - * - * Description: - * Set up one granule allocator instance. Allocations will be aligned to - * the alignment size (log2align; allocations will be in units of the - * granule size (log2gran). Larger granules will give better performance - * and less overhead but more losses of memory due to quantization waste. - * Additional memory waste can occur from alignment; log2align should be - * set to 0 unless you are using the granule allocator to manage DMA memory - * and your hardware has specific memory alignment requirements. - * - * Geneneral Usage Summary. This is an example using the GCC section - * attribute to position a DMA heap in memory (logic in the linker script - * would assign the section .dmaheap to the DMA memory. - * - * FAR uint32_t g_dmaheap[DMAHEAP_SIZE] __attribute__((section(.dmaheap))); - * - * The heap is created by calling gran_initialize. Here the granual size - * is set to 64 bytes and the alignment to 16 bytes: - * - * GRAN_HANDLE handle = gran_initialize(g_dmaheap, DMAHEAP_SIZE, 6, 4); - * - * Then the GRAN_HANDLE can be used to allocate memory (There is no - * GRAN_HANDLE if CONFIG_GRAN_SINGLE=y): - * - * FAR uint8_t *dma_memory = (FAR uint8_t *)gran_alloc(handle, 47); - * - * The actual memory allocates will be 64 byte (wasting 17 bytes) and - * will be aligned at least to (1 << log2align). - * - * NOTE: The current implementation also restricts the maximum allocation - * size to 32 granules. That restriction could be eliminated with some - * additional coding effort. - * - * Input Parameters: - * heapstart - Start of the granule allocation heap - * heapsize - Size of heap in bytes - * log2gran - Log base 2 of the size of one granule. 0->1 byte, - * 1->2 bytes, 2->4 bytes, 3-> 8 bytes, etc. - * log2align - Log base 2 of required alignment. 0->1 byte, - * 1->2 bytes, 2->4 bytes, 3-> 8 bytes, etc. Note that - * log2gran must be greater than or equal to log2align - * so that all contiguous granules in memory will meet - * the minimum alignment requirement. A value of zero - * would mean that no alignment is required. - * - * Returned Value: - * On success, a non-NULL handle is returned that may be used with other - * granual allocator interfaces. - * - ****************************************************************************/ - -#ifdef CONFIG_GRAN_SINGLE -EXTERN int gran_initialize(FAR void *heapstart, size_t heapsize, - uint8_t log2gran, uint8_t log2align); -#else -EXTERN GRAN_HANDLE gran_initialize(FAR void *heapstart, size_t heapsize, - uint8_t log2gran, uint8_t log2align); -#endif - -/**************************************************************************** - * Name: gran_alloc - * - * Description: - * Allocate memory from the granule heap. - * - * NOTE: The current implementation also restricts the maximum allocation - * size to 32 granules. That restriction could be eliminated with some - * additional coding effort. - * - * Input Parameters: - * handle - The handle previously returned by gran_initialize - * size - The size of the memory region to allocate. - * - * Returned Value: - * On success, either a non-NULL pointer to the allocated memory (if - * CONFIG_GRAN_SINGLE) or zero (if !CONFIG_GRAN_SINGLE) is returned. - * - ****************************************************************************/ - -#ifdef CONFIG_GRAN_SINGLE -EXTERN FAR void *gran_alloc(size_t size); -#else -EXTERN FAR void *gran_alloc(GRAN_HANDLE handle, size_t size); -#endif - -/**************************************************************************** - * Name: gran_free - * - * Description: - * Return memory to the granule heap. - * - * Input Parameters: - * handle - The handle previously returned by gran_initialize - * memory - A pointer to memory previoiusly allocated by gran_alloc. - * - * Returned Value: - * None - * - ****************************************************************************/ - -#ifdef CONFIG_GRAN_SINGLE -EXTERN void gran_free(FAR void *memory, size_t size); -#else -EXTERN void gran_free(GRAN_HANDLE handle, FAR void *memory, size_t size); -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_GRAN */ -#endif /* __INCLUDE_NUTTX_GRAN_H */ diff --git a/nuttx/include/nuttx/i2c.h b/nuttx/include/nuttx/i2c.h deleted file mode 100644 index 23356ecd3..000000000 --- a/nuttx/include/nuttx/i2c.h +++ /dev/null @@ -1,354 +0,0 @@ -/**************************************************************************** - * include/nuttx/i2c.h - * - * Copyright(C) 2009-2012 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_NUTTX_I2C_H -#define __INCLUDE_NUTTX_I2C_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ -/* If a dynamic timeout is selected, then a non-negative, non-zero micro- - * seconds per byte vale must be provided as well. - */ - -#ifdef CONFIG_STM32_I2C_DYNTIMEO -# if CONFIG_STM32_I2C_DYNTIMEO_USECPERBYTE < 1 -# warning "Ignoring CONFIG_STM32_I2C_DYNTIMEO because of CONFIG_STM32_I2C_DYNTIMEO_USECPERBYTE" -# undef CONFIG_STM32_I2C_DYNTIMEO -# endif -#endif - -/* I2C address calculation. Convert 7- and 10-bit address to 8-bit and - * 16-bit read/write address - */ - -#define I2C_READBIT 0x01 - -/* Conver 7- to 8-bit address */ - -#define I2C_ADDR8(a) ((a) << 1) -#define I2C_WRITEADDR8(a) I2C_ADDR8(a) -#define I2C_READADDR8(a) (I2C_ADDR8(a) | I2C_READBIT) - -/* Convert 10- to 16-bit address */ - -#define I2C_ADDR10H(a) (0xf0 | (((a) >> 7) & 0x06)) -#define I2C_ADDR10L(a) ((a) & 0xff) - -#define I2C_WRITEADDR10H(a) I2C_ADDR10H(a) -#define I2C_WRITEADDR10L(a) I2C_ADDR10L(a) - -#define I2C_READADDR10H(a) (I2C_ADDR10H(a) | I2C_READBIT) -#define I2C_READADDR10L(a) I2C_ADDR10L(a) - -/* Bit definitions for the flags field in struct i2c_ops_s */ - -#define I2C_M_READ 0x0001 /* read data, from slave to master */ -#define I2C_M_TEN 0x0002 /* ten bit address */ -#define I2C_M_NORESTART 0x0080 /* message should not begin with (re-)start of transfer */ - -/* Access macros */ - -/**************************************************************************** - * Name: I2C_SETFREQUENCY - * - * Description: - * Set the I2C frequency. This frequency will be retained in the struct - * i2c_dev_s instance and will be used with all transfers. Required. - * - * Input Parameters: - * dev - Device-specific state data - * frequency - The I2C frequency requested - * - * Returned Value: - * Returns the actual frequency selected - * - ****************************************************************************/ - -#define I2C_SETFREQUENCY(d,f) ((d)->ops->setfrequency(d,f)) - -/**************************************************************************** - * Name: I2C_SETADDRESS - * - * Description: - * Set the I2C slave address. This frequency will be retained in the struct - * i2c_dev_s instance and will be used with all transfers. Required. - * - * Input Parameters: - * dev - Device-specific state data - * address - The I2C slave address - * nbits - The number of address bits provided (7 or 10) - * - * Returned Value: - * Returns OK on success; a negated errno on failure. - * - ****************************************************************************/ - -#define I2C_SETADDRESS(d,a,n) ((d)->ops->setaddress(d,a,n)) - -/**************************************************************************** - * Name: I2C_SETOWNADDRESS - * - * Description: - * Set our own I2C address. Calling this function enables Slave mode and - * disables Master mode on given instance (note that I2C is a bus, where - * multiple masters and slave may be handled by one device driver). - * - * One may register callback to be notifyed about reception. During the - * slave mode reception, the function READ and WRITE must be used to - * to handle reads and writes from a master. - * - * Input Parameters: - * dev - Device-specific state data - * address - Our own slave address; If it is 0x00, then the device driver - * listens to general call - * nbits - The number of address bits provided (7 or 10) - * - * Returned Value: - * OK on valid address and if the same address has not been assigned - * to other existance sharing the same port. Otherwise ERROR is returned. - * - ****************************************************************************/ - -#define I2C_SETOWNADDRESS(d,a,n) ((d)->ops->setownaddress(d,a,n)) - -/**************************************************************************** - * Name: I2C_WRITE - * - * Description: - * Send a block of data on I2C using the previously selected I2C - * frequency and slave address. Each write operational will be an 'atomic' - * operation in the sense that any other I2C actions will be serialized - * and pend until this write completes. Required. - * - * Input Parameters: - * dev - Device-specific state data - * buffer - A pointer to the read-only buffer of data to be written to device - * buflen - The number of bytes to send from the buffer - * - * Returned Value: - * 0: success, <0: A negated errno - * - ****************************************************************************/ - -#define I2C_WRITE(d,b,l) ((d)->ops->write(d,b,l)) - -/**************************************************************************** - * Name: I2C_READ - * - * Description: - * Receive a block of data from I2C using the previously selected I2C - * frequency and slave address. Each read operational will be an 'atomic' - * operation in the sense that any other I2C actions will be serialized - * and pend until this read completes. Required. - * - * Input Parameters: - * dev - Device-specific state data - * buffer - A pointer to a buffer of data to receive the data from the device - * buflen - The requested number of bytes to be read - * - * Returned Value: - * 0: success, <0: A negated errno - * - ****************************************************************************/ - -#define I2C_READ(d,b,l) ((d)->ops->read(d,b,l)) - -/**************************************************************************** - * Name: I2C_WRITEREAD - * - * Description: - * Send a block of data on I2C using the previously selected I2C - * frequency and slave address, followed by restarted read access. - * It provides a convenient wrapper to the transfer function. - * - * Input Parameters: - * dev - Device-specific state data - * wbuffer - A pointer to the read-only buffer of data to be written to device - * wbuflen - The number of bytes to send from the buffer - * rbuffer - A pointer to a buffer of data to receive the data from the device - * rbuflen - The requested number of bytes to be read - * - * Returned Value: - * 0: success, <0: A negated errno - * - ****************************************************************************/ - -#define I2C_WRITEREAD(d,wb,wl,rb,rl) ((d)->ops->writeread(d,wb,wl,rb,rl)) - -/**************************************************************************** - * Name: I2C_TRANSFER - * - * Description: - * Perform a sequence of I2C transfers, each transfer is started with a - * START and the final transfer is completed with a STOP. Each sequence - * will be an 'atomic' operation in the sense that any other I2C actions - * will be serialized and pend until this read completes. Optional. - * - * Input Parameters: - * dev - Device-specific state data - * msgs - A pointer to a set of message descriptors - * msgcount - The number of transfers to perform - * - * Returned Value: - * The number of transfers completed - * - ****************************************************************************/ - -#define I2C_TRANSFER(d,m,c) ((d)->ops->transfer(d,m,c)) - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* The I2C vtable */ - -struct i2c_dev_s; -struct i2c_msg_s; -struct i2c_ops_s -{ - uint32_t (*setfrequency)(FAR struct i2c_dev_s *dev, uint32_t frequency); - int (*setaddress)(FAR struct i2c_dev_s *dev, int addr, int nbits); - int (*write)(FAR struct i2c_dev_s *dev, const uint8_t *buffer, int buflen); - int (*read)(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen); -#ifdef CONFIG_I2C_WRITEREAD - int (*writeread)(FAR struct i2c_dev_s *inst, const uint8_t *wbuffer, int wbuflen, - uint8_t *rbuffer, int rbuflen); -#endif -#ifdef CONFIG_I2C_TRANSFER - int (*transfer)(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *msgs, int count); -#endif -#ifdef CONFIG_I2C_SLAVE - int (*setownaddress)(FAR struct i2c_dev_s *dev, int addr, int nbits); - int (*registercallback)(FAR struct i2c_dev_s *dev, int (*callback)(void) ); -#endif -}; - -/* I2C transaction segment beginning with a START. A number of these can - * be transfered together to form an arbitrary sequence of write/read transfer - * to an I2C slave device. - */ - -struct i2c_msg_s -{ - uint16_t addr; /* Slave address */ - uint16_t flags; /* See I2C_M_* definitions */ - uint8_t *buffer; - int length; -}; - -/* I2C private data. This structure only defines the initial fields of the - * structure visible to the I2C client. The specific implementation may - * add additional, device specific fields after the vtable. - */ - -struct i2c_dev_s -{ - const struct i2c_ops_s *ops; /* I2C vtable */ -}; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: up_i2cinitialize - * - * Description: - * Initialize the selected I2C port. And return a unique instance of struct - * struct i2c_dev_s. This function may be called to obtain multiple - * instances of the interface, each of which may be set up with a - * different frequency and slave address. - * - * Input Parameter: - * Port number (for hardware that has mutiple I2C interfaces) - * - * Returned Value: - * Valid I2C device structre reference on succcess; a NULL on failure - * - ****************************************************************************/ - -EXTERN FAR struct i2c_dev_s *up_i2cinitialize(int port); - -/**************************************************************************** - * Name: up_i2cuninitialize - * - * Description: - * De-initialize the selected I2C port, and power down the device. - * - * Input Parameter: - * Device structure as returned by the up_i2cinitalize() - * - * Returned Value: - * OK on success, ERROR when internal reference count missmatch or dev - * points to invalid hardware device. - * - ****************************************************************************/ - -EXTERN int up_i2cuninitialize(FAR struct i2c_dev_s *dev); - -/************************************************************************************ - * Name: up_i2creset - * - * Description: - * Reset an I2C bus - * - ************************************************************************************/ - -#ifdef CONFIG_I2C_RESET -EXTERN int up_i2creset(FAR struct i2c_dev_s *dev); -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif -#endif /* __INCLUDE_NUTTX_I2C_H */ diff --git a/nuttx/include/nuttx/init.h b/nuttx/include/nuttx/init.h deleted file mode 100644 index 2d1b3c693..000000000 --- a/nuttx/include/nuttx/init.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** - * include/nuttx/init.h - * - * 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. - * - ****************************************************************************/ - -#ifndef __INCLUDE_NUTTX_INIT_H -#define __INCLUDE_NUTTX_INIT_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Global Data - ****************************************************************************/ - -/**************************************************************************** - * Global Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Global Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/* This entry point must be supplied by the application */ - -EXTERN int CONFIG_USER_ENTRYPOINT(int argc, char *argv[]); - -/* Functions contained in os_task.c *****************************************/ - -EXTERN void os_start(void); /* OS entry point called by boot logic */ - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_INIT_H */ diff --git a/nuttx/include/nuttx/input/ads7843e.h b/nuttx/include/nuttx/input/ads7843e.h deleted file mode 100644 index fe4382f2f..000000000 --- a/nuttx/include/nuttx/input/ads7843e.h +++ /dev/null @@ -1,182 +0,0 @@ -/**************************************************************************** - * include/nuttx/input/ads7843e.h - * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Authors: Gregory Nutt - * Diego Sanchez - * - * References: - * "Touch Screen Controller, ADS7843," Burr-Brown Products from Texas - * Instruments, SBAS090B, September 2000, Revised May 2002" - * - * 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_NUTTX_INPUT_ADS7843E_H -#define __INCLUDE_NUTTX_INPUT_ADS7843E_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E) - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* SPI Frequency. Default: 100KHz */ - -#ifndef CONFIG_ADS7843E_FREQUENCY -# define CONFIG_ADS7843E_FREQUENCY 100000 -#endif - -/* Maximum number of threads than can be waiting for POLL events */ - -#ifndef CONFIG_ADS7843E_NPOLLWAITERS -# define CONFIG_ADS7843E_NPOLLWAITERS 2 -#endif - -#ifndef CONFIG_ADS7843E_SPIMODE -# define CONFIG_ADS7843E_SPIMODE SPIDEV_MODE0 -#endif - -/* Thresholds */ - -#ifndef CONFIG_ADS7843E_THRESHX -# define CONFIG_ADS7843E_THRESHX 12 -#endif - -#ifndef CONFIG_ADS7843E_THRESHY -# define CONFIG_ADS7843E_THRESHY 12 -#endif - -/* Check for some required settings. This can save the user a lot of time - * in getting the right configuration. - */ - -#ifdef CONFIG_DISABLE_SIGNALS -# error "Signals are required. CONFIG_DISABLE_SIGNALS must not be selected." -#endif - -#ifndef CONFIG_SCHED_WORKQUEUE -# error "Work queue support required. CONFIG_SCHED_WORKQUEUE must be selected." -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* A reference to a structure of this type must be passed to the ADS7843E - * driver. This structure provides information about the configuration - * of the TSB2007 and provides some board-specific hooks. - * - * Memory for this structure is provided by the caller. It is not copied - * by the driver and is presumed to persist while the driver is active. The - * memory must be writable because, under certain circumstances, the driver - * may modify frequency or X plate resistance values. - */ - -struct ads7843e_config_s -{ - /* Device characterization */ - - uint32_t frequency; /* SPI frequency */ - - /* If multiple ADS7843E devices are supported, then an IRQ number must - * be provided for each so that their interrupts can be distinguished. - */ - -#ifndef CONFIG_ADS7843E_MULTIPLE - int irq; /* IRQ number received by interrupt handler. */ -#endif - - /* IRQ/GPIO access callbacks. These operations all hidden behind - * callbacks to isolate the ADS7843E driver from differences in GPIO - * interrupt handling by varying boards and MCUs. If possible, - * interrupts should be configured on both rising and falling edges - * so that contact and loss-of-contact events can be detected. - * - * attach - Attach the ADS7843E interrupt handler to the GPIO interrupt - * enable - Enable or disable the GPIO interrupt - * clear - Acknowledge/clear any pending GPIO interrupt - * pendown - Return the state of the pen down GPIO input - */ - - int (*attach)(FAR struct ads7843e_config_s *state, xcpt_t isr); - void (*enable)(FAR struct ads7843e_config_s *state, bool enable); - void (*clear)(FAR struct ads7843e_config_s *state); - bool (*busy)(FAR struct ads7843e_config_s *state); - bool (*pendown)(FAR struct ads7843e_config_s *state); -}; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: ads7843e_register - * - * Description: - * Configure the ADS7843E to use the provided SPI device instance. This - * will register the driver as /dev/inputN where N is the minor device - * number - * - * Input Parameters: - * spi - An SPI driver instance - * config - Persistent board configuration data - * minor - The input device minor number - * - * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is - * returned to indicate the nature of the failure. - * - ****************************************************************************/ - -EXTERN int ads7843e_register(FAR struct spi_dev_s *spi, - FAR struct ads7843e_config_s *config, - int minor); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_INPUT && CONFIG_INPUT_ADS7843E */ -#endif /* __INCLUDE_NUTTX_INPUT_ADS7843E_H */ diff --git a/nuttx/include/nuttx/input/kbd_codec.h b/nuttx/include/nuttx/input/kbd_codec.h deleted file mode 100644 index 9a7c7c8e6..000000000 --- a/nuttx/include/nuttx/input/kbd_codec.h +++ /dev/null @@ -1,347 +0,0 @@ -/************************************************************************************ - * include/nuttx/input/kbd_codec.h - * Serialize and marshaling keyboard data and events - * - * Copyright (C) 2012 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_NUTTX_INPUT_KBD_CODEC_H -#define __INCLUDE_NUTTX_INPUT_KBD_CODEC_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#ifdef CONFIG_LIB_KBDCODEC - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* These are the special keyboard commands recognized by the CODEC. */ - -enum kbd_keycode_e -{ - KEYCODE_NORMAL = 0, /* Not a special keycode */ - - /* Delete and Backspace keycodes (in case they may be different than the - * ASCII BKSP and DEL values. - */ - - KEYCODE_FWDDEL, /* DELete (forward delete) */ - KEYCODE_BACKDEL, /* Backspace (backward delete) */ - - /* Cursor movement */ - - KEYCODE_HOME, /* Home */ - KEYCODE_END, /* End */ - KEYCODE_LEFT, /* Left arrow */ - KEYCODE_RIGHT, /* Right arrow */ - KEYCODE_UP, /* Up arrow */ - KEYCODE_DOWN, /* Down arrow */ - KEYCODE_PAGEUP, /* Page up */ - KEYCODE_PAGEDOWN, /* Page down */ - - /* Edit commands */ - - KEYCODE_INSERT, /* Insert */ - KEYCODE_AGAIN, /* Again */ - KEYCODE_UNDO, /* Undo */ - KEYCODE_REDO, /* Redo */ - KEYCODE_CUT, /* Cut */ - KEYCODE_COPY, /* Copy */ - KEYCODE_PASTE, /* Paste */ - KEYCODE_FIND, /* Find */ - - /* Selection codes */ - - KEYCODE_ENTER, /* Enter */ - KEYCODE_SELECT, /* Select */ - KEYCODE_EXECUTE, /* Execute */ - - /* Keyboard modes */ - - KEYCODE_CAPSLOCK, /* Caps Lock */ - KEYCODE_SCROLLLOCK, /* Scroll Lock */ - KEYCODE_NUMLOCK, /* Keypad Num Lock and Clear */ - KEYCODE_LCAPSLOCK, /* Locking Caps Lock */ - KEYCODE_LNUMLOCK, /* Locking Num Lock */ - KEYCODE_LSCROLLLOCK, /* Locking Scroll Lock */ - - /* Misc control codes */ - - KEYCODE_POWER, /* Power */ - KEYCODE_HELP, /* Help */ - KEYCODE_MENU, /* Menu */ - KEYCODE_STOP, /* Stop */ - KEYCODE_PAUSE, /* Pause */ - KEYCODE_BREAK, /* Break */ - KEYCODE_CANCEL, /* Cancel */ - KEYCODE_PRTSCRN, /* PrintScreen */ - KEYCODE_SYSREQ, /* SysReq/Attention */ - - /* Audio */ - - KEYCODE_MUTE, /* Mute */ - KEYCODE_VOLUP, /* Volume Up */ - KEYCODE_VOLDOWN, /* Volume Down */ - - /* Telephone */ - - KEYCODE_ANSWER, /* Answer (phone) */ - KEYCODE_HANGUP, /* Hang-up (phone) */ - - /* Calculator */ - - KEYCODE_CLEAR, /* Clear */ - KEYCODE_CLEARENTRY, /* Clear entry */ - KEYCODE_NEGATE, /* +/- */ - - KEYCODE_MEMSTORE, /* Memory store */ - KEYCODE_MEMCLEAR, /* Memory clear */ - KEYCODE_MEMRECALL, /* Memory recall */ - KEYCODE_MEMADD, /* Memory add */ - KEYCODE_MEMSUB, /* Memory substract */ - KEYCODE_MEMMUL, /* Memory multiply */ - KEYCODE_MEMDIV, /* Memory divide */ - - KEYCODE_BINARY, /* Binary mode */ - KEYCODE_OCTAL, /* Octal mode */ - KEYCODE_DECIMAL, /* Decimal mode */ - KEYCODE_HEXADECIMAL, /* Hexadecimal mode */ - - /* Languages */ - - KEYCODE_LANG1, /* LANG1 */ - KEYCODE_LANG2, /* LANG2 */ - KEYCODE_LANG3, /* LANG3 */ - KEYCODE_LANG4, /* LANG4 */ - KEYCODE_LANG5, /* LANG5 */ - KEYCODE_LANG6, /* LANG6 */ - KEYCODE_LANG7, /* LANG7 */ - KEYCODE_LANG8, /* LANG8 */ - - /* Context-specific function keys */ - - KEYCODE_F1, /* Function key 1 */ - KEYCODE_F2, /* Function key 2 */ - KEYCODE_F3, /* Function key 3 */ - KEYCODE_F4, /* Function key 4 */ - KEYCODE_F5, /* Function key 5 */ - KEYCODE_F6, /* Function key 6 */ - KEYCODE_F7, /* Function key 7 */ - KEYCODE_F8, /* Function key 8 */ - KEYCODE_F9, /* Function key 9 */ - KEYCODE_F10, /* Function key 10 */ - KEYCODE_F11, /* Function key 11 */ - KEYCODE_F12, /* Function key 12 */ - KEYCODE_F13, /* Function key 13 */ - KEYCODE_F14, /* Function key 14 */ - KEYCODE_F15, /* Function key 15 */ - KEYCODE_F16, /* Function key 16 */ - KEYCODE_F17, /* Function key 17 */ - KEYCODE_F18, /* Function key 18 */ - KEYCODE_F19, /* Function key 19 */ - KEYCODE_F20, /* Function key 20 */ - KEYCODE_F21, /* Function key 21 */ - KEYCODE_F22, /* Function key 22 */ - KEYCODE_F23, /* Function key 23 */ - KEYCODE_F24 /* Function key 24 */ -}; - -#define FIRST_KEYCODE KEYCODE_FWDDEL -#define LAST_KEYCODE KEYCODE_F24 - -/* kbd_decode() return values */ - -#define KBD_PRESS 0 /* Key press event */ -#define KBD_RELEASE 1 /* Key release event */ -#define KBD_SPECPRESS 2 /* Special key press event */ -#define KBD_SPECREL 3 /* Special key release event */ -#define KBD_ERROR EOF /* Error or end-of-file */ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -struct kbd_getstate_s -{ - uint8_t nch; /* Number of characters in the buffer */ - uint8_t ndx; /* Index to next character in the buffer */ - uint8_t buf[4]; /* Buffer of ungotten data */ -}; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -extern "C" -{ -#endif - -/**************************************************************************** - * The following functions are intended for use by "producer", keyboard - * or keypad drivers to encode information into driver buffers. - ****************************************************************************/ - -/**************************************************************************** - * Name: kbd_press - * - * Description: - * Indicates a normal key press event. Put one byte of normal keyboard - * data into the output stream. - * - * Input Parameters: - * ch - The character to be added to the output stream. - * stream - An instance of lib_outstream_s to do the low-level put - * operation. - * - * Returned Value: - * None - * - ****************************************************************************/ - -#define kbd_press(ch, stream) (stream)->put((stream), (int)(ch)) - -/**************************************************************************** - * Name: kbd_release - * - * Description: - * Encode the release of a normal key. - * - * Input Parameters: - * ch - The character associated with the key that was releared. - * stream - An instance of lib_outstream_s to do the low-level put - * operation. - * - * Returned Value: - * None - * - ****************************************************************************/ - -void kbd_release(uint8_t ch, FAR struct lib_outstream_s *stream); - -/**************************************************************************** - * Name: kbd_specpress - * - * Description: - * Denotes a special key press event. Put one special keyboard command - * into the output stream. - * - * Input Parameters: - * keycode - The command to be added to the output stream. - * stream - An instance of lib_outstream_s to do the low-level put - * operation. - * - * Returned Value: - * None - * - ****************************************************************************/ - -void kbd_specpress(enum kbd_keycode_e keycode, - FAR struct lib_outstream_s *stream); - -/**************************************************************************** - * Name: kbd_specrel - * - * Description: - * Denotes a special key release event. Put one special keyboard - * command into the output stream. - * - * Input Parameters: - * keycode - The command to be added to the output stream. - * stream - An instance of lib_outstream_s to do the low-level put - * operation. - * - * Returned Value: - * None - * - ****************************************************************************/ - -void kbd_specrel(enum kbd_keycode_e keycode, - FAR struct lib_outstream_s *stream); - -/**************************************************************************** - * The following functions are intended for use by "consumer" applications - * to remove and decode information from the driver provided buffer. - ****************************************************************************/ - -/**************************************************************************** - * Name: kbd_decode - * - * Description: - * Get one byte of data or special command from the driver provided input - * buffer. - * - * Input Parameters: - * stream - An instance of lib_instream_s to do the low-level get - * operation. - * pch - The location to save the returned value. This may be - * either a normal, character code or a special command from enum - * kbd_keycode_e - * state - A user provided buffer to support parsing. This structure - * should be cleared the first time that kbd_decode is called. - * - * Returned Value: - * - * KBD_PRESS - Indicates the successful receipt of normal, keyboard data. - * This corresponds to a keypress event. The returned value in pch is a - * simple byte of text or control data corresponding to the pressed key. - * KBD_RELEASE - Indicates a key release event. The returned value in pch - * is the byte of text or control data corresponding to the released key. - * KBD_SPECPRESS - Indicates the successful receipt of a special keyboard - * command. The returned value in pch is a value from enum kbd_getstate_s. - * KBD_SPECREL - Indicates a special key release event. The returned value - * in pch is a value from enum kbd_getstate_s. - * EOF - An error has getting the next character (reported by the stream). - * Normally indicates the end of file. - * - ****************************************************************************/ - -int kbd_decode(FAR struct lib_instream_s *stream, - FAR struct kbd_getstate_s *state, FAR uint8_t *pch); - -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_LIB_KBDCODEC */ -#endif /* __INCLUDE_NUTTX_INPUT_KBD_CODEC_H */ - diff --git a/nuttx/include/nuttx/input/keypad.h b/nuttx/include/nuttx/input/keypad.h deleted file mode 100644 index 574b421c1..000000000 --- a/nuttx/include/nuttx/input/keypad.h +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************************************************ - * include/nuttx/input/keypad.h - * - * Copyright (C) 2012 Denis Carikli. - * Author: Denis Carikli - * - * 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_NUTTX_INPUT_KEYPAD_H -#define __INCLUDE_NUTTX_INPUT_KEYPAD_H - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif - -int keypad_kbdinit(void); - -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_INPUT_KEYPAD_H */ - diff --git a/nuttx/include/nuttx/input/max11802.h b/nuttx/include/nuttx/input/max11802.h deleted file mode 100644 index 3d03bdd11..000000000 --- a/nuttx/include/nuttx/input/max11802.h +++ /dev/null @@ -1,175 +0,0 @@ -/**************************************************************************** - * include/nuttx/input/max11802.h - * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Authors: Gregory Nutt - * Petteri Aimonen - * - * References: - * "Low-Power, Ultra-Small Resistive Touch-Screen Controllers - * with I2C/SPI Interface" Maxim IC, Rev 3, 10/2010 - * - * 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_NUTTX_INPUT_MAX11802_H -#define __INCLUDE_NUTTX_INPUT_MAX11802_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include -#include -#include - -#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_MAX11802) - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* SPI Frequency. Default: 100KHz */ - -#ifndef CONFIG_MAX11802_FREQUENCY -# define CONFIG_MAX11802_FREQUENCY 100000 -#endif - -/* Maximum number of threads than can be waiting for POLL events */ - -#ifndef CONFIG_MAX11802_NPOLLWAITERS -# define CONFIG_MAX11802_NPOLLWAITERS 2 -#endif - -#ifndef CONFIG_MAX11802_SPIMODE -# define CONFIG_MAX11802_SPIMODE SPIDEV_MODE0 -#endif - -/* Thresholds */ - -#ifndef CONFIG_MAX11802_THRESHX -# define CONFIG_MAX11802_THRESHX 12 -#endif - -#ifndef CONFIG_MAX11802_THRESHY -# define CONFIG_MAX11802_THRESHY 12 -#endif - -/* Check for some required settings. This can save the user a lot of time - * in getting the right configuration. - */ - -#ifdef CONFIG_DISABLE_SIGNALS -# error "Signals are required. CONFIG_DISABLE_SIGNALS must not be selected." -#endif - -#ifndef CONFIG_SCHED_WORKQUEUE -# error "Work queue support required. CONFIG_SCHED_WORKQUEUE must be selected." -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* A reference to a structure of this type must be passed to the MAX11802 - * driver. This structure provides information about the configuration - * of the MAX11802 and provides some board-specific hooks. - * - * Memory for this structure is provided by the caller. It is not copied - * by the driver and is presumed to persist while the driver is active. The - * memory must be writable because, under certain circumstances, the driver - * may modify frequency or X plate resistance values. - */ - -struct max11802_config_s -{ - /* Device characterization */ - - uint32_t frequency; /* SPI frequency */ - - /* IRQ/GPIO access callbacks. These operations all hidden behind - * callbacks to isolate the MAX11802 driver from differences in GPIO - * interrupt handling by varying boards and MCUs. If possible, - * interrupts should be configured on both rising and falling edges - * so that contact and loss-of-contact events can be detected. - * - * attach - Attach the MAX11802 interrupt handler to the GPIO interrupt - * enable - Enable or disable the GPIO interrupt - * clear - Acknowledge/clear any pending GPIO interrupt - * pendown - Return the state of the pen down GPIO input - */ - - int (*attach)(FAR struct max11802_config_s *state, xcpt_t isr); - void (*enable)(FAR struct max11802_config_s *state, bool enable); - void (*clear)(FAR struct max11802_config_s *state); - bool (*pendown)(FAR struct max11802_config_s *state); -}; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: max11802_register - * - * Description: - * Configure the MAX11802 to use the provided SPI device instance. This - * will register the driver as /dev/inputN where N is the minor device - * number - * - * Input Parameters: - * spi - An SPI driver instance - * config - Persistent board configuration data - * minor - The input device minor number - * - * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is - * returned to indicate the nature of the failure. - * - ****************************************************************************/ - -EXTERN int max11802_register(FAR struct spi_dev_s *spi, - FAR struct max11802_config_s *config, - int minor); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_INPUT && CONFIG_INPUT_MAX11802 */ -#endif /* __INCLUDE_NUTTX_INPUT_MAX11802_H */ diff --git a/nuttx/include/nuttx/input/stmpe811.h b/nuttx/include/nuttx/input/stmpe811.h deleted file mode 100644 index fc311f7c4..000000000 --- a/nuttx/include/nuttx/input/stmpe811.h +++ /dev/null @@ -1,785 +0,0 @@ -/******************************************************************************************** - * include/nuttx/input/stmpe811.h - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * References: - * "STMPE811 S-Touch® advanced resistive touchscreen controller with 8-bit - * GPIO expander," Doc ID 14489 Rev 6, CD00186725, STMicroelectronics" - * - * 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_NUTTX_INPUT_STMPE811_H -#define __INCLUDE_NUTTX_INPUT_STMPE811_H - -/******************************************************************************************** - * Included Files - ********************************************************************************************/ - -#include - -#include -#include - -#include - -#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_STMPE811) - -/******************************************************************************************** - * Pre-Processor Definitions - ********************************************************************************************/ -/* Configuration ****************************************************************************/ -/* Prerequisites: CONFIG_INPUT=y - * Other settings that effect the driver: CONFIG_DISABLE_POLL - * - * CONFIG_INPUT_STMPE811 - * Enables support for the STMPE811 driver (Needs CONFIG_INPUT) - * CONFIG_STMPE811_SPI - * Enables support for the SPI interface (not currenly supported) - * CONFIG_STMPE811_I2C - * Enables support for the I2C interface - * CONFIG_STMPE811_MULTIPLE - * Can be defined to support multiple STMPE811 devices on board. - * CONFIG_STMPE811_NPOLLWAITERS - * Maximum number of threads that can be waiting on poll() (ignored if - * CONFIG_DISABLE_POLL is set). - * CONFIG_STMPE811_TSC_DISABLE - * Disable driver touchscreen functionality. - * CONFIG_STMPE811_ADC_DISABLE - * Disable driver ADC functionality. - * CONFIG_STMPE811_GPIO_DISABLE - * Disable driver GPIO functionality. - * CONFIG_STMPE811_GPIOINT_DISABLE - * Disable driver GPIO interrupt functionlality (ignored if GPIO functionality is - * disabled). - * CONFIG_STMPE811_SWAPXY - * Reverse the meaning of X and Y to handle different LCD orientations. - * CONFIG_STMPE811_TEMP_DISABLE - * Disable driver temperature sensor functionality. - * CONFIG_STMPE811_REGDEBUG - * Enable very low register-level debug output. Requires CONFIG_DEBUG. - * CONFIG_STMPE811_THRESHX and CONFIG_STMPE811_THRESHY - * STMPE811 touchscreen data comes in a a very high rate. New touch positions - * will only be reported when the X or Y data changes by these thresholds. - * This trades reduces data rate for some loss in dragging accuracy. The - * STMPE811 is configure for 12-bit values so the raw ranges are 0-4095. So - * for example, if your display is 320x240, then THRESHX=13 and THRESHY=17 - * would correspond to one pixel. Default: 12 - */ - -/* The STMPE811 interfaces with the target CPU via a I2C or SPI interface. The pin IN_1 - * allows the selection of interface protocol at reset state. - */ - -#if !defined(CONFIG_STMPE811_SPI) && !defined(CONFIG_STMPE811_I2C) -# error "One of CONFIG_STMPE811_SPI or CONFIG_STMPE811_I2C must be defined" -#endif - -#if defined(CONFIG_STMPE811_SPI) && defined(CONFIG_STMPE811_I2C) -# error "Only one of CONFIG_STMPE811_SPI or CONFIG_STMPE811_I2C can be defined" -#endif - -/* Maximum number of threads than can be waiting for POLL events */ - -#ifndef CONFIG_STMPE811_NPOLLWAITERS -# define CONFIG_STMPE811_NPOLLWAITERS 2 -#endif - -/* Check for some required settings. This can save the user a lot of time - * in getting the right configuration. - */ - -#ifdef CONFIG_STMPE811_I2C -# ifndef CONFIG_I2C -# error "CONFIG_I2C is required in the I2C support" -# endif -# ifndef CONFIG_I2C_TRANSFER -# error "CONFIG_I2C_TRANSFER is required in the I2C configuration" -# endif -#endif - -#ifdef CONFIG_DISABLE_SIGNALS -# error "Signals are required. CONFIG_DISABLE_SIGNALS must not be selected." -#endif - -#ifndef CONFIG_SCHED_WORKQUEUE -# error "Work queue support required. CONFIG_SCHED_WORKQUEUE must be selected." -#endif - -/* Thresholds */ - -#ifndef CONFIG_STMPE811_THRESHX -# define CONFIG_STMPE811_THRESHX 12 -#endif - -#ifndef CONFIG_STMPE811_THRESHY -# define CONFIG_STMPE811_THRESHY 12 -#endif - -/* Debug output */ - -#ifndef CONFIG_DEBUG -# undef CONFIG_STMPE811_REGDEBUG -#endif - -/* I2C **************************************************************************************/ -/* STMPE811 Address: The STMPE811 may have 7-bit address 0x41 or 0x44, depending upon the - * state of the ADDR0 pin. - */ - -#define STMPE811_I2C_ADDRESS_MASK (0x78) /* Bits 3-7: Invariant part of STMPE811 address */ -#define STMPE811_I2C_ADDRESS (0x40) /* Bits 3-7: Always set at '0100 0xxR' */ -#define STMPE811_I2C_A1 (1 << 2) /* Bit 2: A1 */ -#define STMPE811_I2C_A0 (1 << 1) /* Bit 1: A0 */ -#define STMPE811_I2C_READ (1 << 0) /* Bit 0=1: Selects read operation */ -#define STMPE811_I2C_WRITE (0) /* Bit 0=0: Selects write operation */ - -/* I2C frequency */ - -#define STMPE811_I2C_MAXFREQUENCY 400000 /* 400KHz */ - -/* SPI **************************************************************************************/ -/* The device always operates in mode 0 */ - -#define STMPE811_SPI_MODE SPIDEV_MODE0 /* Mode 0 */ - -/* I2C frequency */ - -#define STMPE811_SPI_MAXFREQUENCY 1000000 /* 1MHz */ - -/* STMPE811 Registers ************************************************************************/ -/* Register Addresses */ - -#define STMPE811_CHIP_ID 0x00 /* Device identification (16-bit) */ -#define STMPE811_ID_VER 0x02 /* Revision number: 0x01=sample 0x03=final silicon */ -#define STMPE811_SYS_CTRL1 0x03 /* Reset control */ -#define STMPE811_SYS_CTRL2 0x04 /* Clock control */ -#define STMPE811_SPI_CFG 0x08 /* SPI interface configuration */ -#define STMPE811_INT_CTRL 0x09 /* Interrupt control register */ -#define STMPE811_INT_EN 0x0a /* Interrupt enable register */ -#define STMPE811_INT_STA 0x0b /* Interrupt status register */ -#define STMPE811_GPIO_EN 0x0c /* GPIO interrupt enable register */ -#define STMPE811_GPIO_INTSTA 0x0d /* GPIO interrupt status register */ -#define STMPE811_ADC_INTEN 0x0e /* ADC interrupt enable register */ -#define STMPE811_ADC_INTSTA 0x0f /* ADC interrupt status register */ -#define STMPE811_GPIO_SETPIN 0x10 /* GPIO set pin register */ -#define STMPE811_GPIO_CLRPIN 0x11 /* GPIO clear pin register */ -#define STMPE811_GPIO_MPSTA 0x12 /* GPIO monitor pin state register */ -#define STMPE811_GPIO_DIR 0x13 /* GPIO direction register */ -#define STMPE811_GPIO_ED 0x14 /* GPIO edge detect register */ -#define STMPE811_GPIO_RE 0x15 /* GPIO rising edge register */ -#define STMPE811_GPIO_FE 0x16 /* GPIO falling edge register */ -#define STMPE811_GPIO_AF 0x17 /* Alternate function register */ -#define STMPE811_ADC_CTRL1 0x20 /* ADC control */ -#define STMPE811_ADC_CTRL2 0x21 /* ADC control */ -#define STMPE811_ADC_CAPT 0x22 /* To initiate ADC data acquisition */ -#define STMPE811_ADC_DATACH(n) (0x30 + ((n) << 1)) /* ADC channel n (16-bit) */ -#define STMPE811_ADC_DATACH0 0x30 /* ADC channel 0 (16-bit) */ -#define STMPE811_ADC_DATACH1 0x32 /* ADC channel 1 (16_bit) */ -#define STMPE811_ADC_DATACH2 0x34 /* ADC channel 2 (16-bit) */ -#define STMPE811_ADC_DATACH3 0x36 /* ADC channel 3 (16-bit) */ -#define STMPE811_ADC_DATACH4 0x38 /* ADC channel 4 (16-bit) */ -#define STMPE811_ADC_DATACH5 0x3a /* ADC channel 5 (16-bit) */ -#define STMPE811_ADC_DATACH6 0x3c /* ADC channel 6 (16-bit) */ -#define STMPE811_ADC_DATACH7 0x3e /* ADC channel 7 (16-bit) */ -#define STMPE811_TSC_CTRL 0x40 /* 4-wire touchscreen controller setup */ -#define STMPE811_TSC_CFG 0x41 /* Touchscreen controller configuration */ -#define STMPE811_WDW_TRX 0x42 /* Window setup for top right X (16-bit) */ -#define STMPE811_WDW_TRY 0x44 /* Window setup for top right Y (16-bit) */ -#define STMPE811_WDW_BLX 0x46 /* Window setup for bottom left X (16-bit) */ -#define STMPE811_WDW_BLY 0x48 /* Window setup for bottom left Y (16-bit) */ -#define STMPE811_FIFO_TH 0x4a /* FIFO level to generate interrupt */ -#define STMPE811_FIFO_STA 0x4b /* Current status of FIFO */ -#define STMPE811_FIFO_SIZE 0x4c /* Current filled level of FIFO */ -#define STMPE811_TSC_DATAX 0x4d /* Data port for touchscreen (16-bit) */ -#define STMPE811_TSC_DATAY 0x4f /* Data port for touchscreen (16-bit) */ -#define STMPE811_TSC_DATAZ 0x51 /* Data port for touchscreen */ -#define STMPE811_TSC_DATAXYZ 0x52 /* Data port for touchscreen (32-bit) */ -#define STMPE811_TSC_FRACTIONZ 0x56 /* Touchscreen controller FRACTION_Z */ -#define STMPE811_TSC_DATA 0x57 /* Data port for touchscreen */ -#define STMPE811_TSC_IDRIVE 0x58 /* Touchscreen controller drive I */ -#define STMPE811_TSC_SHIELD 0x59 /* Touchscreen controller shield */ -#define STMPE811_TEMP_CTRL 0x60 /* Temperature sensor setup */ -#define STMPE811_TEMP_DATA 0x61 /* Temperature data access port */ -#define STMPE811_TEMP_TH 0x62 /* Threshold for temperature controlled interrupt */ - -/* Register bit definitions */ - -/* Device identification (16-bit) */ - -#define CHIP_ID 0x0811 - -/* Revision number: 0x01=sample 0x03=final silicon */ - -#define ID_VER_SAMPLE 0x01 -#define ID_VER_FINAL 0x03 - -/* Reset control */ - -#define SYS_CTRL1_HIBERNATE (1 << 0) /* Bit 0: Force the device into hibernation mode */ -#define SYS_CTRL1_SOFTRESET (1 << 1) /* Bit 1: Reset the STMPE811 */ - -/* Clock control */ - -#define SYS_CTRL2_ADC_OFF (1 << 0) /* Bit 0: Switch off clock to ADC */ -#define SYS_CTRL2_TSC_OFF (1 << 1) /* Bit 1: Switch off clock to touchscreen controller */ -#define SYS_CTRL2_GPIO_OFF (1 << 2) /* Bit 2: Switch off clock to GPIO */ -#define SYS_CTRL2_TS_OFF (1 << 3) /* Bit 3: Switch off clock to temperature sensor */ - -/* SPI interface configuration */ - -#define SPI_CFG_SPI_CLK_MOD0 (1 << 0) /* Bit 0: Value of SCAD/A0 pin at power-up reset */ -#define SPI_CFG_SPI_CLK_MOD1 (1 << 1) /* Bit 1: Value of SCAD/A0 pin at power-up reset */ -#define SPI_CFG_AUTO_INCR (1 << 2) /* Bit 2: Enable internally autoincremented addressing */ - -/* Interrupt control register */ - -#define INT_CTRL_GLOBAL_INT (1 << 0) /* Bit 0: Master interrupt enable */ -#define INT_CTRL_INT_TYPE (1 << 1) /* Bit 1: Type of interrupt signal. 1=edge */ -#define INT_CTRL_INT_POLARITY (1 << 2) /* Bit 2: Interrupt pin polarity. 1=active high */ - -/* Interrupt enable/status register */ - -#define INT_TOUCH_DET (1 << 0) /* Bit 0: Touch is detected */ -#define INT_FIFO_TH (1 << 1) /* Bit 1: FIFO is equal or above threshold value */ -#define INT_FIFO_OFLOW (1 << 2) /* Bit 2: FIFO is overflowed */ -#define INT_FIFO_FULL (1 << 3) /* Bit 3: FIFO is full */ -#define INT_FIFO_EMPTY (1 << 4) /* Bit 4: FIFO is empty */ -#define INT_TEMP_SENS (1 << 5) /* Bit 5: Temperature threshold triggering */ -#define INT_ADC (1 << 6) /* Bit 6: Any enabled ADC interrupts */ -#define INT_GPIO (1 << 7) /* Bit 7: Any enabled GPIO interrupts */ -#define INT_ALL 0xff - -/* GPIO interrupt enable/status register */ - -#define GPIO_INT(n) (1 << (n)) - -/* ADC interrupt enable/status register */ - -#define ADC_INT(n) (1 << (n)) - -/* GPIO set/clear/sta/dir/edge/rising/falling/af registers */ - -#define GPIO_PIN(n) (1 << (n)) -#define TSC_PIN_SET (0xf0) /* Pins 4-7: Used by touchscreen */ - -/* ADC control */ - -#define ADC_CTRL1_REF_SEL (1 << 1) /* Bit 1: Selects internal/external, 1=external */ -#define ADC_CTRL1_MOD_12B (1 << 3) /* Bit 3: Selects 10/12-bit ADC operation, 1=12-bit */ -#define ADC_CTRL1_SAMPLE_TIME_SHIFT (4) /* Bits 4-6: ADC conversion time in number of clock */ -#define ADC_CTRL1_SAMPLE_TIME_MASK (7 << ADC_CTRL1_SAMPLE_TIME_SHIFT) -# define ADC_CTRL1_SAMPLE_TIME_36 (0 << ADC_CTRL1_SAMPLE_TIME_SHIFT) -# define ADC_CTRL1_SAMPLE_TIME_44 (1 << ADC_CTRL1_SAMPLE_TIME_SHIFT) -# define ADC_CTRL1_SAMPLE_TIME_56 (2 << ADC_CTRL1_SAMPLE_TIME_SHIFT) -# define ADC_CTRL1_SAMPLE_TIME_64 (3 << ADC_CTRL1_SAMPLE_TIME_SHIFT) -# define ADC_CTRL1_SAMPLE_TIME_80 (4 << ADC_CTRL1_SAMPLE_TIME_SHIFT) -# define ADC_CTRL1_SAMPLE_TIME_96 (5 << ADC_CTRL1_SAMPLE_TIME_SHIFT) -# define ADC_CTRL1_SAMPLE_TIME_124 (6 << ADC_CTRL1_SAMPLE_TIME_SHIFT) - -/* ADC control */ - -#define ADC_CTRL2_ADC_FREQ_SHIFT (0) /* Bits 0-1: Selects the clock speed of ADC */ -#define ADC_CTRL2_ADC_FREQ_MASK (3 << ADC_CTRL2_ADC_FREQ_SHIFT) -# define ADC_CTRL2_ADC_FREQ_1p625 (0 << ADC_CTRL2_ADC_FREQ_SHIFT) /* 00: 1.625 MHz typ. */ -# define ADC_CTRL2_ADC_FREQ_3p25 (1 << ADC_CTRL2_ADC_FREQ_SHIFT) /* 01: 3.25 MHz typ. */ -# define ADC_CTRL2_ADC_FREQ_6.5 (2 << ADC_CTRL2_ADC_FREQ_SHIFT) /* 1x: 6.5 MHz typ. */ - -/* To initiate ADC data acquisition */ - -#define ADC_CAPT_CH(n) (1 << (n)) - -/* 4-wire touchscreen controller setup */ - -#define TSC_CTRL_EN (1 << 0) /* Bit 0: Enable TSC */ -#define TSC_CTRL_OP_MOD_SHIFT (1) /* Bits 1-3: TSC operating mode */ -#define TSC_CTRL_OP_MOD_MASK (7 << TSC_CTRL_OP_MOD_SHIFT) -# define TSC_CTRL_OP_MOD_XYZ (0 << TSC_CTRL_OP_MOD_SHIFT) /* 000: X, Y, Z acquisition */ -# define TSC_CTRL_OP_MOD_XY (1 << TSC_CTRL_OP_MOD_SHIFT) /* 001: X, Y only */ -# define TSC_CTRL_OP_MOD_X (2 << TSC_CTRL_OP_MOD_SHIFT) /* 010: X only */ -# define TSC_CTRL_OP_MOD_Y (3 << TSC_CTRL_OP_MOD_SHIFT) /* 011: Y only */ -# define TSC_CTRL_OP_MOD_Z (4 << TSC_CTRL_OP_MOD_SHIFT) /* 100: Z only */ -#define TSC_CTRL_TRACK_SHIFT (4) /* Bits 4-6: Tracking index */ -#define TSC_CTRL_TRACK_MASK (7 << TSC_CTRL_TRACK_SHIFT) -#define TSC_CTRL_TRACK_NONE (0 << TSC_CTRL_TRACK_SHIFT) -#define TSC_CTRL_TRACK_4 (1 << TSC_CTRL_TRACK_SHIFT) -#define TSC_CTRL_TRACK_8 (2 << TSC_CTRL_TRACK_SHIFT) -#define TSC_CTRL_TRACK_16 (3 << TSC_CTRL_TRACK_SHIFT) -#define TSC_CTRL_TRACK_32 (4 << TSC_CTRL_TRACK_SHIFT) -#define TSC_CTRL_TRACK_64 (5 << TSC_CTRL_TRACK_SHIFT) -#define TSC_CTRL_TRACK_92 (6 << TSC_CTRL_TRACK_SHIFT) -#define TSC_CTRL_TRACK_127 (7 << TSC_CTRL_TRACK_SHIFT) -#define TSC_CTRL_TSC_STA (1 << 7) /* Bit 7: TSC status. 1=touch detected */ - -/* Touchscreen controller configuration */ - -#define TSC_CFG_SETTLING_SHIFT (0) /* Bits 0-2: Panel driver settling time */ -#define TSC_CFG_SETTLING_MASK (7 << TSC_CFG_SETTLING_SHIFT) -# define TSC_CFG_SETTLING_10US (0 << TSC_CFG_SETTLING_SHIFT) -# define TSC_CFG_SETTLING_100US (1 << TSC_CFG_SETTLING_SHIFT) -# define TSC_CFG_SETTLING_500US (2 << TSC_CFG_SETTLING_SHIFT) -# define TSC_CFG_SETTLING_1MS (3 << TSC_CFG_SETTLING_SHIFT) -# define TSC_CFG_SETTLING_5MS (4 << TSC_CFG_SETTLING_SHIFT) -# define TSC_CFG_SETTLING_10MS (5 << TSC_CFG_SETTLING_SHIFT) -# define TSC_CFG_SETTLING_50MS (6 << TSC_CFG_SETTLING_SHIFT) -# define TSC_CFG_SETTLING_100MS (7 << TSC_CFG_SETTLING_SHIFT) -#define TSC_CFG_TOUCH_DELAY_SHIFT (3) /* Bits 3-5: Touch detect delay */ -#define TSC_CFG_TOUCH_DELAY_MASK (7 << TSC_CFG_TOUCH_DELAY_SHIFT) -# define TSC_CFG_TOUCH_DELAY_10US (0 << TSC_CFG_TOUCH_DELAY_SHIFT) -# define TSC_CFG_TOUCH_DELAY_50US (1 << TSC_CFG_TOUCH_DELAY_SHIFT) -# define TSC_CFG_TOUCH_DELAY_100US (2 << TSC_CFG_TOUCH_DELAY_SHIFT) -# define TSC_CFG_TOUCH_DELAY_500US (3 << TSC_CFG_TOUCH_DELAY_SHIFT) -# define TSC_CFG_TOUCH_DELAY_1MS (4 << TSC_CFG_TOUCH_DELAY_SHIFT) -# define TSC_CFG_TOUCH_DELAY_5MS (5 << TSC_CFG_TOUCH_DELAY_SHIFT) -# define TSC_CFG_TOUCH_DELAY_10MS (6 << TSC_CFG_TOUCH_DELAY_SHIFT) -# define TSC_CFG_TOUCH_DELAY_50MS (7 << TSC_CFG_TOUCH_DELAY_SHIFT) -#define TSC_CFG_AVE_CTRL_SHIFT (6) /* Bits 6-7: Average control */ -#define TSC_CFG_AVE_CTRL_MASK (3 << TSC_CFG_AVE_CTRL_SHIFT) -# define TSC_CFG_AVE_CTRL_1SAMPLE (0 << TSC_CFG_AVE_CTRL_SHIFT) -# define TSC_CFG_AVE_CTRL_2SAMPLES (1 << TSC_CFG_AVE_CTRL_SHIFT) -# define TSC_CFG_AVE_CTRL_4SAMPLES (2 << TSC_CFG_AVE_CTRL_SHIFT) -# define TSC_CFG_AVE_CTRL_8SAMPLES (3 << TSC_CFG_AVE_CTRL_SHIFT) - -/* Current status of FIFO */ - -#define FIFO_STA_FIFO_RESET (1 << 0) /* Bit 0: Resets FIFO. All data in FIFO are cleared */ -#define FIFO_STA_FIFO_TH_TRIG (1 << 4) /* Bit 0: 1 = FIFO size is at or beyond threshold */ -#define FIFO_STA_FIFO_EMPTY (1 << 5) /* Bit 0: FIFO is empty */ -#define FIFO_STA_FIFO_FULL (1 << 6) /* Bit 0: FIFO is full */ -#define FIFO_STA_FIFO_OFLOW (1 << 7) /* Bit 0: FIFO is overflow */ - -/* Touchscreen controller FRACTION_Z */ - -#define TSC_FRACTIONZ_MASK 0x07 - -/* Touchscreen controller drive I */ - -#define TSC_IDRIVE (1 << 0) /* Bit 0: MAX current on TSC driving channel */ -# define TSC_IDRIVE_20MA (0) /* 20mA typical, 35mA max */ -# define TSC_IDRIVE_50MA (1 << 0) /* 50mA typical, 80mA max */ - -/* Touchscreen controller shield */ - -#define TSC_SHIELD_YM (1 << 0) /* Bit 0: Ground Y- */ -#define TSC_SHIELD_YP (1 << 1) /* Bit 1: Ground Y+ */ -#define TSC_SHIELD_XM (1 << 2) /* Bit 2: Ground X- */ -#define TSC_SHIELD_XP (1 << 3) /* Bit 3: Ground X+ */ - -/* Temperature sensor setup */ - -#define TEMP_CTRL_ENABLE (1 << 0) /* Bit 0: Enable */ -#define TEMP_CTRL_ACQ (1 << 1) /* Bit 1: Acquire */ -#define TEMP_CTRL_ACQ_MOD (1 << 2) /* Bit 2: 0=once, 1=every 10MS */ -#define TEMP_CTRL_THRES_EN (1 << 3) /* Bit 3: Threshold enable */ -#define TEMP_CTRL_THRES_RANGE (1 << 4) /* Bit 4: temperature threshold enable, 0='>=' 1='<' */ - -/* GPIO Configuration ***********************************************************************/ -/* The STMPE811 GPIO interfaces take an 8-bit bit-encoded parameter to describe the GPIO pin. - * The following definitions describe the bit-encoding of that parameter. - * - * 7654 3210 - * ---- ---- - * DIRF VPPP - * - * Input Pins: 1IRF .PPP - * - * Output Pins: 0... VPPP - * - * Bits 7 is the pin direction. - */ - -#define STMPE811_GPIO_DIR (1 << 7) /* Bit7: Direction bit */ -#define STMPE811_GPIO_INPUT (1 << 7) /* Input pin (possibly interrupting) */ -#define STMPE811_GPIO_OUTPUT (0) /* Configure as in output */ - -/* Bit 6 indicates that the pin will generate an interrupt (inputs only) */ - -#define STMPE811_GPIO_IN (1 << 6) /* Bit 6: Input interrupting pin */ - -/* The bits 4-5 select the rising and/or the falling edge detection. */ - -#define STMPE811_GPIO_RISING (1 << 5) /* Bit 5: Input interrupting pin */ -#define STMPE811_GPIO_FALLING (1 << 4) /* Bit 4: Input interrupting pin */ - -/* Bit 3 is the initial value for output pins */ - -#define STMPE811_GPIO_VALUE (1 << 3) /* Bit 3: The initial value of an output pin */ -# define STMPE811_GPIO_ONE (1 << 3) /* Bit 3: The initial value is logic 1 */ -# define STMPE811_GPIO_ZERO (0) /* Bit 3: The initial value is logic 0 */ - -/* Bits 0-2 is the pin number */ - -#define STMPE811_GPIO_PIN_SHIFT (0) -#define STMPE811_GPIO_PIN_MASK (7 << STMPE811_GPIO_PIN_SHIFT) -# define STMPE811_GPIO_PIN0 (0 << STMPE811_GPIO_PIN_SHIFT) -# define STMPE811_GPIO_PIN1 (1 << STMPE811_GPIO_PIN_SHIFT) -# define STMPE811_GPIO_PIN2 (2 << STMPE811_GPIO_PIN_SHIFT) -# define STMPE811_GPIO_PIN3 (3 << STMPE811_GPIO_PIN_SHIFT) -# define STMPE811_GPIO_PIN4 (4 << STMPE811_GPIO_PIN_SHIFT) -# define STMPE811_GPIO_PIN5 (5 << STMPE811_GPIO_PIN_SHIFT) -# define STMPE811_GPIO_PIN6 (6 << STMPE811_GPIO_PIN_SHIFT) -# define STMPE811_GPIO_PIN7 (7 << STMPE811_GPIO_PIN_SHIFT) - -/******************************************************************************************** - * Public Types - ********************************************************************************************/ - -/* Form of the GPIO "interrupt handler" callback. Callbacks do not occur from an interrupt - * handler but rather from the context of the worker thread with interrupts enabled. - */ - -typedef void (*stmpe811_handler_t)(int pin); - -/* A reference to a structure of this type must be passed to the STMPE811 driver when the - * driver is instantiaed. This structure provides information about the configuration of the - * STMPE811 and provides some board-specific hooks. - * - * Memory for this structure is provided by the caller. It is not copied by the driver - * and is presumed to persist while the driver is active. The memory must be writable - * because, under certain circumstances, the driver may modify the frequency. - */ - -struct stmpe811_config_s -{ - /* Device characterization */ - -#ifdef CONFIG_STMPE811_I2C - uint8_t address; /* 7-bit I2C address (only bits 0-6 used) */ -#endif - uint32_t frequency; /* I2C or SPI frequency */ - - /* If multiple STMPE811 devices are supported, then an IRQ number must - * be provided for each so that their interrupts can be distinguished. - */ - -#ifdef CONFIG_STMPE811_MULTIPLE - int irq; /* IRQ number received by interrupt handler. */ -#endif - - /* These are the timing valuses for ADC CTRL1 and CTRL2. These values - * are only used if either the TSC or the ADC are enabled. These values - * determine the characteristics of sampling. - */ - -#if !defined(CONFIG_STMPE811_ADC_DISABLE) || !defined(CONFIG_STMPE811_TSC_DISABLE) - uint8_t ctrl1; /* Initialization value for ADC CTRL1 */ - uint8_t ctrl2; /* Initialization value for ADC CTRL1 */ -#endif - - /* IRQ/GPIO access callbacks. These operations all hidden behind - * callbacks to isolate the STMPE811 driver from differences in GPIO - * interrupt handling by varying boards and MCUs. - * - * attach - Attach the STMPE811 interrupt handler to the GPIO interrupt - * enable - Enable or disable the GPIO interrupt - * clear - Acknowledge/clear any pending GPIO interrupt - */ - - int (*attach)(FAR struct stmpe811_config_s *state, xcpt_t isr); - void (*enable)(FAR struct stmpe811_config_s *state, bool enable); - void (*clear)(FAR struct stmpe811_config_s *state); -}; - -/* Since the STMPE811 is a multi-function device, no functionality is assumed when the device - * is first created. Rather, a multi-step initialization is required. When - * stmpe811_instantiate is called, it returns a handle of the following type. That handle may - * then be used to enable a configure the STMPE811 functionality. - */ - -typedef FAR void *STMPE811_HANDLE; - -/******************************************************************************************** - * Public Function Prototypes - ********************************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/******************************************************************************************** - * Name: stmpe811_instantiate - * - * Description: - * Instantiate and configure the STMPE811 device driver to use the provided I2C or SPI - * device instance. - * - * Input Parameters: - * dev - An I2C or SPI driver instance - * config - Persistant board configuration data - * - * Returned Value: - * A non-zero handle is returned on success. This handle may then be used to configure - * the STMPE811 driver as necessary. A NULL handle value is returned on failure. - * - ********************************************************************************************/ - -#ifdef CONFIG_STMPE811_SPI -EXTERN STMPE811_HANDLE stmpe811_instantiate(FAR struct spi_dev_s *dev, - FAR struct stmpe811_config_s *config); -#else -EXTERN STMPE811_HANDLE stmpe811_instantiate(FAR struct i2c_dev_s *dev, - FAR struct stmpe811_config_s *config); -#endif - -/******************************************************************************************** - * Name: stmpe811_register - * - * Description: - * Enable TSC functionality. GPIO4-7 must be available. This function will register the - * touchsceen driver as /dev/inputN where N is the minor device number - * - * Input Parameters: - * handle - The handle previously returned by stmpe811_instantiate - * minor - The input device minor number - * - * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is returned to indicate - * the nature of the failure. - * - ********************************************************************************************/ - -#ifndef CONFIG_STMPE811_TSC_DISABLE -EXTERN int stmpe811_register(STMPE811_HANDLE handle, int minor); -#endif - -/******************************************************************************************** - * Name: stmpe811_gpioconfig - * - * Description: - * Configure an STMPE811 GPIO pin - * - * Input Parameters: - * handle - The handle previously returned by stmpe811_instantiate - * pinconfig - Bit-encoded pin configuration - * - * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is returned to indicate - * the nature of the failure. - * - ********************************************************************************************/ - -#ifndef CONFIG_STMPE811_GPIO_DISABLE -EXTERN int stmpe811_gpioconfig(STMPE811_HANDLE handle, uint8_t pinconfig); -#endif - -/******************************************************************************************** - * Name: stmpe811_gpiowrite - * - * Description: - * Set or clear the GPIO output - * - * Input Parameters: - * handle - The handle previously returned by stmpe811_instantiate - * pinconfig - Bit-encoded pin configuration - * value = true: write logic '1'; false: write logic '0; - * - * Returned Value: - * None - * - ********************************************************************************************/ - -#ifndef CONFIG_STMPE811_GPIO_DISABLE -EXTERN void stmpe811_gpiowrite(STMPE811_HANDLE handle, uint8_t pinconfig, bool value); -#endif - -/******************************************************************************************** - * Name: stmpe811_gpioread - * - * Description: - * Set or clear the GPIO output - * - * Input Parameters: - * handle - The handle previously returned by stmpe811_instantiate - * pinconfig - Bit-encoded pin configuration - * value - The location to return the state of the GPIO pin - * - * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is returned to indicate - * the nature of the failure. - * - ********************************************************************************************/ - -#ifndef CONFIG_STMPE811_GPIO_DISABLE -EXTERN int stmpe811_gpioread(STMPE811_HANDLE handle, uint8_t pinconfig, bool *value); -#endif - -/******************************************************************************************** - * Name: stmpe811_gpioattach - * - * Description: - * Attach to a GPIO interrupt input pin and enable interrupts on the pin. Using the value - * NULL for the handler address will disable interrupts from the pin and detach the handler. - * - * NOTE: Callbacks do not occur from an interrupt handler but rather from the context - * of the worker thread with interrupts enabled. - * - * Input Parameters: - * handle - The handle previously returned by stmpe811_instantiate - * pinconfig - Bit-encoded pin configuration - * handler - The handler that will be called when the interrupt occurs. - * - * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is returned to indicate - * the nature of the failure. - * - ********************************************************************************************/ - -#if !defined(CONFIG_STMPE811_GPIO_DISABLE) && !defined(CONFIG_STMPE811_GPIOINT_DISABLE) -EXTERN int stmpe811_gpioattach(STMPE811_HANDLE handle, uint8_t pinconfig, - stmpe811_handler_t handler); -#endif - -/******************************************************************************************** - * Name: stmpe811_adcinitialize - * - * Description: - * Configure for ADC mode operation. Set overall ADC ADC timing that applies to all pins. - * - * Input Parameters: - * handle - The handle previously returned by stmpe811_instantiate - * - * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is returned to indicate - * the nature of the failure. - * - ********************************************************************************************/ - -#ifndef CONFIG_STMPE811_ADC_DISABLE -EXTERN int stmpe811_adcinitialize(STMPE811_HANDLE handle); -#endif - -/******************************************************************************************** - * Name: stmpe811_adcconfig - * - * Description: - * Configure a pin for ADC input. - * - * Input Parameters: - * handle - The handle previously returned by stmpe811_instantiate - * pin - The ADC pin number - * - * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is returned to indicate - * the nature of the failure. - * - ********************************************************************************************/ - -#ifndef CONFIG_STMPE811_ADC_DISABLE -EXTERN int stmpe811_adcconfig(STMPE811_HANDLE handle, int pin); -#endif - -/******************************************************************************************** - * Name: stmpe811_adcread - * - * Description: - * Read the converted analog input value from the select pin. - * - * Input Parameters: - * handle - The handle previously returned by stmpe811_instantiate - * pin - The ADC pin number - * - * Returned Value: - * The converted value (there is no error reporting mechanism). - * - ********************************************************************************************/ - -#ifndef CONFIG_STMPE811_ADC_DISABLE -EXTERN uint16_t stmpe811_adcread(STMPE811_HANDLE handle, int pin); -#endif - -/******************************************************************************************** - * Name: stmpe811_tempinitialize - * - * Description: - * Configure the temperature sensor. - * - * Input Parameters: - * handle - The handle previously returned by stmpe811_instantiate - * - * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is returned to indicate - * the nature of the failure. - * - ********************************************************************************************/ - -EXTERN int stmpe811_tempinitialize(STMPE811_HANDLE handle); - -/******************************************************************************************** - * Name: stmpe811_tempread - * - * Description: - * Configure the temperature sensor. - * - * Input Parameters: - * handle - The handle previously returned by stmpe811_instantiate - * - * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is returned to indicate - * the nature of the failure. - * - ********************************************************************************************/ - -EXTERN uint16_t stmpe811_tempread(STMPE811_HANDLE handle); - -/******************************************************************************************** - * Name: stmpe811_tempinterrupt - * - * Description: - * Configure the temperature sensor to sample the temperature periodically. - * Set the temperature threshold to generate an interrupt and notify - * to the client using the provide callback function pointer. - * - * Input Parameters: - * handle - The handle previously returned by stmpe811_instantiate - * threshold - The threshold temperature value - * direction - True: Generate an interrupt if the temperate exceeds the - * threshold value; False: Generate an interrupt if the - * temperature falls below the threshold value. - * callback - The client callback function that will be called when - * the termperature crosses the threshold. - * - * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is returned to indicate - * the nature of the failure. - * - ********************************************************************************************/ -/* Not implemented */ - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_INPUT && CONFIG_INPUT_STMPE811 */ -#endif /* __INCLUDE_NUTTX_INPUT_STMPE811_H */ diff --git a/nuttx/include/nuttx/input/touchscreen.h b/nuttx/include/nuttx/input/touchscreen.h deleted file mode 100644 index 04fc13dd7..000000000 --- a/nuttx/include/nuttx/input/touchscreen.h +++ /dev/null @@ -1,180 +0,0 @@ -/************************************************************************************ - * include/nuttx/input/touchscreen.h - * - * Copyright (C) 2011-2012 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. - * - ************************************************************************************/ - -/* The TOUCHSCREEN driver exports a standard character driver interface. By - * convention, the touchscreen driver is registers as an input device at - * /dev/inputN where N uniquely identifies the driver instance. - * - * This header file documents the generic interface that all NuttX - * touchscreen devices must conform. It adds standards and conventions on - * top of the standard character driver interface. - */ - -#ifndef __INCLUDE_NUTTX_INPUT_TOUCHSCREEN_H -#define __INCLUDE_NUTTX_INPUT_TOUCHSCREEN_H - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include -#include - -#ifdef CONFIG_INPUT - -/************************************************************************************ - * Pre-Processor Definitions - ************************************************************************************/ -/* IOCTL Commands *******************************************************************/ - -#define TSIOC_SETCALIB _TSIOC(0x0001) /* arg: Pointer to int calibration value */ -#define TSIOC_GETCALIB _TSIOC(0x0002) /* arg: Pointer to int calibration value */ -#define TSIOC_SETFREQUENCY _TSIOC(0x0003) /* arg: Pointer to uint32_t frequency value */ -#define TSIOC_GETFREQUENCY _TSIOC(0x0004) /* arg: Pointer to uint32_t frequency value */ - -/* Specific touchscreen drivers may support additional, device specific ioctal - * commands, beginning with this value: - */ - -#define TSIOC_USER 0x0005 /* Lowest, unused TSC ioctl command */ - -/* These definitions provide the meaning of all of the bits that may be - * reported in the struct touch_point_s flags. - */ - -#define TOUCH_DOWN (1 << 0) /* A new touch contact is established */ -#define TOUCH_MOVE (1 << 1) /* Movement occurred with previously reported contact */ -#define TOUCH_UP (1 << 2) /* The touch contact was lost */ -#define TOUCH_ID_VALID (1 << 3) /* Touch ID is uncertain */ -#define TOUCH_POS_VALID (1 << 4) /* Hardware provided a valid X/Y position */ -#define TOUCH_PRESSURE_VALID (1 << 5) /* Hardware provided a valid pressure */ -#define TOUCH_SIZE_VALID (1 << 6) /* Hardware provided a valid H/W contact size */ - -/************************************************************************************ - * Public Types - ************************************************************************************/ - -/* This structure contains information about a single touch point. - * Positional units are device specific. - */ - -struct touch_point_s -{ - uint8_t id; /* Unique identifies contact; Same in all reports for the contact */ - uint8_t flags; /* See TOUCH_* definitions above */ - int16_t x; /* X coordinate of the touch point (uncalibrated) */ - int16_t y; /* Y coordinate of the touch point (uncalibrated) */ - int16_t h; /* Height of touch point (uncalibrated) */ - int16_t w; /* Width of touch point (uncalibrated) */ - uint16_t pressure; /* Touch pressure */ -}; - -/* The typical touchscreen driver is a read-only, input character device driver. - * the driver write() method is not supported and any attempt to open the - * driver in any mode other than read-only will fail. - * - * Data read from the touchscreen device consists only of touch events and - * touch sample data. This is reflected by struct touch_sample_s. This - * structure is returned by either the driver read method. - * - * On some devices, multiple touchpoints may be supported. So this top level - * data structure is a struct touch_sample_s that "contains" a set of touch - * points. Each touch point is managed individually using an ID that identifies - * a touch from first contact until the end of the contact. - */ - -struct touch_sample_s -{ - int npoints; /* The number of touch points in point[] */ - struct touch_point_s point[1]; /* Actual dimension is npoints */ -}; -#define SIZEOF_TOUCH_SAMPLE_S(n) (sizeof(struct touch_sample_s) + ((n)-1)*sizeof(struct touch_point_s)) - -/************************************************************************************ - * Public Function Prototypes - ************************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: arch_tcinitialize - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. - * - * Input Parameters: - * minor - The input device minor number - * - * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is - * returned to indicate the nature of the failure. - * - ****************************************************************************/ - -EXTERN int arch_tcinitialize(int minor); - -/**************************************************************************** - * Name: arch_tcuninitialize - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * uninitialize the touchscreen device. - * - * Input Parameters: - * None - * - * Returned Value: - * None. - * - ****************************************************************************/ - -EXTERN void arch_tcuninitialize(void); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_INPUT */ -#endif /* __INCLUDE_NUTTX_INPUT_TOUCHSCREEN_H */ diff --git a/nuttx/include/nuttx/input/tsc2007.h b/nuttx/include/nuttx/input/tsc2007.h deleted file mode 100644 index c3ddcef5e..000000000 --- a/nuttx/include/nuttx/input/tsc2007.h +++ /dev/null @@ -1,172 +0,0 @@ -/**************************************************************************** - * include/nuttx/input/tsc2007.h - * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * References: - * "1.2V to 3.6V, 12-Bit, Nanopower, 4-Wire Micro TOUCH SCREEN CONTROLLER - * with I2C Interface," SBAS405A March 2007, Revised, March 2009, Texas - * Instruments Incorporated - * - * 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. - * - ****************************************************************************/ - -/* The TSC2007 is an analog interface circuit for a human interface touch - * screen device. All peripheral functions are controlled through the command - * byte and onboard state machines. - */ - -#ifndef __INCLUDE_NUTTX_INPUT_TSC2007_H -#define __INCLUDE_NUTTX_INPUT_TSC2007_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_TSC2007) - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* Maximum number of threads than can be waiting for POLL events */ - -#ifndef CONFIG_TSC2007_NPOLLWAITERS -# define CONFIG_TSC2007_NPOLLWAITERS 2 -#endif - -/* Check for some required settings. This can save the user a lot of time - * in getting the right configuration. - */ - -#ifndef CONFIG_I2C_TRANSFER -# error "CONFIG_I2C_TRANSFER is required in the I2C configuration" -#endif - -#ifdef CONFIG_DISABLE_SIGNALS -# error "Signals are required. CONFIG_DISABLE_SIGNALS must not be selected." -#endif - -#ifndef CONFIG_SCHED_WORKQUEUE -# error "Work queue support required. CONFIG_SCHED_WORKQUEUE must be selected." -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* A reference to a structure of this type must be passed to the TSC2007 - * driver. This structure provides information about the configuration - * of the TSB2007 and provides some board-specific hooks. - * - * Memory for this structure is provided by the caller. It is not copied - * by the driver and is presumed to persist while the driver is active. The - * memory must be writable because, under certain circumstances, the driver - * may modify frequency or X plate resistance values. - */ - -struct tsc2007_config_s -{ - /* Device characterization */ - - uint8_t address; /* 7-bit I2C address (only bits 0-6 used) */ - uint16_t rxplate; /* Calibrated X plate resistance */ - uint32_t frequency; /* I2C frequency */ - - /* If multiple TSC2007 devices are supported, then an IRQ number must - * be provided for each so that their interrupts can be distinguished. - */ - -#ifndef CONFIG_TSC2007_MULTIPLE - int irq; /* IRQ number received by interrupt handler. */ -#endif - - /* IRQ/GPIO access callbacks. These operations all hidden behind - * callbacks to isolate the TSC2007 driver from differences in GPIO - * interrupt handling by varying boards and MCUs. If possible, - * interrupts should be configured on both rising and falling edges - * so that contact and loss-of-contact events can be detected. - * - * attach - Attach the TSC2007 interrupt handler to the GPIO interrupt - * enable - Enable or disable the GPIO interrupt - * clear - Acknowledge/clear any pending GPIO interrupt - * pendown - Return the state of the pen down GPIO input - */ - - int (*attach)(FAR struct tsc2007_config_s *state, xcpt_t isr); - void (*enable)(FAR struct tsc2007_config_s *state, bool enable); - void (*clear)(FAR struct tsc2007_config_s *state); - bool (*pendown)(FAR struct tsc2007_config_s *state); -}; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: tsc2007_register - * - * Description: - * Configure the TSC2007 to use the provided I2C device instance. This - * will register the driver as /dev/inputN where N is the minor device - * number - * - * Input Parameters: - * dev - An I2C driver instance - * config - Persistant board configuration data - * minor - The input device minor number - * - * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is - * returned to indicate the nature of the failure. - * - ****************************************************************************/ - -EXTERN int tsc2007_register(FAR struct i2c_dev_s *dev, - FAR struct tsc2007_config_s *config, - int minor); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_INPUT && CONFIG_INPUT_TSC2007 */ -#endif /* __INCLUDE_NUTTX_INPUT_TSC2007_H */ diff --git a/nuttx/include/nuttx/irq.h b/nuttx/include/nuttx/irq.h deleted file mode 100644 index 0bbb4a18c..000000000 --- a/nuttx/include/nuttx/irq.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** - * include/nuttx/irq.h - * - * 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. - * - ****************************************************************************/ - -#ifndef __INCLUDE_NUTTX_IRQ_H -#define __INCLUDE_NUTTX_IRQ_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#ifndef __ASSEMBLY__ -# include -#endif - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -#ifndef __ASSEMBLY__ -# define irq_detach(isr) irq_attach(isr, NULL) -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* This struct defines the way the registers are stored */ - -#ifndef __ASSEMBLY__ -typedef int (*xcpt_t)(int irq, FAR void *context); -#endif - -/* Now include architecture-specific types */ - -#include - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifndef __ASSEMBLY__ -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -EXTERN int irq_attach(int irq, xcpt_t isr); - -#undef EXTERN -#ifdef __cplusplus -} -#endif -#endif - -#endif /* __INCLUDE_NUTTX_IRQ_H */ - diff --git a/nuttx/include/nuttx/kmalloc.h b/nuttx/include/nuttx/kmalloc.h deleted file mode 100644 index 767809f88..000000000 --- a/nuttx/include/nuttx/kmalloc.h +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** - * include/nuttx/kmalloc.h - * - * 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. - * - ****************************************************************************/ - -#ifndef __INCLUDE_NUTTX_KMALLOC_H -#define __INCLUDE_NUTTX_KMALLOC_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include - -#ifndef CONFIG_NUTTX_KERNEL -# include -# include -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#undef KMALLOC_EXTERN -#if defined(__cplusplus) -# define KMALLOC_EXTERN extern "C" -extern "C" { -#else -# define KMALLOC_EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/* For a monolithic, kernel-mode NuttX build. Special allocators must be - * used. Otherwise, the standard allocators prototyped in stdlib.h may - * be used for both the kernel- and user-mode objects. - */ - -#ifndef CONFIG_NUTTX_KERNEL - -# define kmm_initialize(h,s) mm_initialize(h,s) -# define kmm_addregion(h,s) mm_addregion(h,s) -# define kmm_trysemaphore() mm_trysemaphore() -# define kmm_givesemaphore() mm_givesemaphore() - -# define kmalloc(s) malloc(s) -# define kzalloc(s) zalloc(s) -# define krealloc(p,s) realloc(p,s) -# define kfree(p) free(p) - -#else - -KMALLOC_EXTERN void kmm_initialize(FAR void *heap_start, size_t heap_size); -KMALLOC_EXTERN void kmm_addregion(FAR void *heapstart, size_t heapsize); -KMALLOC_EXTERN int kmm_trysemaphore(void); -KMALLOC_EXTERN void kmm_givesemaphore(void); - -KMALLOC_EXTERN FAR void *kmalloc(size_t); -KMALLOC_EXTERN FAR void *kzalloc(size_t); -KMALLOC_EXTERN FAR void *krealloc(FAR void*, size_t); -KMALLOC_EXTERN void kfree(FAR void*); - -#endif - -/* Functions defined in os_list.c *******************************************/ - -/* Handles memory freed from an interrupt handler */ - -KMALLOC_EXTERN void sched_free(FAR void *address); - -#undef KMALLOC_EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_KMALLOC_H */ diff --git a/nuttx/include/nuttx/lcd/hd4478ou.h b/nuttx/include/nuttx/lcd/hd4478ou.h deleted file mode 100644 index 4bb93fca9..000000000 --- a/nuttx/include/nuttx/lcd/hd4478ou.h +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************************** - * include/nuttx/lcd/hd4478ou.h - * - * Definitions for the Hitachi HD44780U LCD controller (as used in the - * LCD1602). - * - * Copyright (C) 2013 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_NUTTX_HD4478OU_H -#define __INCLUDE_NUTTX_HD4478OU_H - -/******************************************************************************************** - * Included Files - ********************************************************************************************/ -/* Command set: - * - * RS=0 R/W=0 : Command - * RS=0 R/W=1 : Busy/AD, Read CT (see below) - * RS=1 R/W=0 : Write data to CGRAM or DDRAM - * RS=1 R/W=0 : Read data from CGRAM or DDRAM - */ - -#define HD4478OU_CLEAR (0x01) /* Screen Clear, Set AC to 0 */ -#define HD4478OU_RETURN (0x02) /* DDRAM AD=0, return */ -#define HD4478OU_INPUT (0x04) /* Set moving direction of cursor */ -# define HD4478OU_INPUT_SHIFT (1 << 0) /* Shift */ -# define HD4478OU_INPUT_INCR (1 << 1) /* Increment mode */ -# define HD4478OU_INPUT_DECR (0x00) /* Decrement mode */ -#define HD4478OU_DISPLAY (0x08) /* Set display, cursor, blink on/off */ -# define HD4478OU_DISPLAY_BLINK (1 << 0) /* Blink on/off */ -# define HD4478OU_DISPLAY_CURSOR (1 << 1) /* Cursor on/off */ -# define HD4478OU_DISPLAY_ON (1 << 2) /* Display on/off */ -#define HD4478OU_SHIFT (0x10) /* Remove cursor and whole diplay */ -# define HD4478OU_SHIFT_RIGHT (1 << 2) /* Shift right */ -# define HD4478OU_SHIFT_LEFT (0x00) /* Shift right */ -# define HD4478OU_SHIFT_DISPLAY (1 << 3) /* Display shift */ -# define HD4478OU_SHIFT_CURSOR (0x00) /* Cursor shift */ -#define HD4478OU_FUNC (0x20) /* Set DL, display line, font */ -# define HD4478OU_FUNC_F5x10 (1 << 2) /* 5x10 Style */ -# define HD4478OU_FUNC_F5x7 (0x00) /* 5x7 Style */ -# define HD4478OU_FUNC_N1 (1 << 3) /* N=2R */ -# define HD4478OU_FUNC_N0 (0x00) /* N=1R */ -# define HD4478OU_FUNC_DL8D (1 << 4) /* DL=8D, 8-bit interface */ -# define HD4478OU_FUNC_DL4D (0x00) /* DL=4D, 4-bit interface */ -#define HD4478OU_CGRAM_AD(a) (0x40|(a)) /* Set CGRAM AD, send receive data */ -#define HD4478OU_DDRAM_AD(a) (0x80|(a)) /* Set DDRAM AD, send receive data */ - -/* RS=0 R/W=1 : Execute internal function, read AD of CT */ - -#define HD4478OU_BUSY(bf,ac) ((bf) << 7 | (ac)) - -/******************************************************************************************** - * Pre-processor Definitions - ********************************************************************************************/ - -/******************************************************************************************** - * Public Types - ********************************************************************************************/ - -/******************************************************************************************** - * Public Data - ********************************************************************************************/ - -#ifdef __cplusplus -extern "C" -{ -#endif - -/******************************************************************************************** - * Public Function Prototypes - ********************************************************************************************/ - -/******************************************************************************************** - * Name: up_lcd1602_initialize - * - * Description: - * the LCD1602 is an HD4478OU-based LCD from Wave share. This function initializes the - * LCD1602 hardware and registers the character driver as /dev/lcd1602. - * - ********************************************************************************************/ - -int up_lcd1602_initialize(void); - -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_HD4478OU_H */ diff --git a/nuttx/include/nuttx/lcd/lcd.h b/nuttx/include/nuttx/lcd/lcd.h deleted file mode 100644 index 45eb03b0d..000000000 --- a/nuttx/include/nuttx/lcd/lcd.h +++ /dev/null @@ -1,219 +0,0 @@ -/**************************************************************************** - * include/nuttx/lcd/lcd.h - * - * 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. - * - ****************************************************************************/ - -#ifndef __INCLUDE_NUTTX_LCD_H -#define __INCLUDE_NUTTX_LCD_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Friendlier names */ - -#define LCD_FULL_OFF (0) -#define LCD_FULL_ON CONFIG_LCD_MAXPOWER - -#define LCD_MIN_CONTRAST (0) -#define LCD_MAX_CONTRAST CONFIG_LCD_MAXCONTRAST - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ - -/* This structure describes one color plane. Some YUV formats may support - * up to 4 planes (although they probably wouldn't be used on LCD hardware). - * The framebuffer driver provides the video memory address in its - * corresponding fb_planeinfo_s structure. The LCD driver, instead, provides - * methods to transfer data to/from the LCD color plane. - */ - -struct lcd_planeinfo_s -{ - /* LCD Data Transfer ******************************************************/ - /* This method can be used to write a partial raster line to the LCD: - * - * row - Starting row to write to (range: 0 <= row < yres) - * col - Starting column to write to (range: 0 <= col <= xres-npixels) - * buffer - The buffer containing the run to be written to the LCD - * npixels - The number of pixels to write to the LCD - * (range: 0 < npixels <= xres-col) - */ - - int (*putrun)(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, - size_t npixels); - - /* This method can be used to read a partial raster line from the LCD: - * - * row - Starting row to read from (range: 0 <= row < yres) - * col - Starting column to read read (range: 0 <= col <= xres-npixels) - * buffer - The buffer in which to return the run read from the LCD - * npixels - The number of pixels to read from the LCD - * (range: 0 < npixels <= xres-col) - */ - - int (*getrun)(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, - size_t npixels); - - /* Plane color characteristics ********************************************/ - - /* This is working memory allocated by the LCD driver for each LCD device - * and for each color plane. This memory will hold one raster line of data. - * The size of the allocated run buffer must therefore be at least - * (bpp * xres / 8). Actual alignment of the buffer must conform to the - * bitwidth of the underlying pixel type. - * - * If there are multiple planes, they may share the same working buffer - * because different planes will not be operate on concurrently. However, - * if there are multiple LCD devices, they must each have unique run buffers. - */ - - uint8_t *buffer; - - /* This is the number of bits in one pixel. This may be one of {1, 2, 4, - * 8, 16, 24, or 32} unless support for one or more of those resolutions - * has been disabled. - */ - - uint8_t bpp; -}; - -/* This structure defines an LCD interface */ - -struct lcd_dev_s -{ - /* LCD Configuration ******************************************************/ - /* Get information about the LCD video controller configuration and the - * configuration of each LCD color plane. - */ - - int (*getvideoinfo)(FAR struct lcd_dev_s *dev, - FAR struct fb_videoinfo_s *vinfo); - int (*getplaneinfo)(FAR struct lcd_dev_s *dev, unsigned int planeno, - FAR struct lcd_planeinfo_s *pinfo); - - /* LCD RGB Mapping ********************************************************/ - /* The following are provided only if the video hardware supports RGB color - * mapping - */ - -#ifdef CONFIG_FB_CMAP - int (*getcmap)(FAR struct lcd_dev_s *dev, FAR struct fb_cmap_s *cmap); - int (*putcmap)(FAR struct lcd_dev_s *dev, - FAR const struct fb_cmap_s *cmap); -#endif - - /* Cursor Controls ********************************************************/ - /* The following are provided only if the video hardware supports a - * hardware cursor - */ - -#ifdef CONFIG_FB_HWCURSOR - int (*getcursor)(FAR struct lcd_dev_s *dev, - FAR struct fb_cursorattrib_s *attrib); - int (*setcursor)(FAR struct lcd_dev_s *dev, - FAR struct fb_setcursor_s *settings); -#endif - - /* LCD Specific Controls **************************************************/ - /* Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER: full - * on). On backlit LCDs, this setting may correspond to the backlight - * setting. - */ - - int (*getpower)(struct lcd_dev_s *dev); - - /* Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: full - * on). On backlit LCDs, this setting may correspond to the backlight - * setting. - */ - - int (*setpower)(struct lcd_dev_s *dev, int power); - - /* Get the current contrast setting (0-CONFIG_LCD_MAXCONTRAST) */ - - int (*getcontrast)(struct lcd_dev_s *dev); - - /* Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST) */ - - int (*setcontrast)(struct lcd_dev_s *dev, unsigned int contrast); -}; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: up_lcdinitialize, up_lcdgetdev, up_lcduninitialize - * - * Description: - * If an architecture supports a parallel or serial LCD, then it must - * provide APIs to access the LCD as follows: - * - * up_lcdinitialize - Initialize the LCD video hardware. The initial - * state of the LCD is fully initialized, display - * memory cleared, and the LCD ready to use, but with - * the power setting at 0 (full off). - * up_lcdgetdev - Return a a reference to the LCD object for - * the specified LCD. This allows support for - * multiple LCD devices. - * up_lcduninitialize - Unitialize the LCD support - * - ***************************************************************************/ - -EXTERN int up_lcdinitialize(void); -EXTERN FAR struct lcd_dev_s *up_lcdgetdev(int lcddev); -EXTERN void up_lcduninitialize(void); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_LCD_H */ diff --git a/nuttx/include/nuttx/lcd/mio283qt2.h b/nuttx/include/nuttx/lcd/mio283qt2.h deleted file mode 100644 index 0ae1c5fd7..000000000 --- a/nuttx/include/nuttx/lcd/mio283qt2.h +++ /dev/null @@ -1,149 +0,0 @@ -/************************************************************************************** - * include/nuttx/lcd/mio283qt2.h - * - * Interface definition for the MI0283QT-2 LCD from Multi-Inno Technology Co., Ltd. - * This LCD is based on the Himax HX8347-D LCD controller. - - * Copyright (C) 2012 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_NUTTX_LCD_MIO283QT2_H -#define __INCLUDE_NUTTX_LCD_MIO283QT2_H - -/************************************************************************************** - * Included Files - **************************************************************************************/ - -#include - -#ifdef CONFIG_LCD_MIO283QT2 - -/************************************************************************************** - * Pre-processor Definitions - **************************************************************************************/ -/* Configuration **********************************************************************/ -/* CONFIG_LCD_MIO283QT2 - Enables support for the MIO283QT2-based LCD. - * CONFIG_LCD_NOGETRUN - * NX components need to know if it can read from the LCD or not. If reading from the - * LCD is supported then some graphic operations can be improved. Default: Supported - * CONFIG_LCD_LANDSCAPE - Define for 320x240 display "landscape" support. Default is - * this 320x240 "landscape" orientation. - * CONFIG_LCD_RLANDSCAPE - Define for 320x240 display "reverse landscape" support. - * Default is this 320x240 "landscape" orientation - * CONFIG_LCD_PORTRAIT - Define for 240x320 display "portrait" orientation support. - * Default is this 320x240 "landscape" orientation - * CONFIG_LCD_RPORTRAIT - Define for 240x320 display "reverse portrait" orientation - * support. Default is this 320x240 "landscape" orientation - */ - -/************************************************************************************** - * Public Types - **************************************************************************************/ - -/* This structure defines the interface to the LCD provided by the platform. The - * nature of this interface is hidden from the MIO283QT2 driver. - */ - -struct mio283qt2_lcd_s -{ - /* Interface to write to a MIO283QT2 register. - * - * - select Select the device (as necessary). The meaning of selecting (and - * and deselecting) is not defined. select() will be called before - * starting any sequence of operations. deselect() when that sequence - * of operations is complete. - * - deselect Deselect the device (as necessary) - * - index Set register index - * - read Read data from the LCD (auto-incrementing) - * - write Write data to the LCD (auto-incrementing) - * - backlight Set the backlight power level (0=OFF; CONFIG_LCD_MAXPOWER=MAX) - */ - - void (*select)(FAR struct mio283qt2_lcd_s *dev); - void (*deselect)(FAR struct mio283qt2_lcd_s *dev); - void (*index)(FAR struct mio283qt2_lcd_s *dev, uint8_t index); -#ifndef CONFIG_LCD_NOGETRUN - uint16_t (*read)(FAR struct mio283qt2_lcd_s *dev); -#endif - void (*write)(FAR struct mio283qt2_lcd_s *dev, uint16_t value); - void (*backlight)(FAR struct mio283qt2_lcd_s *dev, int power); - - /* platform-specific data may follow */ -}; - -/************************************************************************************** - * Public Data - **************************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/************************************************************************************** - * Public Function Prototypes - **************************************************************************************/ - -/************************************************************************************** - * Name: mio283qt2_lcdinitialize - * - * Description: - * Initialize the LCD video hardware. The initial state of the LCD is fully - * initialized, display memory cleared, and the LCD ready to use, but with the power - * setting at 0 (full off). - * - **************************************************************************************/ - -EXTERN FAR struct lcd_dev_s *mio283qt2_lcdinitialize(FAR struct mio283qt2_lcd_s *lcd); - -/************************************************************************************** - * Name: mio283qt2_clear - * - * Description: - * This is a non-standard LCD interface. Because of the various rotations, clearing - * the display in the normal way by writing a sequences of runs that covers the - * entire display can be very slow. Here the display is cleared by simply setting - * all GRAM memory to the specified color. - * - **************************************************************************************/ - -EXTERN void mio283qt2_clear(FAR struct lcd_dev_s *dev, uint16_t color); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_LCD_MIO283QT2 */ -#endif /* __INCLUDE_NUTTX_LCD_MIO283QT2_H */ \ No newline at end of file diff --git a/nuttx/include/nuttx/lcd/nokia6100.h b/nuttx/include/nuttx/lcd/nokia6100.h deleted file mode 100644 index 0fb52a40d..000000000 --- a/nuttx/include/nuttx/lcd/nokia6100.h +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************** - * include/nuttx/lcd/nokia6100.h - * Application interface to the Nokia 6100 LCD display - * - * 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 __INCLUDE_NUTTX_NOKIA6100_H -#define __INCLUDE_NUTTX_NOKIA6100_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Nokia 6100 Configuration Settings: - * - * CONFIG_NOKIA6100_SPIMODE - Controls the SPI mode - * CONFIG_NOKIA6100_FREQUENCY - Define to use a different bus frequency - * CONFIG_NOKIA6100_NINTERFACES - Specifies the number of physical Nokia - * 6100 devices that will be supported. - * CONFIG_NOKIA6100_BPP - Device supports 8, 12, and 16 bits per pixel. - * CONFIG_NOKIA6100_S1D15G10 - Selects the Epson S1D15G10 display controller - * CONFIG_NOKIA6100_PCF8833 - Selects the Phillips PCF8833 display controller - * CONFIG_NOKIA6100_BLINIT - Initial backlight setting - * - * The following may need to be tuned for your hardware: - * CONFIG_NOKIA6100_INVERT - Display inversion, 0 or 1, Default: 1 - * CONFIG_NOKIA6100_MY - Display row direction, 0 or 1, Default: 0 - * CONFIG_NOKIA6100_MX - Display column direction, 0 or 1, Default: 1 - * CONFIG_NOKIA6100_V - Display address direction, 0 or 1, Default: 0 - * CONFIG_NOKIA6100_ML - Display scan direction, 0 or 1, Default: 0 - * CONFIG_NOKIA6100_RGBORD - Display RGB order, 0 or 1, Default: 0 - * - * Required LCD driver settings: - * CONFIG_LCD_NOKIA6100 - Enable Nokia 6100 support - * CONFIG_LCD_MAXCONTRAST - must be 63 with the Epson controller and 127 with - * the Phillips controller. - * CONFIG_LCD_MAXPOWER - Maximum value of backlight setting. The backlight - * control is managed outside of the 6100 driver so this value has no - * meaning to the driver. Board-specific logic may place restrictions on - * this value. - */ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/************************************************************************************** - * Name: nokia_lcdinitialize - * - * Description: - * Initialize the NOKIA6100 video hardware. The initial state of the LCD is fully - * initialized, display memory cleared, and the LCD ready to use, but with the power - * setting at 0 (full off == sleep mode). - * - * Input Parameters: - * - * spi - A reference to the SPI driver instance. - * devno - A value in the range of 0 throuh CONFIG_NOKIA6100_NINTERFACES-1. This - * allows support for multiple LCD devices. - * - * Returned Value: - * - * On success, this function returns a reference to the LCD object for the specified - * LCD. NULL is returned on any failure. - * - **************************************************************************************/ - -struct lcd_dev_s; /* see nuttx/lcd.h */ -struct spi_dev_s; /* see nuttx/spi.h */ -EXTERN FAR struct lcd_dev_s *nokia_lcdinitialize(FAR struct spi_dev_s *spi, unsigned int devno); - -/************************************************************************************** - * Name: nokia_backlight - * - * Description: - * The Nokia 6100 backlight is controlled by logic outside of the LCD assembly. This - * function must be provided by board specific logic to manage the backlight. This - * function will receive a power value (0: full off - CONFIG_LCD_MAXPOWER: full on) - * and should set the backlight accordingly. - * - **************************************************************************************/ - -EXTERN int nokia_backlight(unsigned int power); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_NOKIA6100_H */ diff --git a/nuttx/include/nuttx/lcd/p14201.h b/nuttx/include/nuttx/lcd/p14201.h deleted file mode 100644 index 741d4f3de..000000000 --- a/nuttx/include/nuttx/lcd/p14201.h +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** - * include/nuttx/lcd/p14201.h - * Application interface to the RiT P14201 OLED driver - * - * 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 __INCLUDE_NUTTX_P14201_H -#define __INCLUDE_NUTTX_P14201_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* P14201 Configuration Settings: - * - * CONFIG_P14201_SPIMODE - Controls the SPI mode - * CONFIG_P14201_FREQUENCY - Define to use a different bus frequency - * CONFIG_P14201_NINTERFACES - Specifies the number of physical P14201 devices that - * will be supported. - * CONFIG_P14201_FRAMEBUFFER - If defined, accesses will be performed using an in-memory - * copy of the OLEDs GDDRAM. This cost of this buffer is 128 * 96 / 2 = 6Kb. If this - * is defined, then the driver will be fully functional. If not, then it will have the - * following limitations: - * - * - Reading graphics memory cannot be supported, and - * - All pixel writes must be aligned to byte boundaries. - * - * The latter limitation effectively reduces the 128x96 disply to 64x96. - * - * Required LCD driver settings: - * CONFIG_LCD_P14201 - Enable P14201 support - * CONFIG_LCD_MAXCONTRAST should be 255, but any value >0 and <=255 will be accepted. - * CONFIG_LCD_MAXPOWER must be 1 - * - * Required SPI driver settings: - * CONFIG_SPI_CMDDATA - Include support for cmd/data selection. - */ - -/* Some important "colors" */ - -#define RIT_Y4_BLACK 0x00 -#define RIT_Y4_WHITE 0x0f - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/************************************************************************************** - * Name: rit_initialize - * - * Description: - * Initialize the P14201 video hardware. The initial state of the OLED is fully - * initialized, display memory cleared, and the OLED ready to use, but with the power - * setting at 0 (full off == sleep mode). - * - * Input Parameters: - * - * spi - A reference to the SPI driver instance. - * devno - A value in the range of 0 throuh CONFIG_P14201_NINTERFACES-1. This allows - * support for multiple OLED devices. - * - * Returned Value: - * - * On success, this function returns a reference to the LCD object for the specified - * OLED. NULL is returned on any failure. - * - **************************************************************************************/ - -struct lcd_dev_s; /* see nuttx/lcd.h */ -struct spi_dev_s; /* see nuttx/spi.h */ -EXTERN FAR struct lcd_dev_s *rit_initialize(FAR struct spi_dev_s *spi, unsigned int devno); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_P14201_H */ diff --git a/nuttx/include/nuttx/lcd/ssd1289.h b/nuttx/include/nuttx/lcd/ssd1289.h deleted file mode 100644 index 5a113c09f..000000000 --- a/nuttx/include/nuttx/lcd/ssd1289.h +++ /dev/null @@ -1,149 +0,0 @@ -/************************************************************************************** - * include/nuttx/lcd/ssd1289.h - * Definitions for the Solomon Systech SSD1289 LCD controller - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * References: SSD1289, Rev 1.3, Apr 2007, Solomon Systech Limited - * - * 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_NUTTX_LCD_SSD1289_H -#define __INCLUDE_NUTTX_LCD_SSD1289_H - -/************************************************************************************** - * Included Files - **************************************************************************************/ - -#include - -#ifdef CONFIG_LCD_SSD1289 - -/************************************************************************************** - * Pre-processor Definitions - **************************************************************************************/ -/* Configuration **********************************************************************/ -/* CONFIG_LCD_SSD1289 - Enables support for the SSD1289-based LCD. - * CONFIG_LCD_NOGETRUN - * NX components need to know if it can read from the LCD or not. If reading from the - * LCD is supported then some graphic operations can be improved. Default: Supported - * CONFIG_LCD_LANDSCAPE - Define for 320x240 display "landscape" support. Default is - * this 320x240 "landscape" orientation. - * CONFIG_LCD_RLANDSCAPE - Define for 320x240 display "reverse landscape" support. - * Default is this 320x240 "landscape" orientation - * CONFIG_LCD_PORTRAIT - Define for 240x320 display "portrait" orientation support. - * Default is this 320x240 "landscape" orientation - * CONFIG_LCD_RPORTRAIT - Define for 240x320 display "reverse portrait" orientation - * support. Default is this 320x240 "landscape" orientation - */ - -/************************************************************************************** - * Public Types - **************************************************************************************/ - -/* This structure defines the interface to the LCD provided by the platform. The - * nature of this interface is hidden from the SSD1289 driver. - */ - -struct ssd1289_lcd_s -{ - /* Interface to write to a SSD1289 register. - * - * - select Select the device (as necessary). The meaning of selecting (and - * and deselecting) is not defined. select() will be called before - * starting any sequence of operations. deselect() when that sequence - * of operations is complete. - * - deselect Deselect the device (as necessary) - * - index Set register index - * - read Read data from the LCD (auto-incrementing) - * - write Write data to the LCD (auto-incrementing) - * - backlight Set the backlight power level (0=OFF; CONFIG_LCD_MAXPOWER=MAX) - */ - - void (*select)(FAR struct ssd1289_lcd_s *dev); - void (*deselect)(FAR struct ssd1289_lcd_s *dev); - void (*index)(FAR struct ssd1289_lcd_s *dev, uint8_t index); -#ifndef CONFIG_LCD_NOGETRUN - uint16_t (*read)(FAR struct ssd1289_lcd_s *dev); -#endif - void (*write)(FAR struct ssd1289_lcd_s *dev, uint16_t value); - void (*backlight)(FAR struct ssd1289_lcd_s *dev, int power); - - /* platform-specific data may follow */ -}; - -/************************************************************************************** - * Public Data - **************************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/************************************************************************************** - * Public Function Prototypes - **************************************************************************************/ - -/************************************************************************************** - * Name: ssd1289_lcdinitialize - * - * Description: - * Initialize the LCD video hardware. The initial state of the LCD is fully - * initialized, display memory cleared, and the LCD ready to use, but with the power - * setting at 0 (full off). - * - **************************************************************************************/ - -EXTERN FAR struct lcd_dev_s *ssd1289_lcdinitialize(FAR struct ssd1289_lcd_s *lcd); - -/************************************************************************************** - * Name: ssd1289_clear - * - * Description: - * This is a non-standard LCD interface. Because of the various rotations, clearing - * the display in the normal way by writing a sequences of runs that covers the - * entire display can be very slow. Here the display is cleared by simply setting - * all GRAM memory to the specified color. - * - **************************************************************************************/ - -EXTERN void ssd1289_clear(FAR struct lcd_dev_s *dev, uint16_t color); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_LCD_SSD1289 */ -#endif /* __INCLUDE_NUTTX_LCD_SSD1289_H */ \ No newline at end of file diff --git a/nuttx/include/nuttx/lcd/ug-2864ambag01.h b/nuttx/include/nuttx/lcd/ug-2864ambag01.h deleted file mode 100644 index 86362d773..000000000 --- a/nuttx/include/nuttx/lcd/ug-2864ambag01.h +++ /dev/null @@ -1,246 +0,0 @@ -/************************************************************************************** - * include/nuttx/lcd/ug-2864ambag01.h - * - * Driver for Univision UG-2864AMBAG01 OLED display (wih SH1101A controller) in SPI - * mode - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * References: - * 1. Product Specification (Preliminary), Part Name: OEL Display Module, Part ID: - * UG-2864AMBAG01, Doc No: SASI-9015-A, Univision Technology Inc. - * 2. SH1101A, 132 X 64 Dot Matrix OLED/PLED, Preliminary Segment/Common Driver with - * Controller, Sino Wealth - * - * 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_NUTTX_UG_8264AMBAG01_H -#define __INCLUDE_NUTTX_UG_8264AMBAG01_H - -/************************************************************************************** - * Included Files - **************************************************************************************/ - -#include - -#include - -#include - -#ifdef CONFIG_LCD_UG2864AMBAG01 - -/************************************************************************************** - * Pre-processor Definitions - **************************************************************************************/ -/* Configuration **********************************************************************/ -/* UG-2864AMBAG01 Configuration Settings: - * - * CONFIG_UG2864AMBAG01_SPIMODE - Controls the SPI mode - * CONFIG_UG2864AMBAG01_FREQUENCY - Define to use a different bus frequency - * CONFIG_UG2864AMBAG01_NINTERFACES - Specifies the number of physical UG-2864AMBAG01 - * devices that will be supported. - * - * Required LCD driver settings: - * - * CONFIG_LCD_UG28AMBAG01 - Enable UG-2864AMBAG01 support - * CONFIG_LCD_MAXCONTRAST should be 255, but any value >0 and <=255 will be accepted. - * CONFIG_LCD_MAXPOWER must be 1 - * - * Option LCD driver settings: - * CONFIG_LCD_LANDSCAPE, CONFIG_LCD_PORTRAIT, CONFIG_LCD_RLANDSCAPE, and - * CONFIG_LCD_RPORTRAIT - Display orientation. - * - * Required SPI driver settings: - * CONFIG_SPI_CMDDATA - Include support for cmd/data selection. - */ - -/* SPI Interface - * - * "The serial interface consists of serial clock SCL, serial data SI, A0 and - * CS . SI is shifted into an 8-bit shift register on every rising edge of - * SCL in the order of D7, D6, … and D0. A0 is sampled on every eighth clock - * and the data byte in the shift register is written to the display data RAM - * or command register in the same clock." - * - * MODE 3: - * Clock polarity: High (CPOL=1) - * Clock phase: Sample on trailing (rising edge) (CPHA 1) - */ - -#ifndef CONFIG_UG2864AMBAG01_SPIMODE -# define CONFIG_UG2864AMBAG01_SPIMODE SPIDEV_MODE3 -#endif - -/* "This module determines whether the input data is interpreted as data or - * command. When A0 = “H”, the inputs at D7 - D0 are interpreted as data and be - * written to display RAM. When A0 = “L”, the inputs at D7 - D0 are interpreted - * as command, they will be decoded and be written to the corresponding command - * registers. - */ - -#ifndef CONFIG_SPI_CMDDATA -# error "CONFIG_SPI_CMDDATA must be defined in your NuttX configuration" -#endif - -/* CONFIG_UG2864AMBAG01_NINTERFACES determines the number of physical interfaces - * that will be supported. - */ - -#ifndef CONFIG_UG2864AMBAG01_NINTERFACES -# define CONFIG_UG2864AMBAG01_NINTERFACES 1 -#endif - -/* Check contrast selection */ - -#if !defined(CONFIG_LCD_MAXCONTRAST) -# define CONFIG_LCD_MAXCONTRAST 255 -#endif - -#if CONFIG_LCD_MAXCONTRAST <= 0|| CONFIG_LCD_MAXCONTRAST > 255 -# error "CONFIG_LCD_MAXCONTRAST exceeds supported maximum" -#endif - -#if CONFIG_LCD_MAXCONTRAST < 255 -# warning "Optimal setting of CONFIG_LCD_MAXCONTRAST is 255" -#endif - -/* Check power setting */ - -#if !defined(CONFIG_LCD_MAXPOWER) -# define CONFIG_LCD_MAXPOWER 1 -#endif - -#if CONFIG_LCD_MAXPOWER != 1 -# warning "CONFIG_LCD_MAXPOWER exceeds supported maximum" -# undef CONFIG_LCD_MAXPOWER -# define CONFIG_LCD_MAXPOWER 1 -#endif - -/* Color is 1bpp monochrome with leftmost column contained in bits 0 */ - -#ifdef CONFIG_NX_DISABLE_1BPP -# warning "1 bit-per-pixel support needed" -#endif - -/* Orientation */ - -#if defined(CONFIG_LCD_LANDSCAPE) -# undef CONFIG_LCD_PORTRAIT -# undef CONFIG_LCD_RLANDSCAPE -# undef CONFIG_LCD_RPORTRAIT -#elif defined(CONFIG_LCD_PORTRAIT) -# undef CONFIG_LCD_LANDSCAPE -# undef CONFIG_LCD_RLANDSCAPE -# undef CONFIG_LCD_RPORTRAIT -#elif defined(CONFIG_LCD_RLANDSCAPE) -# undef CONFIG_LCD_LANDSCAPE -# undef CONFIG_LCD_PORTRAIT -# undef CONFIG_LCD_RPORTRAIT -#elif defined(CONFIG_LCD_RPORTRAIT) -# undef CONFIG_LCD_LANDSCAPE -# undef CONFIG_LCD_PORTRAIT -# undef CONFIG_LCD_RLANDSCAPE -#else -# define CONFIG_LCD_LANDSCAPE 1 -# warning "Assuming landscape orientation" -#endif - -/* Some important "colors" */ - -#define UG_Y1_BLACK 0 -#define UG_Y1_WHITE 1 - -/************************************************************************************** - * Public Types - **************************************************************************************/ - -/************************************************************************************** - * Public Data - **************************************************************************************/ - -#ifdef __cplusplus -extern "C" -{ -#endif - -/************************************************************************************** - * Public Function Prototypes - **************************************************************************************/ - -/************************************************************************************** - * Name: ug2864ambag01_initialize - * - * Description: - * Initialize the UG-2864AMBAG01 video hardware. The initial state of the - * OLED is fully initialized, display memory cleared, and the OLED ready - * to use, but with the power setting at 0 (full off == sleep mode). - * - * Input Parameters: - * - * spi - A reference to the SPI driver instance. - * devno - A value in the range of 0 through CONFIG_UG2864AMBAG01_NINTERFACES-1. - * This allows support for multiple OLED devices. - * - * Returned Value: - * - * On success, this function returns a reference to the LCD object for - * the specified OLED. NULL is returned on any failure. - * - **************************************************************************************/ - -struct lcd_dev_s; /* See include/nuttx/lcd/lcd.h */ -struct spi_dev_s; /* See include/nuttx/spi.h */ -FAR struct lcd_dev_s *ug2864ambag01_initialize(FAR struct spi_dev_s *spi, - unsigned int devno); - -/************************************************************************************************ - * Name: ug2864ambag01_fill - * - * Description: - * This non-standard method can be used to clear the entire display by writing one - * color to the display. This is much faster than writing a series of runs. - * - * Input Parameters: - * priv - Reference to private driver structure - * - * Assumptions: - * Caller has selected the OLED section. - * - **************************************************************************************/ - -void ug2864ambag01_fill(FAR struct lcd_dev_s *dev, uint8_t color); - -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_LCD_UG2864AMBAG01 */ -#endif /* __INCLUDE_NUTTX_UG_8264AMBAG01_H */ diff --git a/nuttx/include/nuttx/lcd/ug-2864hsweg01.h b/nuttx/include/nuttx/lcd/ug-2864hsweg01.h deleted file mode 100644 index e38741967..000000000 --- a/nuttx/include/nuttx/lcd/ug-2864hsweg01.h +++ /dev/null @@ -1,246 +0,0 @@ -/************************************************************************************** - * include/nuttx/lcd/ug-2864hsweg01.h - * - * Driver for Univision UG-2864HSWEG01 OLED display (wih SSD1306 controller) in SPI - * mode - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * References: - * 1. Product Specification (Preliminary), Part Name: OEL Display Module, Part ID: - * UG-2864HSWEG01, Doc No: SAS1-9046-B, Univision Technology Inc. - * 2. SSD1306, 128 X 64 Dot Matrix OLED/PLED, Preliminary Segment/Common Driver with - * Controller, Solomon Systech - * - * 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_NUTTX_UG_8264HSWEG01_H -#define __INCLUDE_NUTTX_UG_8264HSWEG01_H - -/************************************************************************************** - * Included Files - **************************************************************************************/ - -#include - -#include - -#include - -#ifdef CONFIG_LCD_UG2864HSWEG01 - -/************************************************************************************** - * Pre-processor Definitions - **************************************************************************************/ -/* Configuration **********************************************************************/ -/* UG-2864HSWEG01 Configuration Settings: - * - * CONFIG_UG2864HSWEG01_SPIMODE - Controls the SPI mode - * CONFIG_UG2864HSWEG01_FREQUENCY - Define to use a different bus frequency - * CONFIG_UG2864HSWEG01_NINTERFACES - Specifies the number of physical UG-2864HSWEG01 - * devices that will be supported. - * - * Required LCD driver settings: - * - * CONFIG_LCD_UG28HSWEG01 - Enable UG-2864HSWEG01 support - * CONFIG_LCD_MAXCONTRAST should be 255, but any value >0 and <=255 will be accepted. - * CONFIG_LCD_MAXPOWER must be 1 - * - * Option LCD driver settings: - * CONFIG_LCD_LANDSCAPE, CONFIG_LCD_PORTRAIT, CONFIG_LCD_RLANDSCAPE, and - * CONFIG_LCD_RPORTRAIT - Display orientation. - * - * Required SPI driver settings: - * CONFIG_SPI_CMDDATA - Include support for cmd/data selection. - */ - -/* SPI Interface - * - * "The serial interface consists of serial clock SCL, serial data SI, A0 and - * CS . SI is shifted into an 8-bit shift register on every rising edge of - * SCL in the order of D7, D6, … and D0. A0 is sampled on every eighth clock - * and the data byte in the shift register is written to the display data RAM - * or command register in the same clock." - * - * MODE 3: - * Clock polarity: High (CPOL=1) - * Clock phase: Sample on trailing (rising edge) (CPHA 1) - */ - -#ifndef CONFIG_UG2864HSWEG01_SPIMODE -# define CONFIG_UG2864HSWEG01_SPIMODE SPIDEV_MODE3 -#endif - -/* "This module determines whether the input data is interpreted as data or - * command. When A0 = “H”, the inputs at D7 - D0 are interpreted as data and be - * written to display RAM. When A0 = “L”, the inputs at D7 - D0 are interpreted - * as command, they will be decoded and be written to the corresponding command - * registers. - */ - -#ifndef CONFIG_SPI_CMDDATA -# error "CONFIG_SPI_CMDDATA must be defined in your NuttX configuration" -#endif - -/* CONFIG_UG2864HSWEG01_NINTERFACES determines the number of physical interfaces - * that will be supported. - */ - -#ifndef CONFIG_UG2864HSWEG01_NINTERFACES -# define CONFIG_UG2864HSWEG01_NINTERFACES 1 -#endif - -/* Check contrast selection */ - -#if !defined(CONFIG_LCD_MAXCONTRAST) -# define CONFIG_LCD_MAXCONTRAST 255 -#endif - -#if CONFIG_LCD_MAXCONTRAST <= 0|| CONFIG_LCD_MAXCONTRAST > 255 -# error "CONFIG_LCD_MAXCONTRAST exceeds supported maximum" -#endif - -#if CONFIG_LCD_MAXCONTRAST < 255 -# warning "Optimal setting of CONFIG_LCD_MAXCONTRAST is 255" -#endif - -/* Check power setting */ - -#if !defined(CONFIG_LCD_MAXPOWER) -# define CONFIG_LCD_MAXPOWER 1 -#endif - -#if CONFIG_LCD_MAXPOWER != 1 -# warning "CONFIG_LCD_MAXPOWER exceeds supported maximum" -# undef CONFIG_LCD_MAXPOWER -# define CONFIG_LCD_MAXPOWER 1 -#endif - -/* Color is 1bpp monochrome with leftmost column contained in bits 0 */ - -#ifdef CONFIG_NX_DISABLE_1BPP -# warning "1 bit-per-pixel support needed" -#endif - -/* Orientation */ - -#if defined(CONFIG_LCD_LANDSCAPE) -# undef CONFIG_LCD_PORTRAIT -# undef CONFIG_LCD_RLANDSCAPE -# undef CONFIG_LCD_RPORTRAIT -#elif defined(CONFIG_LCD_PORTRAIT) -# undef CONFIG_LCD_LANDSCAPE -# undef CONFIG_LCD_RLANDSCAPE -# undef CONFIG_LCD_RPORTRAIT -#elif defined(CONFIG_LCD_RLANDSCAPE) -# undef CONFIG_LCD_LANDSCAPE -# undef CONFIG_LCD_PORTRAIT -# undef CONFIG_LCD_RPORTRAIT -#elif defined(CONFIG_LCD_RPORTRAIT) -# undef CONFIG_LCD_LANDSCAPE -# undef CONFIG_LCD_PORTRAIT -# undef CONFIG_LCD_RLANDSCAPE -#else -# define CONFIG_LCD_LANDSCAPE 1 -# warning "Assuming landscape orientation" -#endif - -/* Some important "colors" */ - -#define UG_Y1_BLACK 0 -#define UG_Y1_WHITE 1 - -/************************************************************************************** - * Public Types - **************************************************************************************/ - -/************************************************************************************** - * Public Data - **************************************************************************************/ - -#ifdef __cplusplus -extern "C" -{ -#endif - -/************************************************************************************** - * Public Function Prototypes - **************************************************************************************/ - -/************************************************************************************** - * Name: ug2864hsweg01_initialize - * - * Description: - * Initialize the UG-2864HSWEG01 video hardware. The initial state of the - * OLED is fully initialized, display memory cleared, and the OLED ready - * to use, but with the power setting at 0 (full off == sleep mode). - * - * Input Parameters: - * - * spi - A reference to the SPI driver instance. - * devno - A value in the range of 0 through CONFIG_UG2864HSWEG01_NINTERFACES-1. - * This allows support for multiple OLED devices. - * - * Returned Value: - * - * On success, this function returns a reference to the LCD object for - * the specified OLED. NULL is returned on any failure. - * - **************************************************************************************/ - -struct lcd_dev_s; /* See include/nuttx/lcd/lcd.h */ -struct spi_dev_s; /* See include/nuttx/spi.h */ -FAR struct lcd_dev_s *ug2864hsweg01_initialize(FAR struct spi_dev_s *spi, - unsigned int devno); - -/************************************************************************************************ - * Name: ug2864hsweg01_fill - * - * Description: - * This non-standard method can be used to clear the entire display by writing one - * color to the display. This is much faster than writing a series of runs. - * - * Input Parameters: - * priv - Reference to private driver structure - * - * Assumptions: - * Caller has selected the OLED section. - * - **************************************************************************************/ - -void ug2864hsweg01_fill(FAR struct lcd_dev_s *dev, uint8_t color); - -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_LCD_UG2864HSWEG01 */ -#endif /* __INCLUDE_NUTTX_UG_8264HSWEG01_H */ diff --git a/nuttx/include/nuttx/lcd/ug-9664hswag01.h b/nuttx/include/nuttx/lcd/ug-9664hswag01.h deleted file mode 100644 index a60b5ed67..000000000 --- a/nuttx/include/nuttx/lcd/ug-9664hswag01.h +++ /dev/null @@ -1,154 +0,0 @@ -/**************************************************************************** - * include/nuttx/lcd/ug-9664hswag01.h - * - * Driver for the Univision UG-9664HSWAG01 Display with the Solomon Systech - * SSD1305 LCD controller. - * - * Copyright (C) 2011-2012 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_NUTTX_UG_9664HSWAG01_H -#define __INCLUDE_NUTTX_UG_9664HSWAG01_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* UG-9664HSWAG01 Configuration Settings: - * - * CONFIG_UG9664HSWAG01_SPIMODE - Controls the SPI mode - * CONFIG_UG9664HSWAG01_FREQUENCY - Define to use a different bus frequency - * CONFIG_UG9664HSWAG01_NINTERFACES - Specifies the number of physical - * UG-9664HSWAG01 devices that will be supported. NOTE: At present, this - * must be undefined or defined to be 1. - * CONFIG_UG9664HSWAG01_POWER - * If the hardware supports a controllable OLED a power supply, this - * configuration shold be defined. (See ug_power() below). - * - * Required LCD driver settings: - * CONFIG_LCD_UG9664HSWAG01 - Enable UG-9664HSWAG01 support - * CONFIG_LCD_MAXCONTRAST should be 255, but any value >0 and <=255 will be accepted. - * CONFIG_LCD_MAXPOWER should be 2: 0=off, 1=dim, 2=normal - * - * Required SPI driver settings: - * CONFIG_SPI_CMDDATA - Include support for cmd/data selection. - */ - -/* Some important "colors" */ - -#define UG_Y1_BLACK 0 -#define UG_Y1_WHITE 1 - -/* Only three power settings are supported: */ - -#define UG_POWER_OFF 0 -#define UG_POWER_DIM 1 -#define UG_POWER_ON 2 - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -extern "C" -{ -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Name: ug_initialize - * - * Description: - * Initialize the UG-9664HSWAG01 video hardware. The initial state of the - * OLED is fully initialized, display memory cleared, and the OLED ready - * to use, but with the power setting at 0 (full off == sleep mode). - * - * Input Parameters: - * - * spi - A reference to the SPI driver instance. - * devno - A value in the range of 0 through CONFIG_UG9664HSWAG01_NINTERFACES-1. - * This allows support for multiple OLED devices. - * - * Returned Value: - * - * On success, this function returns a reference to the LCD object for - * the specified OLED. NULL is returned on any failure. - * - ****************************************************************************/ - -struct lcd_dev_s; /* see nuttx/lcd.h */ -struct spi_dev_s; /* see nuttx/spi.h */ -FAR struct lcd_dev_s *ug_initialize(FAR struct spi_dev_s *spi, unsigned int devno); - -/**************************************************************************** - * Name: ug_power - * - * Description: - * If the hardware supports a controllable OLED a power supply, this - * interface should be provided. It may be called by the driver to turn - * the OLED power on and off as needed. - * - * Input Parameters: - * - * devno - A value in the range of 0 throuh CONFIG_UG9664HSWAG01_NINTERFACES-1. - * This allows support for multiple OLED devices. - * on - true:turn power on, false: turn power off. - * - * Returned Value: - * None - * - **************************************************************************************/ - -#ifdef CONFIG_UG9664HSWAG01_POWER -void ug_power(unsigned int devno, bool on); -#else -# define ug_power(a,b) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_UG_9664HSWAG01_H */ diff --git a/nuttx/include/nuttx/lib.h b/nuttx/include/nuttx/lib.h deleted file mode 100644 index 3bc581e18..000000000 --- a/nuttx/include/nuttx/lib.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** - * include/nuttx/lib.h - * Non-standard, internal APIs available in lib/. - * - * Copyright (C) 2007-2009, 2012-2013 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_NUTTX_LIB_H -#define __INCLUDE_NUTTX_LIB_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifndef __ASSEMBLY__ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/* Functions contained in lib_init.c ****************************************/ - -void weak_function lib_initialize(void); -#if CONFIG_NFILE_STREAMS > 0 -void lib_streaminit(FAR struct streamlist *list); -void lib_releaselist(FAR struct streamlist *list); -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __ASSEMBLY__ */ -#endif /* __INCLUDE_NUTTX_LIB_H */ diff --git a/nuttx/include/nuttx/math.h b/nuttx/include/nuttx/math.h deleted file mode 100644 index aaadb9c91..000000000 --- a/nuttx/include/nuttx/math.h +++ /dev/null @@ -1,329 +0,0 @@ -/**************************************************************************** - * include/nuttx/math.h - * - * Copyright (C) 2009, 2012 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_NUTTX_MATH_H -#define __INCLUDE_NUTTX_MATH_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/* If CONFIG_ARCH_MATH_H is defined, then the top-level Makefile will copy - * this header file to include/math.h where it will become the system math.h - * header file. In this case, the architecture specific code must provide - * an arch//include/math.h file which will be included below: - */ - -#ifdef CONFIG_ARCH_MATH_H -# include - -/* If CONFIG_LIB is enabled, then the math library at lib/math will be - * built. This library was taken from the math library developed for the - * Rhombus OS by Nick Johnson (https://github.com/nickbjohnson4224/rhombus). - * The port or the Rhombus math library was contributed by Darcy Gong. - */ - -#else if defined CONFIG_LIBM - -/**************************************************************************** - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* General Constants ********************************************************/ - -#define INFINITY (1.0/0.0) -#define NAN (0.0/0.0) -#define HUGE_VAL INFINITY - -#define isnan(x) ((x) != (x)) -#define isinf(x) (((x) == INFINITY) || ((x) == -INFINITY)) - -/* Exponential and Logarithmic constants ************************************/ - -#define M_E 2.7182818284590452353602874713526625 -#define M_SQRT2 1.4142135623730950488016887242096981 -#define M_SQRT1_2 0.7071067811865475244008443621048490 -#define M_LOG2E 1.4426950408889634073599246810018921 -#define M_LOG10E 0.4342944819032518276511289189166051 -#define M_LN2 0.6931471805599453094172321214581765 -#define M_LN10 2.3025850929940456840179914546843642 - -/* Trigonometric Constants **************************************************/ - -#define M_PI 3.1415926535897932384626433832795029 -#define M_PI_2 1.5707963267948966192313216916397514 -#define M_PI_4 0.7853981633974483096156608458198757 -#define M_1_PI 0.3183098861837906715377675267450287 -#define M_2_PI 0.6366197723675813430755350534900574 -#define M_2_SQRTPI 1.1283791670955125738961589031215452 - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#if defined(__cplusplus) -extern "C" { -#endif - -/* General Functions ********************************************************/ - -float ceilf (float x); -#if CONFIG_HAVE_DOUBLE -double ceil (double x); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double ceill (long double x); -#endif - -float floorf(float x); -#if CONFIG_HAVE_DOUBLE -double floor (double x); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double floorl(long double x); -#endif - -float roundf(float x); -#if CONFIG_HAVE_DOUBLE -double round (double x); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double roundl(long double x); -#endif - -float fabsf (float x); -#if CONFIG_HAVE_DOUBLE -double fabs (double x); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double fabsl (long double x); -#endif - -float modff (float x, float *iptr); -#if CONFIG_HAVE_DOUBLE -double modf (double x, double *iptr); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double modfl (long double x, long double *iptr); -#endif - -float fmodf (float x, float div); -#if CONFIG_HAVE_DOUBLE -double fmod (double x, double div); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double fmodl (long double x, long double div); -#endif - -/* Exponential and Logarithmic Functions ************************************/ - -float powf (float b, float e); -#if CONFIG_HAVE_DOUBLE -double pow (double b, double e); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double powl (long double b, long double e); -#endif - -float expf (float x); -#if CONFIG_HAVE_DOUBLE -double exp (double x); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double expl (long double x); -#endif - -float logf (float x); -#if CONFIG_HAVE_DOUBLE -double log (double x); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double logl (long double x); -#endif - -float log10f(float x); -#if CONFIG_HAVE_DOUBLE -double log10 (double x); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double log10l(long double x); -#endif - -float log2f (float x); -#if CONFIG_HAVE_DOUBLE -double log2 (double x); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double log2l (long double x); -#endif - -float sqrtf (float x); -#if CONFIG_HAVE_DOUBLE -double sqrt (double x); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double sqrtl (long double x); -#endif - -float ldexpf(float x, int n); -#if CONFIG_HAVE_DOUBLE -double ldexp (double x, int n); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double ldexpl(long double x, int n); -#endif - -float frexpf(float x, int *exp); -#if CONFIG_HAVE_DOUBLE -double frexp (double x, int *exp); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double frexpl(long double x, int *exp); -#endif - -/* Trigonometric Functions **************************************************/ - -float sinf (float x); -#if CONFIG_HAVE_DOUBLE -double sin (double x); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double sinl (long double x); -#endif - -float cosf (float x); -#if CONFIG_HAVE_DOUBLE -double cos (double x); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double cosl (long double x); -#endif - -float tanf (float x); -#if CONFIG_HAVE_DOUBLE -double tan (double x); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double tanl (long double x); -#endif - -float asinf (float x); -#if CONFIG_HAVE_DOUBLE -double asin (double x); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double asinl (long double x); -#endif - -float acosf (float x); -#if CONFIG_HAVE_DOUBLE -double acos (double x); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double acosl (long double x); -#endif - -float atanf (float x); -#if CONFIG_HAVE_DOUBLE -double atan (double x); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double atanl (long double x); -#endif - -float atan2f(float y, float x); -#if CONFIG_HAVE_DOUBLE -double atan2 (double y, double x); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double atan2l(long double y, long double x); -#endif - -float sinhf (float x); -#if CONFIG_HAVE_DOUBLE -double sinh (double x); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double sinhl (long double x); -#endif - -float coshf (float x); -#if CONFIG_HAVE_DOUBLE -double cosh (double x); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double coshl (long double x); -#endif - -float tanhf (float x); -#if CONFIG_HAVE_DOUBLE -double tanh (double x); -#endif -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double tanhl (long double x); -#endif - -#if defined(__cplusplus) -} -#endif - -#endif /* CONFIG_LIBM */ -#endif /* __INCLUDE_NUTTX_MATH_H */ diff --git a/nuttx/include/nuttx/mm.h b/nuttx/include/nuttx/mm.h deleted file mode 100644 index cabab2619..000000000 --- a/nuttx/include/nuttx/mm.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** - * include/nuttx/mm.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 __INCLUDE_NUTTX_MM_H -#define __INCLUDE_NUTTX_MM_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Global Data - ****************************************************************************/ - -/**************************************************************************** - * Global Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Global Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/* Functions contained in mm_initialize.c ***********************************/ - -EXTERN void mm_initialize(FAR void *heap_start, size_t heap_size); -EXTERN void mm_addregion(FAR void *heapstart, size_t heapsize); - -/* Functions contained in mm_sem.c ******************************************/ - -EXTERN int mm_trysemaphore(void); -EXTERN void mm_givesemaphore(void); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_MM_H */ diff --git a/nuttx/include/nuttx/mmcsd.h b/nuttx/include/nuttx/mmcsd.h deleted file mode 100644 index 819613ede..000000000 --- a/nuttx/include/nuttx/mmcsd.h +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** - * include/nuttx/mmcsd.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 __INCLUDE_NUTTX_MMCSD_H -#define __INCLUDE_NUTTX_MMCSD_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: mmcsd_slotinitialize - * - * Description: - * Initialize one slot for operation using the MMC/SD interface - * - * Input Parameters: - * minor - The MMC/SD minor device number. The MMC/SD device will be - * registered as /dev/mmcsdN where N is the minor number - * dev - And instance of an MMC/SD interface. The MMC/SD hardware should - * be initialized and ready to use. - * - ****************************************************************************/ - -struct sdio_dev_s; /* See nuttx/sdio.h */ -EXTERN int mmcsd_slotinitialize(int minor, FAR struct sdio_dev_s *dev); - -/**************************************************************************** - * Name: mmcsd_spislotinitialize - * - * Description: - * Initialize one slot for operation using the SPI MMC/SD interface - * - * Input Parameters: - * minor - The MMC/SD minor device number. The MMC/SD device will be - * registered as /dev/mmcsdN where N is the minor number - * slotno - The slot number to use. This is only meaningful for architectures - * that support multiple MMC/SD slots. This value must be in the range - * {0, ..., CONFIG_MMCSD_NSLOTS}. - * spi - And instance of an SPI interface obtained by called - * up_spiinitialize() with the appropriate port number (see spi.h) - * - ****************************************************************************/ - -struct spi_dev_s; /* See nuttx/spi.h */ -EXTERN int mmcsd_spislotinitialize(int minor, int slotno, FAR struct spi_dev_s *spi); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_MMCSD_H */ diff --git a/nuttx/include/nuttx/mqueue.h b/nuttx/include/nuttx/mqueue.h deleted file mode 100644 index 43c0aab6e..000000000 --- a/nuttx/include/nuttx/mqueue.h +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** - * include/nuttx/mqueue.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 ___INCLUDE_NUTTX_MQUEUE_H -#define ___INCLUDE_NUTTX_MQUEUE_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#include -#include -#include -#include -#include -#include - -#if CONFIG_MQ_MAXMSGSIZE > 0 - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Global Type Declarations - ****************************************************************************/ - -/* This structure defines a message queue */ - -struct mq_des; /* forward reference */ - -struct msgq_s -{ - FAR struct msgq_s *flink; /* Forward link to next message queue */ - sq_queue_t msglist; /* Prioritized message list */ - int16_t maxmsgs; /* Maximum number of messages in the queue */ - int16_t nmsgs; /* Number of message in the queue */ - int16_t nconnect; /* Number of connections to message queue */ - int16_t nwaitnotfull; /* Number tasks waiting for not full */ - int16_t nwaitnotempty; /* Number tasks waiting for not empty */ - uint8_t maxmsgsize; /* Max size of message in message queue */ - bool unlinked; /* true if the msg queue has been unlinked */ -#ifndef CONFIG_DISABLE_SIGNALS - FAR struct mq_des *ntmqdes; /* Notification: Owning mqdes (NULL if none) */ - pid_t ntpid; /* Notification: Receiving Task's PID */ - int ntsigno; /* Notification: Signal number */ - union sigval ntvalue; /* Notification: Signal value */ -#endif - char name[1]; /* Start of the queue name */ -}; - -typedef struct msgq_s msgq_t; - -#define SIZEOF_MQ_HEADER ((int)(((msgq_t*)NULL)->name)) - -/* This describes the message queue descriptor that is held in the - * task's TCB - */ - -struct mq_des -{ - FAR struct mq_des *flink; /* Forward link to next message descriptor */ - FAR msgq_t *msgq; /* Pointer to associated message queue */ - int oflags; /* Flags set when message queue was opened */ -}; - -/**************************************************************************** - * Global Variables - ****************************************************************************/ - -/**************************************************************************** - * Global Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_MQ_MAXMSGSIZE > 0 */ -#endif /* ___INCLUDE_NUTTX_MQUEUE_H */ - diff --git a/nuttx/include/nuttx/mtd.h b/nuttx/include/nuttx/mtd.h deleted file mode 100644 index ff48d313f..000000000 --- a/nuttx/include/nuttx/mtd.h +++ /dev/null @@ -1,243 +0,0 @@ -/**************************************************************************** - * include/nuttx/mtd.h - * Memory Technology Device (MTD) interface - * - * Copyright (C) 2009-2012 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_NUTTX_MTD_H -#define __INCLUDE_NUTTX_MTD_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/* Macros to hide implementation */ - -#define MTD_ERASE(d,s,n) ((d)->erase ? (d)->erase(d,s,n) : (-ENOSYS)) -#define MTD_BREAD(d,s,n,b) ((d)->bread ? (d)->bread(d,s,n,b) : (-ENOSYS)) -#define MTD_READ(d,s,n,b) ((d)->read ? (d)->read(d,s,n,b) : (-ENOSYS)) -#define MTD_BWRITE(d,s,n,b)((d)->bwrite ? (d)->bwrite(d,s,n,b) : (-ENOSYS)) -#define MTD_IOCTL(d,c,a) ((d)->ioctl ? (d)->ioctl(d,c,a) : (-ENOSYS)) - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* The following defines the geometry for the device. It treats the device - * as though it where just an array of fixed size blocks. That is most likely - * not true, but the client will expect the device logic to do whatever is - * necessary to make it appear so. - */ - -struct mtd_geometry_s -{ - uint16_t blocksize; /* Size of one read/write block */ - uint16_t erasesize; /* Size of one erase blocks -- must be a multiple - * of blocksize. */ - size_t neraseblocks; /* Number of erase blocks */ -}; - -/* This structure defines the interface to a simple memory technology device. - * It will likely need to be extended in the future to support more complex - * devices. - */ - -struct mtd_dev_s -{ - /* The following methods operate on the MTD: */ - - /* Erase the specified erase blocks (units are erase blocks) */ - - int (*erase)(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks); - - /* Read/write from the specified read/write blocks */ - - ssize_t (*bread)(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks, - FAR uint8_t *buffer); - ssize_t (*bwrite)(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks, - FAR const uint8_t *buffer); - - /* Some devices may support byte oriented reads (optional). Most MTD devices - * are inherently block oriented so byte-oriented writing is not supported. It - * is recommended that low-level drivers not support read() if it requires - * buffering. - */ - - ssize_t (*read)(FAR struct mtd_dev_s *dev, off_t offset, size_t nbytes, - FAR uint8_t *buffer); - - /* Support other, less frequently used commands: - * - MTDIOC_GEOMETRY: Get MTD geometry - * - MTDIOC_XIPBASE: Convert block to physical address for eXecute-In-Place - * - MTDIOC_BULKERASE: Erase the entire device - * (see include/nuttx/fs/ioctl.h) - */ - - int (*ioctl)(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg); -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifndef __ASSEMBLY__ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Name: ftl_initialize - * - * Description: - * Initialize to provide a block driver wrapper around an MTD interface - * - * Input Parameters: - * minor - The minor device number. The MTD block device will be - * registered as as /dev/mtdblockN where N is the minor number. - * mtd - The MTD device that supports the FLASH interface. - * - ****************************************************************************/ - -EXTERN int ftl_initialize(int minor, FAR struct mtd_dev_s *mtd); - -/**************************************************************************** - * Name: flash_eraseall - * - * Description: - * Call a block driver with the MDIOC_BULKERASE ioctl command. This will - * cause the MTD driver to erase all of the flash. - * - ****************************************************************************/ - -EXTERN int flash_eraseall(FAR const char *driver); - -/**************************************************************************** - * Name: rammtd_initialize - * - * Description: - * Create and initialize a RAM MTD device instance. - * - * Input Parameters: - * start - Address of the beginning of the allocated RAM regions. - * size - The size in bytes of the allocated RAM region. - * - ****************************************************************************/ - -EXTERN FAR struct mtd_dev_s *rammtd_initialize(FAR uint8_t *start, size_t size); - -/**************************************************************************** - * Name: m25p_initialize - * - * Description: - * Create an initialized MTD device instance. MTD devices are not registered - * in the file system, but are created as instances that can be bound to - * other functions (such as a block or character driver front end). - * - ****************************************************************************/ - -EXTERN FAR struct mtd_dev_s *m25p_initialize(FAR struct spi_dev_s *dev); - -/**************************************************************************** - * Name: at45db_initialize - * - * Description: - * Create an initialized MTD device instance. MTD devices are not registered - * in the file system, but are created as instances that can be bound to - * other functions (such as a block or character driver front end). - * - ****************************************************************************/ - -EXTERN FAR struct mtd_dev_s *at45db_initialize(FAR struct spi_dev_s *dev); - -/**************************************************************************** - * Name: at24c_initialize - * - * Description: - * Create an initialized MTD device instance. MTD devices are not registered - * in the file system, but are created as instances that can be bound to - * other functions (such as a block or character driver front end). - * - ****************************************************************************/ - -EXTERN FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_dev_s *dev); - -/**************************************************************************** - * Name: sst25_initialize - * - * Description: - * Create an initialized MTD device instance. MTD devices are not registered - * in the file system, but are created as instances that can be bound to - * other functions (such as a block or character driver front end). - * - ****************************************************************************/ - -EXTERN FAR struct mtd_dev_s *sst25_initialize(FAR struct spi_dev_s *dev); - -/**************************************************************************** - * Name: w25_initialize - * - * Description: - * Create an initialized MTD device instance. MTD devices are not registered - * in the file system, but are created as instances that can be bound to - * other functions (such as a block or character driver front end). - * - ****************************************************************************/ - -EXTERN FAR struct mtd_dev_s *w25_initialize(FAR struct spi_dev_s *dev); - -EXTERN FAR struct mtd_dev_s *at25_initialize(FAR struct spi_dev_s *dev); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __ASSEMBLY__ */ -#endif /* __INCLUDE_NUTTX_MTD_H */ diff --git a/nuttx/include/nuttx/net/cs89x0.h b/nuttx/include/nuttx/net/cs89x0.h deleted file mode 100644 index 4b2a52a5c..000000000 --- a/nuttx/include/nuttx/net/cs89x0.h +++ /dev/null @@ -1,168 +0,0 @@ -/**************************************************************************** - * include/nuttx/net/cs89x0.h - * - * Copyright (C) 2009, 2012 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_NUTTX_NET_CS89x0_H -#define __INCLUDE_NUTTX_NET_CS89x0_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include -#include - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* This structure returns driver statistics (if enabled) */ - -#ifdef CONFIG_C89x0_STATISTICS -struct cs89x0_statistics_s -{ - uint32_t tx_packets; - uint32_t tx_errors; - uint32_t tx_carriererrors; - uint32_t tx_heartbeaterrors; - uint32_t tx_windowerrors; - uint32_t tx_abortederrors; - uint32_t rx_missederrors; - uint32_t rx_packets; - uint32_t rx_errors; - uint32_t rx_lengtherrors; - uint32_t rx_crcerrors; - uint32_t rx_frameerrors; - uint32_t rx_dropped; - uint32_t rx_missederrors; - uint32_t collisions; -}; -#endif - -/* This structure encapsulates all state information for a single hardware - * interface. It includes values that must be provided by the user to in - * to describe details of the CS89x00 implementation on a particular board. - * An instance if this structure is passed to cs89x00 to instantiate the - * driver. - * - * This structure also includes internal driver state information that should - * be of no concern to the caller of cs89x0_initialize(). These fields must - * be zeroed. - */ - -struct cs89x0_driver_s -{ - /* User-provided CS89x00 platform-specific implementation details. The - * caller of cs89x0_initialize() must provide all of these values. - */ - - FAR void *cs_base; /* CS89x0 region base address */ -#ifdef CONFIG_CS89x0_MEMMODE - FAR void *cs_ppbase; /* CS89x0 page packet base address */ -#endif - uint8_t cs_irq; /* CS89x00 IRQ number */ - - /* Driver internal state fields. These must be zeroed by before the - * instance of this structure is passed to cs89x0_initialize - */ -#ifdef CONFIG_CS89x0_XMITEARLY - uint8_t txstart; /* Bits 6-7 of TxCMD controls Tx race */ -#endif - bool cs_memmode; /* true:memory mode false: I/O mode */ - bool cs_bifup; /* true:ifup false:ifdown */ - WDOG_ID cs_txpoll; /* TX poll timer */ - WDOG_ID cs_txtimeout; /* TX timeout timer */ -#ifdef CONFIG_CS89x0_XMITEARLY - uint32_t cs_txunderrun; /* Count of Tx underrun errors */ -#endif - - /* This holds the information visible to uIP/NuttX */ - - struct uip_driver_s cs_dev; /* Interface understood by uIP */ - - /* Driver statistics */ - -#ifdef CONFIG_C89x0_STATISTICS - struct cs89x0_statistics_s cs_stats; -#endif -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Function: cs89x0_initialize - * - * Description: - * Initialize the Ethernet driver - * - * Parameters: - * impl - decribes the implementation of the cs89x00 implementation. - * This reference is retained so so must remain stable throughout the - * life of the driver instance. - * devno - Identifies the device number. This must be a number between - * zero CONFIG_CS89x0_NINTERFACES and the same devno must not be - * initialized twice. The associated network device will be referred - * to with the name "eth" followed by this number (eth0, eth1, etc). - * - * Returned Value: - * OK on success; Negated errno on failure. - * - * Assumptions: - * - ****************************************************************************/ - -/* Initialize the CS89x0 chip and driver */ - -EXTERN int cs89x0_initialize(FAR const cs89x0_driver_s *cs89x0, int devno); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_NET_CS89x0_H */ diff --git a/nuttx/include/nuttx/net/enc28j60.h b/nuttx/include/nuttx/net/enc28j60.h deleted file mode 100644 index 7d0d7c3e5..000000000 --- a/nuttx/include/nuttx/net/enc28j60.h +++ /dev/null @@ -1,182 +0,0 @@ -/**************************************************************************** - * include/nuttx/net/enc28j60.h - * - * Copyright (C) 2010, 2012 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_NUTTX_NET_ENC28J60_H -#define __INCLUDE_NUTTX_NET_ENC28J60_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* ENC28J60 Configuration Settings: - * - * CONFIG_ENC28J60 - Enabled ENC28J60 support - * CONFIG_ENC28J60_SPIMODE - Controls the SPI mode - * CONFIG_ENC28J60_FREQUENCY - Define to use a different bus frequency - * CONFIG_ENC28J60_NINTERFACES - Specifies the number of physical ENC28J60 - * devices that will be supported. - * CONFIG_ENC28J60_STATS - Collect network statistics - * CONFIG_ENC28J60_HALFDUPPLEX - Default is full duplex - */ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* This structure returns driver statistics (if enabled) */ - -#ifdef CONFIG_ENC28J60_STATS -struct enc_stats_s -{ - uint8_t maxpktcnt; /* Max. number of buffered RX packets */ - uint32_t txrequests; /* Number of TX packets queued */ - uint32_t txifs; /* TXIF completion events */ - uint32_t txabrts; /* TXIF completions with ESTAT.TXABRT */ - uint32_t txerifs; /* TXERIF error events */ - uint32_t txtimeouts; /* S/W detected TX timeouts */ - uint32_t pktifs; /* PKTIF RX completion events */ - uint32_t rxnotok; /* PKTIF without RXSTAT_OK */ - uint32_t rxpktlen; /* PKTIF with bad pktlen */ - uint32_t rxerifs; /* RXERIF error evernts */ -}; -#endif - -/* The ENC28J60 normal provides interrupts to the MCU via a GPIO pin. The - * following structure provides an MCU-independent mechanixm for controlling - * the ENC28J60 GPIO interrupt. - * - * The ENC32J60 interrupt is an active low, *level* interrupt. "When an - * interrupt occurs, the interrupt flag is set. If the interrupt is enabled - * in the EIE register and the INTIE global interrupt enable bit is set, the - * INT pin will be driven low" - * - * "When an enabled interrupt occurs, the interrupt pin will remain low until - * all flags which are causing the interrupt are cleared or masked off - * (enable bit is cleared) by the host controller." However, the interrupt - * will behave like a falling edge interrupt because "After an interrupt - * occurs, the host controller [clears] the global enable bit for the - * interrupt pin before servicing the interrupt. Clearing the enable bit - * will cause the interrupt pin to return to the non-asserted state (high). - * Doing so will prevent the host controller from missing a falling edge - * should another interrupt occur while the immediate interrupt is being - * serviced." - */ - -struct enc_lower_s -{ - int (*attach)(FAR const struct enc_lower_s *lower, xcpt_t handler); - void (*enable)(FAR const struct enc_lower_s *lower); - void (*disable)(FAR const struct enc_lower_s *lower); -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Function: enc_initialize - * - * Description: - * Initialize the Ethernet driver. The ENC28J60 device is assumed to be - * in the post-reset state upon entry to this function. - * - * Parameters: - * spi - A reference to the platform's SPI driver for the ENC28J60 - * lower - The MCU-specific interrupt used to control low-level MCU - * functions (i.e., ENC28J60 GPIO interrupts). - * devno - If more than one ENC28J60 is supported, then this is the - * zero based number that identifies the ENC28J60; - * - * Returned Value: - * OK on success; Negated errno on failure. - * - * Assumptions: - * - ****************************************************************************/ - -struct spi_dev_s; /* see nuttx/spi.h */ -EXTERN int enc_initialize(FAR struct spi_dev_s *spi, - FAR const struct enc_lower_s *lower, - unsigned int devno); - -/**************************************************************************** - * Function: enc_stats - * - * Description: - * Return accumulated ENC28J60 statistics. Statistics are cleared after - * being returned. - * - * Parameters: - * devno - If more than one ENC28J60 is supported, then this is the - * zero based number that identifies the ENC28J60; - * stats - The user-provided location to return the statistics. - * - * Returned Value: - * OK on success; Negated errno on failure. - * - * Assumptions: - * - ****************************************************************************/ - -#ifdef CONFIG_ENC28J60_STATS -EXTERN int enc_stats(unsigned int devno, struct enc_stats_s *stats); -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_NET_ENC28J60_H */ diff --git a/nuttx/include/nuttx/net/ioctl.h b/nuttx/include/nuttx/net/ioctl.h deleted file mode 100644 index d5d1a001c..000000000 --- a/nuttx/include/nuttx/net/ioctl.h +++ /dev/null @@ -1,164 +0,0 @@ -/**************************************************************************** - * include/nuttx/net/ioctl.h - * - * Copyright (C) 2007-2008, 2010-2012 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. - * - ****************************************************************************/ - -#ifndef __INCLUDE_NUTTX_NET_IOCTL_H -#define __INCLUDE_NUTTX_NET_IOCTL_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include /* _SIOCBASE, etc. */ - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* These are ioctl commands to use with a socket FD. At present, commands - * are accepted only to set/get IP addresses, broadcast address, network - * masks, and hardware address, and a few others - */ - -#define _SIOCVALID(c) (_IOC_TYPE(c)==_SIOCBASE) -#define _SIOC(nr) _IOC(_SIOCBASE,nr) - -#define SIOCGIFADDR _SIOC(0x0001) /* Get IP address */ -#define SIOCSIFADDR _SIOC(0x0002) /* Set IP address */ -#define SIOCGIFDSTADDR _SIOC(0x0003) /* Get P-to-P address */ -#define SIOCSIFDSTADDR _SIOC(0x0004) /* Set P-to-P address */ -#define SIOCGIFBRDADDR _SIOC(0x0005) /* Get broadcast IP address */ -#define SIOCSIFBRDADDR _SIOC(0x0006) /* Set broadcast IP address */ -#define SIOCGIFNETMASK _SIOC(0x0007) /* Get network mask */ -#define SIOCSIFNETMASK _SIOC(0x0008) /* Set network mask */ -#define SIOCGIFMTU _SIOC(0x0009) /* Get MTU size */ -#define SIOCGIFHWADDR _SIOC(0x000a) /* Get hardware address */ -#define SIOCSIFHWADDR _SIOC(0x000b) /* Set hardware address */ -#define SIOCDIFADDR _SIOC(0x000c) /* Delete IP address */ -#define SIOCGIFCOUNT _SIOC(0x000d) /* Get number of devices */ - -#define SIOCGIPMSFILTER _SIOC(0x000e) /* Retrieve source filter addresses */ -#define SIOCSIPMSFILTER _SIOC(0x000f) /* Set source filter content */ - -/* Newer interface ioctls that use the struct lifreq. Can be used for - * both IPv4 and IPv6. - */ - -#define SIOCGLIFADDR SIOCGIFADDR /* Get IP address */ -#define SIOCSLIFADDR SIOCSIFADDR /* Set IP address */ -#define SIOCGLIFDSTADDR SIOCSIFDSTADDR /* Get P-to-P address */ -#define SIOCSLIFDSTADDR SIOCSIFDSTADDR /* Set P-to-P address */ -#define SIOCGLIFBRDADDR SIOCGIFBRDADDR /* Get broadcast IP address */ -#define SIOCSLIFBRDADDR SIOCSIFBRDADDR /* Set broadcast IP address */ -#define SIOCGLIFNETMASK SIOCGIFNETMASK /* Get network mask */ -#define SIOCSLIFNETMASK SIOCSIFNETMASK /* Set network mask */ -#define SIOCGLIFMTU SIOCGIFMTU /* Get MTU size */ - -/* Wireless ioctl commands **************************************************/ - -#define SIOCSIWCOMMIT _SIOC(0x0010) /* Commit pending changes to driver */ -#define SIOCGIWNAME _SIOC(0x0011) /* Get name of wireless protocol */ - -#define SIOCSIWNWID _SIOC(0x0012) /* Set network ID (pre-802.11) */ -#define SIOCGIWNWID _SIOC(0x0013) /* Get network ID (the cell) */ -#define SIOCSIWFREQ _SIOC(0x0014) /* Set channel/frequency (Hz) */ -#define SIOCGIWFREQ _SIOC(0x0015) /* Get channel/frequency (Hz) */ -#define SIOCSIWMODE _SIOC(0x0016) /* Set operation mode */ -#define SIOCGIWMODE _SIOC(0x0017) /* Get operation mode */ -#define SIOCSIWSENS _SIOC(0x0018) /* Set sensitivity (dBm) */ -#define SIOCGIWSENS _SIOC(0x0019) /* Get sensitivity (dBm) */ - -#define SIOCGIWRANGE _SIOC(0x001a) /* Get range of parameters */ -#define SIOCGIWPRIV _SIOC(0x001b) /* Get private ioctl interface info */ -#define SIOCGIWSTATS _SIOC(0x001c) /* Get wireless stats */ - -#define SIOCSIWSPY _SIOC(0x001d) /* Set spy addresses */ -#define SIOCGIWSPY _SIOC(0x001e) /* Get spy info (quality of link) */ -#define SIOCSIWTHRSPY _SIOC(0x001f) /* Set spy threshold (spy event) */ -#define SIOCGIWTHRSPY _SIOC(0x0020) /* Get spy threshold */ - -#define SIOCSIWAP _SIOC(0x0021) /* Set access point MAC addresses */ -#define SIOCGIWAP _SIOC(0x0022) /* Get access point MAC addresses */ -#define SIOCGIWAPLIST _SIOC(0x0023) /* Deprecated in favor of scanning */ -#define SIOCSIWSCAN _SIOC(0x0024) /* Trigger scanning (list cells) */ -#define SIOCGIWSCAN _SIOC(0x0025) /* Get scanning results */ - -#define SIOCSIWESSID _SIOC(0x0026) /* Set ESSID (network name) */ -#define SIOCGIWESSID _SIOC(0x0027) /* Get ESSID */ -#define SIOCSIWNICKN _SIOC(0x0028) /* Set node name/nickname */ -#define SIOCGIWNICKN _SIOC(0x0029) /* Get node name/nickname */ - -#define SIOCSIWRATE _SIOC(0x002a) /* Set default bit rate (bps) */ -#define SIOCGIWRATE _SIOC(0x002b) /* Get default bit rate (bps) */ -#define SIOCSIWRTS _SIOC(0x002c) /* Set RTS/CTS threshold (bytes) */ -#define SIOCGIWRTS _SIOC(0x002d) /* Get RTS/CTS threshold (bytes) */ -#define SIOCSIWFRAG _SIOC(0x002e) /* Set fragmentation thr (bytes) */ -#define SIOCGIWFRAG _SIOC(0x002f) /* Get fragmentation thr (bytes) */ -#define SIOCSIWTXPOW _SIOC(0x0030) /* Set transmit power (dBm) */ -#define SIOCGIWTXPOW _SIOC(0x0031) /* Get transmit power (dBm) */ -#define SIOCSIWRETRY _SIOC(0x0032) /* Set retry limits and lifetime */ -#define SIOCGIWRETRY _SIOC(0x0033) /* Get retry limits and lifetime */ - -#define SIOCSIWPOWER _SIOC(0x0034) /* Set Power Management settings */ -#define SIOCGIWPOWER _SIOC(0x0035) /* Get Power Management settings */ - -#define SIOCSIWGENIE _SIOC(0x0030) /* Set generic IE */ -#define SIOCGIWGENIE _SIOC(0x0031) /* Get generic IE */ - -#define SIOCSIWMLME _SIOC(0x0016) /* Request MLME operation */ - -#define SIOCSIWAUTH _SIOC(0x0032) /* Set authentication mode params */ -#define SIOCGIWAUTH _SIOC(0x0033) /* Get authentication mode params */ - -#define SIOCSIWENCODEEXT _SIOC(0x0034) /* Set encoding token & mode */ -#define SIOCGIWENCODEEXT _SIOC(0x0035) /* Get encoding token & mode */ - -#define SIOCSIWPMKSA _SIOC(0x0036) /* PMKSA cache operation */ - -/* Interface flags */ - -#define SIOCSIFFLAGS _SIOC(0x0037) /* Sets the interface flags */ -#define SIOCGIFFLAGS _SIOC(0x0038) /* Gets the interface flags */ - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ - -/* See include/net/if.h */ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#endif /* __INCLUDE_NUTTX_NET_IOCTL_H */ diff --git a/nuttx/include/nuttx/net/mii.h b/nuttx/include/nuttx/net/mii.h deleted file mode 100644 index de4dcdfd7..000000000 --- a/nuttx/include/nuttx/net/mii.h +++ /dev/null @@ -1,474 +0,0 @@ -/**************************************************************************** - * include/nuttx/net/mii.h - * - * Copyright (C) 2008-2010, 2012 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_NUTTX_NET_MII_H -#define __INCLUDE_NUTTX_NET_MII_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/* MII register offsets *****************************************************/ - -/* Common MII management registers. The IEEE 802.3 standard specifies a - * register set for controlling and gathering status from the PHY layer. The - * registers are collectively known as the MII Management registers and are - * detailed in Section 22.2.4 of the IEEE 802.3 specification. - */ - -#define MII_MCR 0x00 /* MII management control */ -#define MII_MSR 0x01 /* MII management status */ -#define MII_PHYID1 0x02 /* PHY ID 1 */ -#define MII_PHYID2 0x03 /* PHY ID 2 */ -#define MII_ADVERTISE 0x04 /* Auto-negotiation advertisement */ -#define MII_LPA 0x05 /* Auto-negotiation link partner base page ability */ -#define MII_EXPANSION 0x06 /* Auto-negotiation expansion */ -#define MII_NEXTPAGE 0x07 /* Auto-negotiation next page */ -#define MII_LPANEXTPAGE 0x08 /* Auto-negotiation link partner received next page */ -#define MII_MSCONTROL 0x09 /* Master/slave control register */ -#define MII_MSSTATUS 0x0a /* Master/slave status register */ -#define MII_PSECONTROL 0x0b /* PSE control register */ -#define MII_PSESTATUS 0x0c /* PSE status register */ -#define MII_MMDCONTROL 0x0d /* MMD access control register */ -#define MII_ESTATUS 0x0f /* Extended status register */ - -/* Extended Registers: Registers 16-31 may be used for vendor specific abilities */ - -/* National Semiconductor DP83840: 0x07-0x11, 0x14, 0x1a, 0x1d-0x1f reserved */ - -#define MII_DP83840_COUNTER 0x12 /* Disconnect counter */ -#define MII_DP83840_FCSCOUNTER 0x13 /* False carrier sense counter */ -#define MII_DP83840_NWAYTEST 0x14 /* N-way auto-neg test reg */ -#define MII_DP83840_RERRCOUNTER 0x15 /* Receive error counter */ -#define MII_DP83840_SREVISION 0x16 /* Silicon revision */ -#define MII_DP83840_LBRERROR 0x18 /* Loopback, bypass and receiver error */ -#define MII_DP83840_PHYADDR 0x19 /* PHY address */ -#define MII_DP83840_10BTSR 0x1b /* 10BASE-T status register */ -#define MII_DP83840_10BTCR 0x1c /* 10BASE-T configuration register */ - -/* National Semiconductor DP83848C: 0x8-0x15, 0x13, 0x1c reserved */ - -#define MII_DP83848C_PHYSTS 0x10 /* RO PHY Status Register */ -#define MII_DP83848C_MICR 0x11 /* RW MII Interrupt Control Register */ -#define MII_DP83848C_MISR 0x12 /* RO MII Interrupt Status Register */ -#define MII_DP83848C_FCSCR 0x14 /* RO False Carrier Sense Counter Register */ -#define MII_DP83848C_RECR 0x15 /* RO Receive Error Counter Register */ -#define MII_DP83848C_PCSR 0x16 /* RW PCS Sub-Layer Configuration and Status Register */ -#define MII_DP83848C_RBR 0x17 /* RW RMII and Bypass Register */ -#define MII_DP83848C_LEDCR 0x18 /* RW LED Direct Control Register */ -#define MII_DP83848C_PHYCR 0x19 /* RW PHY Control Register */ -#define MII_DP83848C_10BTSCR 0x1a /* RW 10Base-T Status/Control Register */ -#define MII_DP83848C_CDCTRL1 0x1b /* RW CD Test Control Register and BIST Extensions Register */ -#define MII_DP83848C_EDCR 0x1e /* RW Energy Detect */ - -/* Am79c874: 0x08-0x0f, 0x14, 0x16, 0x19-0x1f reserved */ - -#define MII_AM79C874_NPADVERTISE 0x07 /* Auto-negotiation next page advertisement */ -#define MII_AM79C874_MISCFEATURES 0x10 /* Miscellaneous features reg */ -#define MII_AM79C874_INTCS 0x11 /* Interrupt control/status */ -#define MII_AM79C874_DIAGNOSTIC 0x12 /* Diagnostic */ -#define MII_AM79C874_LOOPBACK 0x13 /* Power management/loopback */ -#define MII_AM79C874_MODEC 0x15 /* Mode control register */ -#define MII_AM79C874_DISCONNECT 0x17 /* Disconnect counter */ -#define MII_AM79C874_RCVERROR 0x18 /* Receive error counter */ - -/* Luminary LM3S6918 built-in PHY: 0x07-0x0f, 0x14-0x16, 0x19-0x1f reserved */ - -#define MII_LM_VSPECIFIC 0x10 /* Vendor-Specific */ -#define MII_LM_INTCS 0x11 /* Interrupt control/status */ -#define MII_LM_DIAGNOSTIC 0x12 /* Diagnostic */ -#define MII_LM_XCVRCONTROL 0x13 /* Transceiver Control */ -#define MII_LM_LEDCONFIG 0x17 /* LED Configuration */ -#define MII_LM_MDICONTROL 0x18 /* Ethernet PHY Management MDI/MDIX Control */ - -/* Micrel KS8721: 0x15, 0x1b, and 0x1f */ - -#define MII_KS8721_RXERCOUNTER 0x15 /* RXER counter */ -#define MII_KS8721_INTCS 0x1b /* Interrupt control/status register */ -#define MII_KS8721_10BTCR 0x1f /* 10BASE-TX PHY control register */ - -/* National Semiconductor DP83848C PHY Extended Registers */ - -#define MII_DP83848C_STS 0x10 /* Status Register */ -#define MII_DP83848C_MICR 0x11 /* MII Interrupt Control Register */ -#define MII_DP83848C_MISR 0x12 /* MII Interrupt Status Register */ -#define MII_DP83848C_FCSCR 0x14 /* False Carrier Sense Counter */ -#define MII_DP83848C_RECR 0x15 /* Receive Error Counter */ -#define MII_DP83848C_PCSR 0x16 /* PCS Sublayer Config. and Status */ -#define MII_DP83848C_RBR 0x17 /* RMII and Bypass Register */ -#define MII_DP83848C_LEDCR 0x18 /* LED Direct Control Register */ -#define MII_DP83848C_PHYCR 0x19 /* PHY Control Register */ -#define MII_DP83848C_10BTSCR 0x1a /* 10Base-T Status/Control Register */ -#define MII_DP83848C_CDCTRL1 0x1b /* CD Test Control and BIST Extens */ -#define MII_DP83848C_EDCR 0x1d /* Energy Detect Control Register */ - -/* SMSC LAN8720 PHY Extended Registers */ - -#define MII_LAN8720_REV 0x10 /* Silicon Revision Register */ -#define MII_LAN8720_MCSR 0x11 /* Mode Control/Status Register */ -#define MII_LAN8720_MODES 0x12 /* Special modes */ -#define MII_LAN8720_SECR 0x1a /* Symbol Error Counter Register */ -#define MII_LAN8720_CSIR 0x1b /* Control / Status Indicator Register */ -#define MII_LAN8720_SITC 0x1c /* Special Internal Testability Controls */ -#define MII_LAN8720_ISR 0x1d /* Interrupt Source Register */ -#define MII_LAN8720_IMR 0x1e /* Interrupt Mask Register */ -#define MII_LAN8720_SCSR 0x1f /* PHY Special Control/Status Register */ - -/* GMII */ - -#define GMII_MCR MII_MCR /* GMII management control */ -#define GMII_MSR MII_MSR /* GMII management status */ -#define GMII_PHYID1 MII_PHYID1 /* PHY ID 1 */ -#define GMII_PHYID2 MII_PHYID2 /* PHY ID 2 */ -#define GMII_ADVERTISE MII_ADVERTISE /* Auto-negotiation advertisement */ -#define GMII_LPA MII_LPA /* Auto-negotiation link partner base page ability */ -#define GMII_EXPANSION MII_EXPANSION /* Auto-negotiation expansion */ -#define GMII_NEXTPAGE MII_NEXTPAGE /* Auto-negotiation next page */ -#define GMII_LPANEXTPAGE MII_LPANEXTPAGE /* Auto-negotiation link partner received next page */ -#define GMII_CTRL1000 0x09 /* 1000BASE-T control */ -#define GMII_STAT1000 0x0a /* 1000BASE-T status */ -#define GMII_ESTATUS MII_ESTATUS /* Extended status register */ - -/* MII register bit settings ************************************************/ - -/* MII Control register bit definitions */ - -#define MII_MCR_UNIDIR (1 << 5) /* Bit 5: Unidirectional enable */ -#define MII_MCR_SPEED1000 (1 << 6) /* Bit 6: MSB of Speed (1000 reserved on 10/100) */ -#define MII_MCR_CTST (1 << 7) /* Bit 7: Enable collision test */ -#define MII_MCR_FULLDPLX (1 << 8) /* Bit 8: Full duplex */ -#define MII_MCR_ANRESTART (1 << 9) /* Bit 9: Restart auto negotiation */ -#define MII_MCR_ISOLATE (1 << 10) /* Bit 10: Electronically isolate PHY from MII */ -#define MII_MCR_PDOWN (1 << 11) /* Bit 11: Powerdown the PHY */ -#define MII_MCR_ANENABLE (1 << 12) /* Bit 12: Enable auto negotiation */ -#define MII_MCR_SPEED100 (1 << 13) /* Bit 13: Select 100Mbps */ -#define MII_MCR_LOOPBACK (1 << 14) /* Bit 14: Enable loopback mode */ -#define MII_MCR_RESET (1 << 15) /* Bit 15: PHY reset */ - -/* MII Status register bit definitions */ - -#define MII_MSR_EXTCAP (1 << 0) /* Bit 0: Extended register capability */ -#define MII_MSR_JABBERDETECT (1 << 1) /* Bit 1: Jabber detect */ -#define MII_MSR_LINKSTATUS (1 << 2) /* Bit 2: Link status */ -#define MII_MSR_ANEGABLE (1 << 3) /* Bit 3: Auto-negotiation able */ -#define MII_MSR_RFAULT (1 << 4) /* Bit 4: Remote fault */ -#define MII_MSR_ANEGCOMPLETE (1 << 5) /* Bit 5: Auto-negotiation complete */ -#define MII_MSR_MFRAMESUPPRESS (1 << 6) /* Bit 6: Management frame suppression */ -#define MII_MSR_ESTATEN (1 << 8) /* Bit 8: Extended Status in R15 */ -#define MII_MSR_100BASET2FULL (1 << 9) /* Bit 9: 100BASE-T2 half duplex able */ -#define MII_MSR_100BASET2HALF (1 << 10) /* Bit 10: 100BASE-T2 full duplex able */ -#define MII_MSR_10BASETXHALF (1 << 11) /* Bit 11: 10BASE-TX half duplex able */ -#define MII_MSR_10BASETXFULL (1 << 12) /* Bit 12: 10BASE-TX full duplex able */ -#define MII_MSR_100BASETXHALF (1 << 13) /* Bit 13: 100BASE-TX half duplex able */ -#define MII_MSR_100BASETXFULL (1 << 14) /* Bit 14: 100BASE-TX full duplex able */ -#define MII_MSR_100BASET4 (1 << 15) /* Bit 15: 100BASE-T4 able */ - -/* MII ID2 register bits */ - -#define MII_PHYID2_OUI 0xfc00 /* Bits 19-24 of OUI mask */ -#define MII_PHYID2_MODEL 0x03f0 /* Model number mask */ -#define MII_PHYID2_REV 0x000f /* Revision number mask */ - -/* Advertisement control register bit definitions */ - -#define MII_ADVERTISE_SELECT 0x001f /* Bits 0-4: Selector field */ -#define MII_ADVERTISE_CSMA (1 << 0) /* CSMA */ -#define MII_ADVERTISE_8023 (1 << 0) /* IEEE Std 802.3 */ -#define MII_ADVERTISE_8029 (2 << 0) /* IEEE Std 802.9 ISLAN-16T */ -#define MII_ADVERTISE_8025 (3 << 0) /* IEEE Std 802.5 */ -#define MII_ADVERTISE_1394 (4 << 0) /* IEEE Std 1394 */ -#define MII_ADVERTISE_10BASETXHALF (1 << 5) /* Bit 5: Try 10BASE-TX half duplex */ -#define MII_ADVERTISE_1000XFULL (1 << 5) /* Bit 5: Try 1000BASE-X full duplex */ -#define MII_ADVERTISE_10BASETXFULL (1 << 6) /* Bit 6: Try 10BASE-TX full duplex */ -#define MII_ADVERTISE_1000XHALF (1 << 6) /* Bit 6: Try 1000BASE-X half duplex */ -#define MII_ADVERTISE_100BASETXHALF (1 << 7) /* Bit 7: Try 100BASE-TX half duplex */ -#define MII_ADVERTISE_1000XPAUSE (1 << 7) /* Bit 7: Try 1000BASE-X pause */ -#define MII_ADVERTISE_100BASETXFULL (1 << 8) /* Bit 8: Try 100BASE-TX full duplex*/ -#define MII_ADVERTISE_1000XASYMPAU (1 << 8) /* Bit 8: Try 1000BASE-X asym pause */ -#define MII_ADVERTISE_100BASET4 (1 << 9) /* Bit 9: Try 100BASE-T4 */ -#define MII_ADVERTISE_FDXPAUSE (1 << 10) /* Bit 10: Try full duplex flow control */ -#define MII_ADVERTISE_ASYMPAUSE (1 << 11) /* Bit 11: Try asymetric pause */ -#define MII_ADVERTISE_RFAULT (1 << 13) /* Bit 13: Remote fault supported */ -#define MII_ADVERTISE_LPACK (1 << 14) /* Bit 14: Ack link partners response */ -#define MII_ADVERTISE_NXTPAGE (1 << 15) /* Bit 15: Next page enabled */ - -/* Link partner ability register bit definitions */ - -#define MII_LPA_SELECT 0x001f /* Bits 0-4: Link partner selector field */ -#define MII_LPA_CSMA (1 << 0) /* CSMA */ -#define MII_LPA_8023 (1 << 0) /* IEEE Std 802.3 */ -#define MII_LPA_8029 (2 << 0) /* IEEE Std 802.9 ISLAN-16T */ -#define MII_LPA_8025 (3 << 0) /* IEEE Std 802.5 */ -#define MII_LPA_1394 (4 << 0) /* IEEE Std 1394 */ -#define MII_LPA_10BASETXHALF (1 << 5) /* Bit 5: 10BASE-TX half duplex able */ -#define MII_LPA_1000XFULL (1 << 5) /* Bit 5: 1000BASE-X full-duplex able */ -#define MII_LPA_10BASETXFULL (1 << 6) /* Bit 6: 10BASE-TX full duplex able */ -#define MII_LPA_1000XHALF (1 << 6) /* Bit 6: 1000BASE-X half-duplex */ -#define MII_LPA_100BASETXHALF (1 << 7) /* Bit 7: 100BASE-TX half duplex able */ -#define MII_LPA_1000XPAUSE (1 << 7) /* Bit 7: 1000BASE-X pause able */ -#define MII_LPA_100BASETXFULL (1 << 8) /* Bit 8: 100BASE-TX full duplex able */ -#define MII_LPA_1000XASYMPAU (1 << 8) /* Bit 8: 1000BASE-X asym pause able */ -#define MII_LPA_100BASET4 (1 << 9) /* Bit 9: 100BASE-T4 able */ -#define MII_LPA_FDXPAUSE (1 << 10) /* Bit 10: Full duplex flow control able */ -#define MII_LPA_ASYMPAUSE (1 << 11) /* Bit 11: Asynchronous pause able */ -#define MII_LPA_RFAULT (1 << 13) /* Bit 13: Link partner remote fault request */ -#define MII_LPA_LPACK (1 << 14) /* Bit 14: Link partner acknowledgement */ -#define MII_LPA_NXTPAGE (1 << 15) /* Bit 15: Next page requested */ - -/* Link partner ability in next page format */ - -#define MII_LPANP_MESSAGE 0x07ff /* Bits 0-10: Link partner's message code */ -#define MII_LPANP_TOGGLE (1 << 11) /* Bit 11: Link partner toggle */ -#define MII_LPANP_LACK2 (1 << 12) /* Bit 12: Link partner can comply ACK */ -#define MII_LPANP_MSGPAGE (1 << 13) /* Bit 13: Link partner message page request */ -#define MII_LPANP_LPACK (1 << 14) /* Bit 14: Link partner acknowledgement */ -#define MII_LPANP_NXTPAGE (1 << 15) /* Bit 15: Next page requested */ - -/* MII Auto-negotiation expansion register bit definitions */ - -#define MII_EXPANSION_ANEGABLE (1 << 0) /* Bit 0: Link partner is auto-negotion able */ -#define MII_EXPANSION_PAGERECVD (1 << 1) /* Bit 1: New link code word in LPA ability reg */ -#define MII_EXPANSION_ENABLENPAGE (1 << 2) /* Bit 2: This enables npage words */ -#define MII_EXPANSION_NXTPAGEABLE (1 << 3) /* Bit 3: Link partner supports next page */ -#define MII_EXPANSION_PARFAULTS (1 << 4) /* Bit 4: Fault detected by parallel logic */ - -/* Auto-negotiation next page advertisement */ - -#define MII_NPADVERTISE_CODE 0x07ff /* Bits 0-10: message/un-formated code field */ -#define MII_NPADVERTISE_TOGGLE (1 << 11) /* Bit 11: Toggle */ -#define MII_NPADVERTISE_ACK2 (1 << 12) /* Bit 12: Acknowledgement 2 */ -#define MII_NPADVERTISE_MSGPAGE (1 << 13) /* Bit 13: Message page */ -#define MII_NPADVERTISE_NXTPAGE (1 << 15) /* Bit 15: Next page indication */ - -/* MII PHYADDR register bit definitions */ - -#define DP83840_PHYADDR_DUPLEX (1 << 7) -#define DP83840_PHYADDR_SPEED (1 << 6) - -/* National Semiconductor DP83848C ******************************************/ -/* DP83848C MII ID1/2 register bits */ - -#define MII_PHYID1_DP83848C 0x2000 /* ID1 value for DP83848C */ -#define MII_PHYID2_DP83848C 0x5c90 /* ID2 value for DP83848C */ - -/* RMII and Bypass Register (0x17) */ - -#define MII_RBR_ELAST_MASK 0x0003 /* Bits 0-1: Receive elasticity buffer */ -# define MII_RBR_ELAST_14 0x0000 /* 14 bit tolerance */ -# define MII_RBR_ELAST_2 0x0001 /* 2 bit tolerance */ -# define MII_RBR_ELAST_6 0x0002 /* 6 bit tolerance */ -# define MII_RBR_ELAST_10 0x0003 /* 10 bit tolerance */ -#define MII_RBR_RXUNFSTS (1 << 2) /* Bit 2: RX FIFO underflow */ -#define MII_RBR_RXOVFSTS (1 << 3) /* Bit 3: RX FIFO overflow */ -#define MII_RBR_RMIIREV10 (1 << 4) /* Bit 4: 0=RMIIv1.2 1-RMIIv1.0 */ -#define MII_RBR_RMIIMODE (1 << 5) /* Bit 5: 0=MII mode 1=RMII mode */ - -/* SMSC LAN8720 *************************************************************/ -/* SMSC LAN8720 MII ID1/2 register bits */ - -#define MII_PHYID1_LAN8720 0x0007 /* ID1 value for LAN8720 */ -#define MII_PHYID2_LAN8720 0xc0f1 /* ID2 value for LAN8720 */ - -/* Am79c874-specific register bit settings **********************************/ -/* Am79c874 MII ID1/2 register bits */ - -#define MII_PHYID1_AM79C874 0x0022 /* ID1 value for Am79c874 */ -#define MII_PHYID2_AM79C874 0x561b /* ID2 value for Am79c874 Rev B */ - -/* Am79c874 diagnostics register */ - -#define AM79C874_DIAG_RXLOCK (1 << 8) /* Bit 8: 1=Rcv PLL locked on */ -#define AM79C874_DIAG_RXPASS (1 << 9) /* Bit 9: 1=Operating in 100Base-X mode */ -#define AM79C874_DIAG_100MBPS (1 << 10) /* Bit 10: 1=ANEG result is 100Mbps */ -#define AM79C874_DIAG_FULLDPLX (1 << 11) /* Bit 11: 1=ANEG result is full duplex */ - -/* LM3S6918-specific register bit settings **********************************/ -/* LM3S6918 Vendor-Specific, address 0x10 */ - -#define LM_VSPECIFIC_RXCC (1 << 0) /* Bit 0: Receive Clock Control*/ -#define LM_VSPECIFIC_PCSBP (1 << 1) /* Bit 1: PCS Bypass */ -#define LM_VSPECIFIC_RVSPOL (1 << 4) /* Bit 4: Receive Data Polarity */ -#define LM_VSPECIFIC_APOL (1 << 5) /* Bit 5: Auto-Polarity Disable */ -#define LM_VSPECIFIC_NL10 (1 << 10) /* Bit 10: Natural Loopback Mode */ -#define LM_VSPECIFIC_SQEI (1 << 11) /* Bit 11: SQE Inhibit Testing */ -#define LM_VSPECIFIC_TXHIM (1 << 12) /* Bit 12: Transmit High Impedance Mode */ -#define LM_VSPECIFIC_INPOL (1 << 14) /* Bit 14: Interrupt Polarity Value*/ -#define LM_VSPECIFIC_RPTR (1 << 15) /* Bit 15: Repeater mode*/ - -/* LM3S6918 Interrupt Control/Status, address 0x11 */ - -#define LM_INTCS_ANEGCOMPINT (1 << 0) /* Bit 0: Auto-Negotiation Complete Interrupt */ -#define LM_INTCS_RFAULTINT (1 << 1) /* Bit 1: Remote Fault Interrupt */ -#define LM_INTCS_LSCHGINT (1 << 2) /* Bit 2: Link Status Change Interrupt */ -#define LM_INTCS_LPACKINT (1 << 3) /* Bit 3: LP Acknowledge Interrupt */ -#define LM_INTCS_PDFINT (1 << 4) /* Bit 4: Parallel Detection Fault Interrupt */ -#define LM_INTCS_PRXINT (1 << 5) /* Bit 5: Page Receive Interrupt */ -#define LM_INTCS_RXERINT (1 << 6) /* Bit 6: Receive Error Interrupt */ -#define LM_INTCS_JABBERINT (1 << 7) /* Bit 7: Jabber Event Interrupt */ -#define LM_INTCS_ANEGCOMPIE (1 << 8) /* Bit 8: Auto-Negotiation Complete Interrupt Enable */ -#define LM_INTCS_RFAULTIE (1 << 9) /* Bit 9: Remote Fault Interrupt Enable */ -#define LM_INTCS_LSCHGIE (1 << 10) /* Bit 10: Link Status Change Interrupt Enable */ -#define LM_INTCS_LPACKIE (1 << 11) /* Bit 11: LP Acknowledge Interrupt Enable */ -#define LM_INTCS_PDFIE (1 << 12) /* Bit 12: Parallel Detection Fault Interrupt Enable */ -#define LM_INTCS_PRXIE (1 << 13) /* Bit 13: Page Received Interrupt Enable */ -#define LM_INTCS_RXERIE (1 << 14) /* Bit 14: Receive Error Interrupt Enable */ -#define LM_INTCS_JABBERIE (1 << 15) /* Bit 15: Jabber Interrupt Enable */ - -/* LM3S6918 Diagnostic, address 0x12 */ - -#define LM_DIAGNOSTIC_RX_LOCK (1 << 8) /* Bit 8: Receive PLL Lock */ -#define LM_DIAGNOSTIC_RXSD (1 << 9) /* Bit 9: Receive Detection */ -#define LM_DIAGNOSTIC_RATE (1 << 10) /* Bit 10: Rate */ -#define LM_DIAGNOSTIC_DPLX (1 << 11) /* Bit 11: Duplex Mode */ -#define LM_DIAGNOSTIC_ANEGF (1 << 12) /* Bit 12: Auto-Negotiation Failure */ - -/* LM3S6918 Transceiver Control, address 0x13 */ - -#define LM_XCVRCONTROL_TXO_SHIFT 14 /* Bits 15-14: Transmit Amplitude Selection */ -#define LM_XCVRCONTROL_TXO_MASK (3 << LM_XCVRCONTROL_TXO_SHIFT) -#define LM_XCVRCONTROL_TXO_00DB (0 << LM_XCVRCONTROL_TXO_SHIFT) /* Gain 0.0dB of insertion loss */ -#define LM_XCVRCONTROL_TXO_04DB (1 << LM_XCVRCONTROL_TXO_SHIFT) /* Gain 0.4dB of insertion loss */ -#define LM_XCVRCONTROL_TXO_08DB (2 << LM_XCVRCONTROL_TXO_SHIFT) /* Gain 0.8dB of insertion loss */ -#define LM_XCVRCONTROL_TXO_12DB (3 << LM_XCVRCONTROL_TXO_SHIFT) /* Gain 1.2dB of insertion loss */ - -/* LM3S6918 LED Configuration, address 0x17 */ - -#define LM_LEDCONFIG_LED0_SHIFT (0) /* Bits 3-0: LED0 Source */ -#define LM_LEDCONFIG_LED0_MASK (0x0f << LM_LEDCONFIG_LED0_SHIFT) -#define LM_LEDCONFIG_LED0_LINKOK (0 << LM_LEDCONFIG_LED0_SHIFT) /* Link OK */ -#define LM_LEDCONFIG_LED0_RXTX (1 << LM_LEDCONFIG_LED0_SHIFT) /* RX or TX activity */ -#define LM_LEDCONFIG_LED0_100BASET (5 << LM_LEDCONFIG_LED0_SHIFT) /* 100BASE-TX mode */ -#define LM_LEDCONFIG_LED0_10BASET (6 << LM_LEDCONFIG_LED0_SHIFT) /* 10BASE-T mode */ -#define LM_LEDCONFIG_LED0_FDUPLEX (7 << LM_LEDCONFIG_LED0_SHIFT) /* Full duplex */ -#define LM_LEDCONFIG_LED0_OKRXTX (8 << LM_LEDCONFIG_LED0_SHIFT) /* Full duplex */ -#define LM_LEDCONFIG_LED1_SHIFT (4) /* Bits 7-4: LED1 Source */ -#define LM_LEDCONFIG_LED1_MASK (0x0f << LM_LEDCONFIG_LED1_SHIFT) -#define LM_LEDCONFIG_LED1_LINKOK (0 << LM_LEDCONFIG_LED1_SHIFT) /* Link OK */ -#define LM_LEDCONFIG_LED1_RXTX (1 << LM_LEDCONFIG_LED1_SHIFT) /* RX or TX activity */ -#define LM_LEDCONFIG_LED1_100BASET (5 << LM_LEDCONFIG_LED1_SHIFT) /* 100BASE-TX mode */ -#define LM_LEDCONFIG_LED1_10BASET (6 << LM_LEDCONFIG_LED1_SHIFT) /* 10BASE-T mode */ -#define LM_LEDCONFIG_LED1_FDUPLEX (7 << LM_LEDCONFIG_LED1_SHIFT) /* Full duplex */ -#define LM_LEDCONFIG_LED1_OKRXTX (8 << LM_LEDCONFIG_LED1_SHIFT) /* Full duplex */ - -/* LM3S6918 MDI/MDIX Control, address 0x18 */ - -#define LM_MDICONTROL_MDIXSD_SHIFT (0) /* Bits 3-0: Auto-Switching Seed */ -#define LM_MDICONTROL_MDIXSD_MASK (0x0f << LM_MDICONTROL_MDIXSD_SHIFT) -#define LM_MDICONTROL_MDIXCM (1 << 4) /* Bit 4: Auto-Switching Complete */ -#define LM_MDICONTROL_MDIX (1 << 5) /* Bit 5: Auto-Switching Configuration */ -#define LM_MDICONTROL_AUTOSW (1 << 6) /* Bit 6: Auto-Switching Enable */ -#define LM_MDICONTROL_PDMODE (1 << 7) /* Bit 7: Parallel Detection Mode */ - -/* KS8921-specific register bit settings ************************************/ -/* KS8921 MII Control register bit definitions (not in 802.3) */ - -#define KS8721_MCR_DISABXMT (1 << 0) /* Bit 0: Disable Transmitter */ - -/* KS8921 MII ID1/2 register bits */ - -#define MII_PHYID1_KS8721 0x0022 /* ID1 value for Micrel KS8721 */ -#define MII_PHYID2_KS8721 0x1619 /* ID2 value for Micrel KS8721 */ - -/* KS8921 RXER Counter -- 16-bit counter */ - -/* KS8921 Interrupt Control/Status Register */ - -#define KS8721_INTCS_LINKUP (1 << 0) /* Bit 0: Link up occurred */ -#define KS8721_INTCS_REMFAULT (1 << 1) /* Bit 1: Remote fault occurred */ -#define KS8721_INTCS_LINKDOWN (1 << 2) /* Bit 2: Link down occurred */ -#define KS8721_INTCS_LPACK (1 << 3) /* Bit 3: Link partner acknowlege occurred */ -#define KS8721_INTCS_PDFAULT (1 << 4) /* Bit 4: Parallel detect fault occurred */ -#define KS8721_INTCS_PGRCVD (1 << 5) /* Bit 5: Page received occurred */ -#define KS8721_INTCS_RXERR (1 << 6) /* Bit 6: Receive error occurred */ -#define KS8721_INTCS_JABBER (1 << 7) /* Bit 7: Jabber interrupt occurred */ -#define KS8721_INTCS_LINKUPE (1 << 8) /* Bit 8: Enable link up interrupt */ -#define KS8721_INTCS_REMFAULTE (1 << 9) /* Bit 9: Enable remote fault interrupt */ -#define KS8721_INTCS_LINKDOWNE (1 << 10) /* Bit 10: Enable link down interrupt */ -#define KS8721_INTCS_LPACKE (1 << 11) /* Bit 11: Enable link partner acknowldgement interrupt */ -#define KS8721_INTCS_PDFAULTE (1 << 12) /* Bit 12: Enable parallel detect fault interrupt */ -#define KS8721_INTCS_PGRCVDE (1 << 13) /* Bit 13: Enable page received interrupt */ -#define KS8721_INTCS_RXERRE (1 << 14) /* Bit 14: Enable receive error interrupt */ -#define KS8721_INTCS_JABBERE (1 << 15) /* Bit 15: Enable Jabber Interrupt */ - -/* KS8921 10BASE-TX PHY control register */ - -#define KS8721_10BTCR_BIT0 (1 << 0) /* Bit 0: xxx */ -#define KS8721_10BTCR_BIT1 (1 << 1) /* Bit 1: xxx */ -#define KS8721_10BTCR_MODE_SHIFT (2) /* Bits 2-4: Operation Mode Indication */ -#define KS8721_10BTCR_MODE_MASK (7 << KS8721_10BTCR_MODE_SHIFT) -# define KS8721_10BTCR_MODE_ANEG (0 << KS8721_10BTCR_MODE_SHIFT) /* Still in auto-negotiation */ -# define KS8721_10BTCR_MODE_10BTHD (1 << KS8721_10BTCR_MODE_SHIFT) /* 10BASE-T half-duplex */ -# define KS8721_10BTCR_MODE_100BTHD (2 << KS8721_10BTCR_MODE_SHIFT) /* 100BASE_t half-duplex */ -# define KS8721_10BTCR_MODE_DEFAULT (3 << KS8721_10BTCR_MODE_SHIFT) /* Default */ -# define KS8721_10BTCR_MODE_10BTFD (5 << KS8721_10BTCR_MODE_SHIFT) /* 10BASE-T full duplex */ -# define KS8721_10BTCR_MODE_100BTFD (6 << KS8721_10BTCR_MODE_SHIFT) /* 100BASE-T full duplex */ -# define KS8721_10BTCR_MODE_ISOLATE (7 << KS8721_10BTCR_MODE_SHIFT) /* PHY/MII isolate */ -#define KS8721_10BTCR_ISOLATE (1 << 5) /* Bit 5: PHY isolate */ -#define KS8721_10BTCR_PAUSE (1 << 6) /* Bit 6: Enable pause */ -#define KS8721_10BTCR_ANEGCOMP (1 << 7) /* Bit 7: Auto-negotiation complete */ -#define KS8721_10BTCR_JABBERE (1 << 8) /* Bit 8: Enable Jabber */ -#define KS8721_10BTCR_INTLVL (1 << 9) /* Bit 9: Interrupt level */ -#define KS8721_10BTCR_POWER (1 << 10) /* Bit 10: Power saving */ -#define KS8721_10BTCR_FORCE (1 << 11) /* Bit 11: Force link */ -#define KS8721_10BTCR_ENERGY (1 << 12) /* Bit 12: Energy detect */ -#define KS8721_10BTCR_PAIRSWAPD (1 << 13) /* Bit 13: Pairswap disable */ - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_NET_MII_H */ diff --git a/nuttx/include/nuttx/net/net.h b/nuttx/include/nuttx/net/net.h deleted file mode 100644 index d23fb8796..000000000 --- a/nuttx/include/nuttx/net/net.h +++ /dev/null @@ -1,300 +0,0 @@ -/**************************************************************************** - * include/nuttx/net/net.h - * - * Copyright (C) 2007, 2009-2013 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_NUTTX_NET_NET_H -#define __INCLUDE_NUTTX_NET_NET_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#ifdef CONFIG_NET - -#include -#include -#include -#include - -#include - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Socket descriptors are the index into the TCB sockets list, offset by the - * following amount. This offset is used to distinquish file descriptors from - * socket descriptors - */ - -#ifdef CONFIG_NFILE_DESCRIPTORS -# define __SOCKFD_OFFSET CONFIG_NFILE_DESCRIPTORS -#else -# define __SOCKFD_OFFSET 0 -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* This defines a bitmap big enough for one bit for each socket option */ - -typedef uint16_t sockopt_t; - -/* This defines the storage size of a timeout value. This effects only - * range of supported timeout values. With an LSB in seciseconds, the - * 16-bit maximum of 65535 corresponds to 1 hr 49 min 13.5 sec at decisecond - * resolution. - */ - -typedef uint16_t socktimeo_t; - -/* This is the internal representation of a socket reference by a file - * descriptor. - */ - -struct socket -{ - int s_crefs; /* Reference count on the socket */ - uint8_t s_type; /* Protocol type: Only SOCK_STREAM or SOCK_DGRAM */ - uint8_t s_flags; /* See _SF_* definitions */ -#ifdef CONFIG_NET_SOCKOPTS - sockopt_t s_options; /* Selected socket options */ -#ifndef CONFIG_DISABLE_CLOCK - socktimeo_t s_rcvtimeo; /* Receive timeout value (in deciseconds) */ - socktimeo_t s_sndtimeo; /* Send timeout value (in deciseconds) */ -#endif -#endif - void *s_conn; /* Connection: struct uip_conn or uip_udp_conn */ -}; - -/* This defines a list of sockets indexed by the socket descriptor */ - -#if CONFIG_NSOCKET_DESCRIPTORS > 0 -struct socketlist -{ - sem_t sl_sem; /* Manage access to the socket list */ - struct socket sl_sockets[CONFIG_NSOCKET_DESCRIPTORS]; -}; -#endif - -/* Callback from netdev_foreach() */ - -struct uip_driver_s; /* Forward reference. See nuttx/net/uip/uip-arch.h */ -typedef int (*netdev_callback_t)(FAR struct uip_driver_s *dev, void *arg); - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" -{ -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/* net_checksd.c *************************************************************/ -/* Check if the socket descriptor is valid for the provided TCB and if it - * supports the requested access. - */ - -int net_checksd(int fd, int oflags); - -/* net_sockets.c *************************************************************/ -/* There interfaces are called only from OS scheduling and iniialization logic - * under sched/ - */ - -void weak_function net_initialize(void); -void net_initlist(FAR struct socketlist *list); -void net_releaselist(FAR struct socketlist *list); - -/* Given a socket descriptor, return the underly NuttX-specific socket - * structure. - */ - -FAR struct socket *sockfd_socket(int sockfd); - -/* socket.c ******************************************************************/ -/* socket using underlying socket structure */ - -int psock_socket(int domain, int type, int protocol, FAR struct socket *psock); - -/* net_close.c ***************************************************************/ -/* The standard close() operation redirects operations on socket descriptors - * to this function. - */ - -int net_close(int sockfd); - -/* Performs the close operation on a socket instance */ - -int psock_close(FAR struct socket *psock); - -/* net_close.c ***************************************************************/ -/* Performs the bind() operation on a socket instance */ - -int psock_bind(FAR struct socket *psock, FAR const struct sockaddr *addr, - socklen_t addrlen); - -/* connect.c *****************************************************************/ -/* Performs the connect() operation on a socket instance */ - -int psock_connect(FAR struct socket *psock, FAR const struct sockaddr *addr, - socklen_t addrlen); - -/* send.c ********************************************************************/ -/* Send using underlying socket structure */ - -ssize_t psock_send(FAR struct socket *psock, const void *buf, size_t len, - int flags); - -/* sendto.c ******************************************************************/ -/* Sendto using underlying socket structure */ - -ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf, - size_t len, int flags, FAR const struct sockaddr *to, - socklen_t tolen); - -/* recvfrom.c ****************************************************************/ -/* recvfrom using the underlying socket structure */ - -ssize_t psock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, - int flags,FAR struct sockaddr *from, - FAR socklen_t *fromlen); - -/* recv using the underlying socket structure */ - -#define psock_recv(psock,buf,len,flags) \ - psock_recvfrom(psock,buf,len,flags,NULL,0) - -/* getsockopt.c **************************************************************/ -/* getsockopt using the underlying socket structure */ - -int psock_getsockopt(FAR struct socket *psock, int level, int option, - FAR void *value, FAR socklen_t *value_len); - -/* setsockopt.c **************************************************************/ -/* setsockopt using the underlying socket structure */ - -int psock_setsockopt(FAR struct socket *psock, int level, int option, - FAR const void *value, socklen_t value_len); - -/* net_ioctl.c ***************************************************************/ -/* The standard ioctl() operation redirects operations on socket descriptors - * to this function. - */ - -int netdev_ioctl(int sockfd, int cmd, unsigned long arg); - -/* net_poll.c ****************************************************************/ -/* The standard poll() operation redirects operations on socket descriptors - * to this function. - */ - -#ifndef CONFIG_DISABLE_POLL -struct pollfd; /* Forward reference -- see poll.h */ - -int psock_poll(FAR struct socket *psock, struct pollfd *fds, bool setup); -int net_poll(int sockfd, struct pollfd *fds, bool setup); -#endif - -/* net_dup.c *****************************************************************/ -/* The standard dup() operation redirects operations on socket descriptors to - * this function - */ - -int net_dup(int sockfd, int minsd); - -/* net_dup2.c ****************************************************************/ -/* The standard dup2() operation redirects operations on socket descriptors to - * this function (when both file and socket descriptors are supported) - */ - -#if CONFIG_NFILE_DESCRIPTORS > 0 -int net_dup2(int sockfd1, int sockfd2); -#else -# define net_dup2(sockfd1, sockfd2) dup2(sockfd1, sockfd2) -#endif - -/* net_clone.c ***************************************************************/ -/* Performs the low level, common portion of net_dup() and net_dup2() */ - -int net_clone(FAR struct socket *psock1, FAR struct socket *psock2); - -/* net_vfcntl.c **************************************************************/ -/* Performs fcntl operations on socket */ - -int net_vfcntl(int sockfd, int cmd, va_list ap); - -/* netdev-register.c *********************************************************/ -/* This function is called by network interface device drivers to inform the - * socket layer of their existence. This registration is necesary to support - * ioctl() operations on network devices to, for example, set MAC and IP - * addresses - */ - -int netdev_register(FAR struct uip_driver_s *dev); - -/* netdev-unregister.c *********************************************************/ -/* Unregister a network device driver. */ - -int netdev_unregister(FAR struct uip_driver_s *dev); - -/* net_foreach.c ************************************************************/ -/* Enumerates all registered network devices */ - -int netdev_foreach(netdev_callback_t callback, void *arg); - -/* drivers/net/slip.c ******************************************************/ -/* Instantiate a SLIP network interface. */ - -#ifdef CONFIG_NET_SLIP -int slip_initialize(int intf, const char *devname); -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_NET */ -#endif /* __INCLUDE_NUTTX_NET_NET_H */ diff --git a/nuttx/include/nuttx/net/uip/uip-arch.h b/nuttx/include/nuttx/net/uip/uip-arch.h deleted file mode 100644 index 73805c6fb..000000000 --- a/nuttx/include/nuttx/net/uip/uip-arch.h +++ /dev/null @@ -1,374 +0,0 @@ -/**************************************************************************** - * include/nuttx/net/uip/uip-arch.h - * Defines architecture-specific device driver interfaces to uIP - * - * Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Derived largely from portions of uIP with has a similar BSD-styple license: - * - * Copyright (c) 2001-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 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_NUTTX_NET_UIP_UIP_ARCH_H -#define __INCLUDE_NUTTX_NET_UIP_UIP_ARCH_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include - -#include -#ifdef CONFIG_NET_IGMP -# include -#endif - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* This structure collects information that is specific to a specific network - * interface driver. If the hardware platform supports only a single instance - * of this structure. - */ - -struct uip_driver_s -{ - /* This link is used to maintain a single-linked list of ethernet drivers. - * Must be the first field in the structure due to blink type casting. - */ - -#if CONFIG_NSOCKET_DESCRIPTORS > 0 - FAR struct uip_driver_s *flink; - - /* This is the name of network device assigned when netdev_register was called. - * This name is only used to support socket ioctl lookups by device name - * Examples: "eth0" - */ - - char d_ifname[IFNAMSIZ]; -#endif - - /* Drivers interface flags. See IFF_* definitions in include/net/if.h */ - - uint8_t d_flags; - - /* Ethernet device identity */ - -#ifdef CONFIG_NET_ETHERNET - struct ether_addr d_mac; /* Device MAC address */ -#endif - - /* Network identity */ - - uip_ipaddr_t d_ipaddr; /* Host IP address assigned to the network interface */ - uip_ipaddr_t d_draddr; /* Default router IP address */ - uip_ipaddr_t d_netmask; /* Network subnet mask */ - - /* The d_buf array is used to hold incoming and outgoing packets. The device - * driver should place incoming data into this buffer. When sending data, - * the device driver should read the link level headers and the TCP/IP - * headers from this buffer. The size of the link level headers is - * configured by the UIP_LLH_LEN define. - * - * uIP will handle only a single buffer for both incoming and outgoing - * packets. However, the drive design may be concurrently send and - * filling separate, break-off buffers if CONFIG_NET_MULTIBUFFER is - * defined. That buffer management must be controlled by the driver. - */ - -#ifdef CONFIG_NET_MULTIBUFFER - uint8_t *d_buf; -#else - uint8_t d_buf[CONFIG_NET_BUFSIZE + CONFIG_NET_GUARDSIZE]; -#endif - - /* d_appdata points to the location where application data can be read from - * or written into a packet. - */ - - uint8_t *d_appdata; - - /* This is a pointer into d_buf where a user application may append - * data to be sent. - */ - - uint8_t *d_snddata; - -#ifdef CONFIG_NET_TCPURGDATA - /* This pointer points to any urgent TCP data that has been received. Only - * present if compiled with support for urgent data (CONFIG_NET_TCPURGDATA). - */ - - uint8_t *d_urgdata; - - /* Length of the (received) urgent data */ - - uint16_t d_urglen; -#endif - -/* The length of the packet in the d_buf buffer. - * - * Holds the length of the packet in the d_buf buffer. - * - * When the network device driver calls the uIP input function, - * d_len should be set to the length of the packet in the d_buf - * buffer. - * - * When sending packets, the device driver should use the contents of - * the d_len variable to determine the length of the outgoing - * packet. - */ - - uint16_t d_len; - - /* When d_buf contains outgoing xmit data, xmtlen is nonzero and represents - * the amount of appllcation data after d_snddata - */ - - uint16_t d_sndlen; - - /* IGMP group list */ - -#ifdef CONFIG_NET_IGMP - sq_queue_t grplist; -#endif - - /* Driver callbacks */ - - int (*d_ifup)(struct uip_driver_s *dev); - int (*d_ifdown)(struct uip_driver_s *dev); - int (*d_txavail)(struct uip_driver_s *dev); -#ifdef CONFIG_NET_IGMP - int (*d_addmac)(struct uip_driver_s *dev, FAR const uint8_t *mac); - int (*d_rmmac)(struct uip_driver_s *dev, FAR const uint8_t *mac); -#endif - - /* Drivers may attached device-specific, private information */ - - void *d_private; -}; - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/* uIP device driver functions - * - * These functions are used by a network device driver for interacting - * with uIP. - * - * Process an incoming packet. - * - * This function should be called when the device driver has received - * a packet from the network. The packet from the device driver must - * be present in the d_buf buffer, and the length of the packet - * should be placed in the d_len field. - * - * When the function returns, there may be an outbound packet placed - * in the d_buf packet buffer. If so, the d_len field is set to - * the length of the packet. If no packet is to be sent out, the - * d_len field is set to 0. - * - * The usual way of calling the function is presented by the source - * code below. - * - * dev->d_len = devicedriver_poll(); - * if(dev->d_len > 0) { - * uip_input(dev); - * if(dev->d_len > 0) { - * devicedriver_send(); - * } - * } - * - * Note: If you are writing a uIP device driver that needs ARP - * (Address Resolution Protocol), e.g., when running uIP over - * Ethernet, you will need to call the uIP ARP code before calling - * this function: - * - * #define BUF ((struct uip_eth_hdr *)&dev->d_buf[0]) - * dev->d_len = ethernet_devicedrver_poll(); - * if(dev->d_len > 0) { - * if(BUF->type == HTONS(UIP_ETHTYPE_IP)) { - * uip_arp_ipin(); - * uip_input(dev); - * if(dev->d_len > 0) { - * uip_arp_out(); - * devicedriver_send(); - * } - * } else if(BUF->type == HTONS(UIP_ETHTYPE_ARP)) { - * uip_arp_arpin(); - * if(dev->d_len > 0) { - * devicedriver_send(); - * } - * } - */ - -extern void uip_input(struct uip_driver_s *dev); - -/* Polling of connections - * - * These functions will traverse each active uIP connection structure and - * perform appropriate operatios: uip_timer() will perform TCP timer - * operations (and UDP polling operations); uip_poll() will perform TCP - * and UDP polling operations. The CAN driver MUST implement logic to - * periodically call uip_timer(); uip_poll() may be called asychronously - * from the network driver can accept another outgoing packet. - * - * In both cases, these functions will call the provided callback function - * for every active connection. Polling will continue until all connections - * have been polled or until the user-suplied function returns a non-zero - * value (which it should do only if it cannot accept further write data). - * - * When the callback function is called, there may be an outbound packet - * waiting for service in the uIP packet buffer, and if so the d_len field - * is set to a value larger than zero. The device driver should then send - * out the packet. - * - * Example: - * int driver_callback(struct uip_driver_dev *dev) - * { - * if (dev->d_len > 0) - * { - * devicedriver_send(); - * return 1; <-- Terminates polling if necessary - * } - * return 0; - * } - * - * ... - * uip_poll(dev, driver_callback); - * - * Note: If you are writing a uIP device driver that needs ARP (Address - * Resolution Protocol), e.g., when running uIP over Ethernet, you will - * need to call the uip_arp_out() function in the callback function - * before sending the packet: - * - * int driver_callback(struct uip_driver_dev *dev) - * { - * if (dev->d_len > 0) - * { - * uip_arp_out(); - * devicedriver_send(); - * return 1; <-- Terminates polling if necessary - * } - * return 0; - * } - */ - -typedef int (*uip_poll_callback_t)(struct uip_driver_s *dev); -extern int uip_poll(struct uip_driver_s *dev, uip_poll_callback_t callback); -extern int uip_timer(struct uip_driver_s *dev, uip_poll_callback_t callback, int hsec); - -/* By defining UIP_ARCH_CHKSUM, the architecture can replace up_incr32 - * with hardware assisted solutions. - */ - -/* Carry out a 32-bit addition. - * - * op32 - A pointer to a 4-byte array representing a 32-bit - * integer in network byte order (big endian). This value may not - * be word aligned. The value pointed to by op32 is modified in place - * - * op16 - A 16-bit integer in host byte order. - */ - -extern void uip_incr32(uint8_t *op32, uint16_t op16); - -/* Calculate the Internet checksum over a buffer. - * - * The Internet checksum is the one's complement of the one's - * complement sum of all 16-bit words in the buffer. - * - * See RFC1071. - * - * Note: This function is not called in the current version of uIP, - * but future versions might make use of it. - * - * buf A pointer to the buffer over which the checksum is to be - * computed. - * - * len The length of the buffer over which the checksum is to - * be computed. - * - * Return: The Internet checksum of the buffer. - */ - -extern uint16_t uip_chksum(uint16_t *buf, uint16_t len); - -/* Calculate the IP header checksum of the packet header in d_buf. - * - * The IP header checksum is the Internet checksum of the 20 bytes of - * the IP header. - * - * Return: The IP header checksum of the IP header in the d_buf - * buffer. - */ - -extern uint16_t uip_ipchksum(struct uip_driver_s *dev); - -/* Calculate the TCP checksum of the packet in d_buf and d_appdata. - * - * The TCP checksum is the Internet checksum of data contents of the - * TCP segment, and a pseudo-header as defined in RFC793. - * - * Note: The d_appdata pointer that points to the packet data may - * point anywhere in memory, so it is not possible to simply calculate - * the Internet checksum of the contents of the d_buf buffer. - * - * Return: The TCP checksum of the TCP segment in d_buf and pointed - * to by d_appdata. - */ - -extern uint16_t uip_tcpchksum(struct uip_driver_s *dev); - -extern uint16_t uip_udpchksum(struct uip_driver_s *dev); -extern uint16_t uip_icmpchksum(struct uip_driver_s *dev, int len); - -#endif /* __INCLUDE_NUTTX_NET_UIP_UIP_ARCH_H */ - diff --git a/nuttx/include/nuttx/net/uip/uip-arp.h b/nuttx/include/nuttx/net/uip/uip-arp.h deleted file mode 100644 index ba704cc13..000000000 --- a/nuttx/include/nuttx/net/uip/uip-arp.h +++ /dev/null @@ -1,262 +0,0 @@ -/**************************************************************************** - * include/nuttx/net/uip/uip-arch.h - * Macros and definitions for the ARP module. - * - * Copyright (C) 2007, 2009-2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Derived from uIP with has a similar BSD-styple license: - * - * Author: Adam Dunkels - * Copyright (c) 2001-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 __INCLUDE_NUTTX_NET_UIP_UIP_ARP_H -#define __INCLUDE_NUTTX_NET_UIP_UIP_ARP_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#include - -#include -#include -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/* Recognized values of the type bytes in the Ethernet header */ - -#define UIP_ETHTYPE_ARP 0x0806 -#define UIP_ETHTYPE_IP 0x0800 -#define UIP_ETHTYPE_IP6 0x86dd - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* The Ethernet header -- 14 bytes. The first two fields are type 'struct - * ether_addr but are represented as a simple byte array here because - * some compilers refuse to pack 6 byte structures. - */ - -struct uip_eth_hdr -{ - uint8_t dest[6]; /* Ethernet destination address (6 bytes) */ - uint8_t src[6]; /* Ethernet source address (6 bytes) */ - uint16_t type; /* Type code (2 bytes) */ -}; - -/* One entry in the ARP table (volatile!) */ - -struct arp_entry -{ - in_addr_t at_ipaddr; /* IP address */ - struct ether_addr at_ethaddr; /* Hardware address */ - uint8_t at_time; -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef CONFIG_NET_ARP -/**************************************************************************** - * Name: uip_arp_init - * - * Description: - * Initialize the ARP module. This function must be called before any of - * the other ARP functions. - * - ****************************************************************************/ - -EXTERN void uip_arp_init(void); - -/**************************************************************************** - * Name: uip_arp_ipin - * - * Description: - * The uip_arp_ipin() function should be called whenever an IP packet - * arrives from the Ethernet. This function refreshes the ARP table or - * inserts a new mapping if none exists. The function assumes that an - * IP packet with an Ethernet header is present in the d_buf buffer - * and that the length of the packet is in the d_len field. - * - ****************************************************************************/ - -#ifdef CONFIG_NET_ARP_IPIN -EXTERN void uip_arp_ipin(struct uip_driver_s *dev); -#else -# define uip_arp_ipin(dev) -#endif - -/**************************************************************************** - * Name: uip_arp_arpin - * - * Description: - * The uip_arp_arpin() should be called when an ARP packet is received - * by the Ethernet driver. This function also assumes that the - * Ethernet frame is present in the d_buf buffer. When the - * uip_arp_arpin() function returns, the contents of the d_buf - * buffer should be sent out on the Ethernet if the d_len field - * is > 0. - * - ****************************************************************************/ - -EXTERN void uip_arp_arpin(struct uip_driver_s *dev); - -/**************************************************************************** - * Name: uip_arp_arpin - * - * Description: - * The uip_arp_out() function should be called when an IP packet - * should be sent out on the Ethernet. This function creates an - * Ethernet header before the IP header in the d_buf buffer. The - * Ethernet header will have the correct Ethernet MAC destination - * address filled in if an ARP table entry for the destination IP - * address (or the IP address of the default router) is present. If no - * such table entry is found, the IP packet is overwritten with an ARP - * request and we rely on TCP to retransmit the packet that was - * overwritten. In any case, the d_len field holds the length of - * the Ethernet frame that should be transmitted. - * - ****************************************************************************/ - -EXTERN void uip_arp_out(struct uip_driver_s *dev); - -/**************************************************************************** - * Name: uip_arp_timer - * - * Description: - * This function performs periodic timer processing in the ARP module - * and should be called at regular intervals. The recommended interval - * is 10 seconds between the calls. It is responsible for flushing old - * entries in the ARP table. - * - ****************************************************************************/ - -EXTERN void uip_arp_timer(void); - -/**************************************************************************** - * Name: uip_arp_update - * - * Description: - * Add the IP/HW address mapping to the ARP table -OR- change the IP - * address of an existing association. - * - * Input parameters: - * pipaddr - Refers to an IP address uint16_t[2] in network order - * ethaddr - Refers to a HW address uint8_t[IFHWADDRLEN] - * - * Assumptions - * Interrupts are disabled - * - ****************************************************************************/ - -EXTERN void uip_arp_update(uint16_t *pipaddr, uint8_t *ethaddr); - -/**************************************************************************** - * Name: uip_arp_find - * - * Description: - * Find the ARP entry corresponding to this IP address. - * - * Input parameters: - * ipaddr - Refers to an IP address in network order - * - * Assumptions - * Interrupts are disabled; Returned value will become unstable when - * interrupts are re-enabled or if any other uIP APIs are called. - * - ****************************************************************************/ - -EXTERN struct arp_entry *uip_arp_find(in_addr_t ipaddr); - -/**************************************************************************** - * Name: uip_arp_delete - * - * Description: - * Remove an IP association from the ARP table - * - * Input parameters: - * ipaddr - Refers to an IP address in network order - * - * Assumptions - * Interrupts are disabled - * - ****************************************************************************/ - -#define uip_arp_delete(ipaddr) \ -{ \ - struct arp_entry *tabptr = uip_arp_find(ipaddr); \ - if (tabptr) \ - { \ - tabptr->at_ipaddr = 0; \ - } \ -} - -#else /* CONFIG_NET_ARP */ - -/* If ARP is disabled, stub out all ARP interfaces */ - -# define uip_arp_init() -# define uip_arp_ipin(dev) -# define uip_arp_arpin(dev) -# define uip_arp_out(dev) -# define uip_arp_timer() -# define uip_arp_update(pipaddr,ethaddr) -# define uip_arp_find(ipaddr) NULL -# define uip_arp_delete(ipaddr) - -#endif /* CONFIG_NET_ARP */ - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_NET_UIP_UIP_ARP_H */ diff --git a/nuttx/include/nuttx/net/uip/uip-icmp.h b/nuttx/include/nuttx/net/uip/uip-icmp.h deleted file mode 100644 index 27098d5d3..000000000 --- a/nuttx/include/nuttx/net/uip/uip-icmp.h +++ /dev/null @@ -1,211 +0,0 @@ -/**************************************************************************** - * include/nuttx/net/uip/uip-icmp.h - * Header file for the uIP ICMP stack. - * - * Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * This logic was leveraged from uIP which also has a BSD-style license: - * - * Author Adam Dunkels - * Copyright (c) 2001-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 __INCLUDE_NUTTX_NET_UIP_UIP_ICMP_H -#define __INCLUDE_NUTTX_NET_UIP_UIP_ICMP_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* ICMP/ICMP6 definitions */ - -/* ICMP/ICMP6 Message Types */ - -#define ICMP_ECHO_REPLY 0 /* RFC 792 */ -#define ICMP_DEST_UNREACHABLE 3 /* RFC 792 */ -#define ICMP_SRC_QUENCH 4 /* RFC 792 */ -#define ICMP_REDIRECT 5 /* RFC 792 */ -#define ICMP_ALT_HOST_ADDRESS 6 -#define ICMP_ECHO_REQUEST 8 /* RFC 792 */ -#define ICMP_ROUTER_ADVERTISEMENT 9 /* RFC 1256 */ -#define ICMP_ROUTER_SOLICITATION 10 /* RFC 1256 */ -#define ICMP_TIME_EXCEEDED 11 /* RFC 792 */ -#define ICMP_PARAMETER_PROBLEM 12 -#define ICMP_TIMESTAMP_REQUEST 13 -#define ICMP_TIMESTAMP_REPLY 14 -#define ICMP_INFORMATION_REQUEST 15 -#define ICMP_INFORMATION_REPLY 16 -#define ICMP_ADDRESS_MASK_REQUEST 17 -#define ICMP_ADDRESS_MASK_REPLY 18 -#define ICMP_TRACEROUTE 30 -#define ICMP_CONVERSION_ERROR 31 -#define ICMP_MOBILE_HOST_REDIRECT 32 -#define ICMP_IPV6_WHEREAREYOU 33 -#define ICMP_IPV6_IAMHERE 34 -#define ICMP_MOBILE_REGIS_REQUEST 35 -#define ICMP_MOBILE_REGIS_REPLY 36 -#define ICMP_DOMAIN_NAME_REQUEST 37 -#define ICMP_DOMAIN_NAME_REPLY 38 -#define ICMP_SKIP_DISCOVERY_PROTO 39 -#define ICMP_PHOTURIS_SECURITY_FAIL 40 -#define ICMP_EXP_MOBILE_PROTO 41 /* RFC 4065 */ - -/* ICMP6 Message Types */ - -#define ICMP6_ECHO_REPLY 129 -#define ICMP6_ECHO_REQUEST 128 -#define ICMP6_NEIGHBOR_SOLICITATION 135 -#define ICMP6_NEIGHBOR_ADVERTISEMENT 136 - -#define ICMP6_FLAG_S (1 << 6) - -#define ICMP6_OPTION_SOURCE_LINK_ADDRESS 1 -#define ICMP6_OPTION_TARGET_LINK_ADDRESS 2 - -/* Header sizes */ - -#define UIP_ICMPH_LEN 4 /* Size of ICMP header */ -#define UIP_IPICMPH_LEN (UIP_ICMPH_LEN + UIP_IPH_LEN) /* Size of IP + ICMP header */ - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/* The ICMP and IP headers */ - -struct uip_icmpip_hdr -{ -#ifdef CONFIG_NET_IPv6 - - /* IPv6 Ip header */ - - uint8_t vtc; /* Bits 0-3: version, bits 4-7: traffic class (MS) */ - uint8_t tcf; /* Bits 0-3: traffic class (LS), bits 4-7: flow label (MS) */ - uint16_t flow; /* 16-bit flow label (LS) */ - uint8_t len[2]; /* 16-bit Payload length */ - uint8_t proto; /* 8-bit Next header (same as IPv4 protocol field) */ - uint8_t ttl; /* 8-bit Hop limit (like IPv4 TTL field) */ - uip_ip6addr_t srcipaddr; /* 128-bit Source address */ - uip_ip6addr_t destipaddr; /* 128-bit Destination address */ - -#else /* CONFIG_NET_IPv6 */ - - /* IPv4 IP header */ - - uint8_t vhl; /* 8-bit Version (4) and header length (5 or 6) */ - uint8_t tos; /* 8-bit Type of service (e.g., 6=TCP) */ - uint8_t len[2]; /* 16-bit Total length */ - uint8_t ipid[2]; /* 16-bit Identification */ - uint8_t ipoffset[2]; /* 16-bit IP flags + fragment offset */ - uint8_t ttl; /* 8-bit Time to Live */ - uint8_t proto; /* 8-bit Protocol */ - uint16_t ipchksum; /* 16-bit Header checksum */ - uint16_t srcipaddr[2]; /* 32-bit Source IP address */ - uint16_t destipaddr[2]; /* 32-bit Destination IP address */ - -#endif /* CONFIG_NET_IPv6 */ - - /* ICMP header */ - - uint8_t type; /* Defines the format of the ICMP message */ - uint8_t icode; /* Further qualifies the ICMP messsage */ - uint16_t icmpchksum; /* Checksum of ICMP header and data */ - - /* Data following the ICMP header contains the data specific to the - * message type indicated by the Type and Code fields. - */ - -#ifndef CONFIG_NET_IPv6 - - /* ICMP_ECHO_REQUEST and ICMP_ECHO_REPLY data */ - - uint16_t id; /* Used to match requests with replies */ - uint16_t seqno; /* " " "" " " " " " " " " */ - -#else /* !CONFIG_NET_IPv6 */ - - /* ICMP6_ECHO_REQUEST and ICMP6_ECHO_REPLY data */ - - uint8_t flags; - uint8_t reserved1; - uint8_t reserved2; - uint8_t reserved3; - uint8_t icmp6data[16]; - uint8_t options[1]; - -#endif /* !CONFIG_NET_IPv6 */ -}; - -/* The structure holding the ICMP statistics that are gathered if - * CONFIG_NET_STATISTICS is defined. - */ - -#ifdef CONFIG_NET_STATISTICS -struct uip_icmp_stats_s -{ - uip_stats_t drop; /* Number of dropped ICMP packets */ - uip_stats_t recv; /* Number of received ICMP packets */ - uip_stats_t sent; /* Number of sent ICMP packets */ - uip_stats_t typeerr; /* Number of ICMP packets with a wrong type */ -}; -#endif - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -EXTERN int uip_ping(uip_ipaddr_t addr, uint16_t id, uint16_t seqno, uint16_t datalen, int dsecs); - -#undef EXTERN -#ifdef __cplusplus -} -#endif -#endif /* __INCLUDE_NUTTX_NET_UIP_UIP_ICMP_H */ diff --git a/nuttx/include/nuttx/net/uip/uip-igmp.h b/nuttx/include/nuttx/net/uip/uip-igmp.h deleted file mode 100644 index 8b6d79e61..000000000 --- a/nuttx/include/nuttx/net/uip/uip-igmp.h +++ /dev/null @@ -1,258 +0,0 @@ -/**************************************************************************** - * include/nuttx/net/uip/uip-igmp.h - * The definitions in this header file are intended only for internal use - * by the NuttX port of the uIP stack. - * - * Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * The NuttX implementation of IGMP was inspired by the IGMP add-on for the - * lwIP TCP/IP stack by Steve Reynolds: - * - * Copyright (c) 2002 CITEL Technologies Ltd. - * 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 CITEL Technologies Ltd 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 CITEL TECHNOLOGIES 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 CITEL TECHNOLOGIES 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_NUTTX_NET_UIP_UIP_IGMP_H -#define __INCLUDE_NUTTX_NET_UIP_UIP_IGMP_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include - -#include - -#include -#include - -#ifdef CONFIG_NET_IGMP - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#ifdef CONFIG_NET_IPv6 -# error "IGMP for IPv6 not supported" -#endif - -/* IGMP packet types */ - -#define IGMP_MEMBERSHIP_QUERY 0x11 /* Membership Query */ -#define IGMPv1_MEMBERSHIP_REPORT 0x12 /* IGMP Ver. 1 Membership Report */ -#define IGMPv2_MEMBERSHIP_REPORT 0x16 /* IGMP Ver. 2 Membership Report */ -#define IGMPv3_MEMBERSHIP_REPORT 0x22 /* IGMP Ver. 3 Membership Report */ -#define IGMP_LEAVE_GROUP 0x17 /* Leave Group */ - -/* Header sizes: - * - * UIP_IGMPH_LEN - Size of IGMP header in bytes - * UIP_IPIGMPH_LEN - Size of IP + Size of IGMP header + Size of router alert - */ - -#define UIP_IGMPH_LEN 8 -#define UIP_IPIGMPH_LEN (UIP_IGMPH_LEN + UIP_IPH_LEN + 4) - -/* Group flags */ - -#define IGMP_PREALLOCATED (1 << 0) -#define IGMP_LASTREPORT (1 << 1) -#define IGMP_IDLEMEMBER (1 << 2) -#define IGMP_SCHEDMSG (1 << 3) -#define IGMP_WAITMSG (1 << 4) - -#define SET_PREALLOCATED(f) do { (f) |= IGMP_PREALLOCATED; } while (0) -#define SET_LASTREPORT(f) do { (f) |= IGMP_LASTREPORT; } while (0) -#define SET_IDLEMEMBER(f) do { (f) |= IGMP_IDLEMEMBER; } while (0) -#define SET_SCHEDMSG(f) do { (f) |= IGMP_SCHEDMSG; } while (0) -#define SET_WAITMSG(f) do { (f) |= IGMP_WAITMSG; } while (0) - -#define CLR_PREALLOCATED(f) do { (f) &= ~IGMP_PREALLOCATED; } while (0) -#define CLR_LASTREPORT(f) do { (f) &= ~IGMP_LASTREPORT; } while (0) -#define CLR_IDLEMEMBER(f) do { (f) &= ~IGMP_IDLEMEMBER; } while (0) -#define CLR_SCHEDMSG(f) do { (f) &= ~IGMP_SCHEDMSG; } while (0) -#define CLR_WAITMSG(f) do { (f) &= ~IGMP_WAITMSG; } while (0) - -#define IS_PREALLOCATED(f) (((f) & IGMP_PREALLOCATED) != 0) -#define IS_LASTREPORT(f) (((f) & IGMP_LASTREPORT) != 0) -#define IS_IDLEMEMBER(f) (((f) & IGMP_IDLEMEMBER) != 0) -#define IS_SCHEDMSG(f) (((f) & IGMP_SCHEDMSG) != 0) -#define IS_WAITMSG(f) (((f) & IGMP_WAITMSG) != 0) - -#define IGMP_TTL 1 - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* IGMPv2 packet structure as defined by RFC 2236. - * - * The Max Respone Time (maxresp) specifies the time limit for the - * corresponding report. The field has a resolution of 100 miliseconds, the - * value is taken directly. This field is meaningful only in Membership Query - * (0x11); in other messages it is set to 0 and ignored by the receiver. - */ - -struct uip_igmphdr_s -{ -#ifdef CONFIG_NET_IPv6 - - /* IPv6 Ip header */ - - uint8_t vtc; /* Bits 0-3: version, bits 4-7: traffic class (MS) */ - uint8_t tcf; /* Bits 0-3: traffic class (LS), bits 4-7: flow label (MS) */ - uint16_t flow; /* 16-bit flow label (LS) */ - uint8_t len[2]; /* 16-bit Payload length */ - uint8_t proto; /* 8-bit Next header (same as IPv4 protocol field) */ - uint8_t ttl; /* 8-bit Hop limit (like IPv4 TTL field) */ - uip_ip6addr_t srcipaddr; /* 128-bit Source address */ - uip_ip6addr_t destipaddr; /* 128-bit Destination address */ - -#else /* CONFIG_NET_IPv6 */ - - /* IPv4 IP header */ - - uint8_t vhl; /* 8-bit Version (4) and header length (6 with Router Alert) */ - uint8_t tos; /* 8-bit Type of service (e.g., 6=TCP) */ - uint8_t len[2]; /* 16-bit Total length */ - uint8_t ipid[2]; /* 16-bit Identification */ - uint8_t ipoffset[2]; /* 16-bit IP flags + fragment offset */ - uint8_t ttl; /* 8-bit Time to Live */ - uint8_t proto; /* 8-bit Protocol */ - uint16_t ipchksum; /* 16-bit Header checksum */ - uint16_t srcipaddr[2]; /* 32-bit Source IP address */ - uint16_t destipaddr[2]; /* 32-bit Destination IP address */ - -#endif /* CONFIG_NET_IPv6 */ - - /* Router Alert IP header option */ - - uint16_t ra[2]; - - /* IGMPv2 header: - * - * 0 1 2 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Type | Max Resp Time | Checksum | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Group Address | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - */ - - uint8_t type; /* 8-bit IGMP packet type */ - uint8_t maxresp; /* 8-bit Max response time */ - uint16_t chksum; /* 16-bit Checksum */ - uint16_t grpaddr[2]; /* 32-bit Group address */ -}; - -#ifdef CONFIG_NET_STATISTICS -struct uip_igmp_stats_s -{ - uint32_t length_errors; - uint32_t chksum_errors; - uint32_t v1_received; - uint32_t joins; - uint32_t leaves; - uint32_t leave_sched; - uint32_t report_sched; - uint32_t poll_send; - uint32_t ucast_query; - uint32_t query_received; - uint32_t report_received; -}; - -# define IGMP_STATINCR(p) ((p)++) -#else -# define IGMP_STATINCR(p) -#endif - -/* This structure represents one group member. There is a list of groups - * for each device interface structure. - * - * There will be a group for the all systems group address but this - * will not run the state machine as it is used to kick off reports - * from all the other groups - */ - -typedef FAR struct wdog_s *WDOG_ID; -struct igmp_group_s -{ - struct igmp_group_s *next; /* Implements a singly-linked list */ - uip_ipaddr_t grpaddr; /* Group IP address */ - WDOG_ID wdog; /* WDOG used to detect timeouts */ - sem_t sem; /* Used to wait for message transmission */ - volatile uint8_t flags; /* See IGMP_ flags definitions */ - uint8_t msgid; /* Pending message ID (if non-zero) */ -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -EXTERN uip_ipaddr_t g_allsystems; -EXTERN uip_ipaddr_t g_allrouters; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Name: uip_igmpdevinit - * - * Description: - * Called when a new network device is registered to configure that device - * for IGMP support. - * - ****************************************************************************/ - -EXTERN void uip_igmpdevinit(struct uip_driver_s *dev); -EXTERN int igmp_joingroup(struct uip_driver_s *dev, FAR const struct in_addr *grpaddr); -EXTERN int igmp_leavegroup(struct uip_driver_s *dev, FAR const struct in_addr *grpaddr); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* CONFIG_NET_IGMP */ -#endif /* __INCLUDE_NUTTX_NET_UIP_UIP_IGMP_H */ diff --git a/nuttx/include/nuttx/net/uip/uip-ipopt.h b/nuttx/include/nuttx/net/uip/uip-ipopt.h deleted file mode 100644 index 2d7393c02..000000000 --- a/nuttx/include/nuttx/net/uip/uip-ipopt.h +++ /dev/null @@ -1,251 +0,0 @@ -/************************************************************************************************************ - * include/nuttx/net/uip/uip-ipopt.h - * - * Defines values for the IP header options - * - * 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 __INCLUDE_NUTTX_NET_UIP_UIP_IPOPT_H -#define __INCLUDE_NUTTX_NET_UIP_UIP_IPOPT_H - -/************************************************************************************************************ - * Included Files - ************************************************************************************************************/ - -#include - -/************************************************************************************************************ - * Pre-processor Definitions - ************************************************************************************************************/ - -/* IP Header Options: - * - * The basic 20-byte IP header can be extended by up to another 40 bytes - * (in units of 4 bytes) to provide IP options. The format of a single IP - * option is as follows: - * - * Single byte options: - * - * Type: 8-bits - * - * Multi-byte options: - * - * Type: 8-bits - * Length: 8-bits - * Pointer: 8-bits: - * Option Data: (depends on Length) - * - * The IP Option Type byte consists of the following subfields: - */ - -#define IPOPT_TYPE_OPTION_SHIFT (0) /* Bits 0-5: Option number*/ -#define IPOPT_TYPE_OPTION_MASK (0x1f << IPOPT_TYPE_OPTION_SHIFT) -# define IPOPT_TYPE_OPTION_END (0 << IPOPT_TYPE_OPTION_SHIFT) /* End of options list (RFC 791) */ -# define IPOPT_TYPE_OPTION_NOOP (1 << IPOPT_TYPE_OPTION_SHIFT) /* No operation (RFC 791) */ -# define IPOPT_TYPE_OPTION_SEC (2 << IPOPT_TYPE_OPTION_SHIFT) /* Security (RFC 791, 1108) */ -# define IPOPT_TYPE_OPTION_LSRR (3 << IPOPT_TYPE_OPTION_SHIFT) /* Loose source and record route (RFC 791) */ -# define IPOPT_TYPE_OPTION_TIMESTAMP (4 << IPOPT_TYPE_OPTION_SHIFT) /* Timestamp (RFC 781, 791) */ -# define IPOPT_TYPE_OPTION_EXTSEC (5 << IPOPT_TYPE_OPTION_SHIFT) /* Extended security (RFC 1108) */ -# define IPOPT_TYPE_OPTION_COMMSEC (6 << IPOPT_TYPE_OPTION_SHIFT) /* Commercial security */ -# define IPOPT_TYPE_OPTION_RR (7 << IPOPT_TYPE_OPTION_SHIFT) /* Record route (RFC 791) */ -# define IPOPT_TYPE_OPTION_SSID (8 << IPOPT_TYPE_OPTION_SHIFT) /* Stream ID (RFC 791, 1122) */ -# define IPOPT_TYPE_OPTION_SSRR (9 << IPOPT_TYPE_OPTION_SHIFT) /* Strict source and record route (RFC 791) */ -# define IPOPT_TYPE_OPTION_EXPMEAS (10 << IPOPT_TYPE_OPTION_SHIFT) /* Experimental measurement */ -# define IPOPT_TYPE_OPTION_MTUPROBE (11 << IPOPT_TYPE_OPTION_SHIFT) /* MTU Probe (RFC 1063) */ -# define IPOPT_TYPE_OPTION_MTUREPLY (12 << IPOPT_TYPE_OPTION_SHIFT) /* MTU Reply (RFC 1063) */ -# define IPOPT_TYPE_OPTION_EXPFC (13 << IPOPT_TYPE_OPTION_SHIFT) /* Experimental flow control */ -# define IPOPT_TYPE_OPTION_EXPAC (14 << IPOPT_TYPE_OPTION_SHIFT) /* Experimental access control */ -# define IPOPT_TYPE_OPTION_ENCODE (15 << IPOPT_TYPE_OPTION_SHIFT) /* ENCODE */ -# define IPOPT_TYPE_OPTION_IMITD (16 << IPOPT_TYPE_OPTION_SHIFT) /* IMI traffic descriptor */ -# define IPOPT_TYPE_OPTION_EXTIP (17 << IPOPT_TYPE_OPTION_SHIFT) /* Extended IP (RFC 1385) */ -# define IPOPT_TYPE_OPTION_TR (18 << IPOPT_TYPE_OPTION_SHIFT) /* Traceroute (RFC 1393) */ -# define IPOPT_TYPE_OPTION_ADDREXT (19 << IPOPT_TYPE_OPTION_SHIFT) /* Address extension (RFC 1475) */ -# define IPOPT_TYPE_OPTION_RA (20 << IPOPT_TYPE_OPTION_SHIFT) /* Router alert (RFC 2113) */ -# define IPOPT_TYPE_OPTION_SDBM (21 << IPOPT_TYPE_OPTION_SHIFT) /* Selective direct broadcast mode (RFC 1770) */ -# define IPOPT_TYPE_OPTION_DPS (23 << IPOPT_TYPE_OPTION_SHIFT) /* Dynamic packet state */ -# define IPOPT_TYPE_OPTION_UMP (24 << IPOPT_TYPE_OPTION_SHIFT) /* Upstream multicast packet */ -# define IPOPT_TYPE_OPTION_QS (25 << IPOPT_TYPE_OPTION_SHIFT) /* Quick start (RFC 4782) */ -# define IPOPT_TYPE_OPTION_EXP3692 (30 << IPOPT_TYPE_OPTION_SHIFT) /* RFC 3692-style experiment (RFC 4782) */ -#define IPOPT_TYPE_CLASS_SHIFT (5) /* Bits 5-6: Class */ -#define IPOPT_TYPE_CLASS_MASK (3 << IPOPT_TYPE_CLASS_SHIFT) -# define IPOPT_TYPE_CLASS_CTRL (0 << IPOPT_TYPE_CLASS_SHIFT) /* Control */ -# define IPOPT_TYPE_CLASS_MEASURE (2 << IPOPT_TYPE_CLASS_SHIFT) /* Debugging and measurement */ -#define IPOPT_TYPE_COPIED (1 << 7) /* Bit 7: IP layer must copy option to each fragment */ -#define IPOPT_TYPE_NOTCOPIED (0) - -/* IP Option encoding macros */ - -#define IPOPT_MKTYPE(copied,class,option) (copied|class|option) - -#define IPOPT_MKOPTION8(copied,class,option) \ - ((uint8_t)IPOPT_MKTYPE(copied,class,option)) -#define IPOPT_MKOPTION32(type,len,ptr,data) \ - ((uint32_t)(type) << 24 | (uint32_t)(len) << 16 | \ - (uint32_t)(ptr) << 8 | (uint32_t)(data)) - -/* Option Copy Class Length Description References - * ------ ---- ----- --------- ------------------------------------------------ - * 0 0 0 1 End of options list (RFC 791) - * 1 0 0 1 NOP (RFC 791 - * 2 1 0 11 Security (RFC 791, RFC 1108) - * 3 1 0 variable Loose Source Route (RFC 791) - * 4 0 2 variable Time stamp (RFC 781, RFC 791) - * 5 1 0 3-31 Extended Security (RFC 1108) - * 6 1 0 Commercial Security - * 7 0 0 variable Record Route (RFC 791) - * 8 1 0 4 Stream Identifier (RFC 791, RFC 1122) - * 9 1 0 variable Strict Source Route (RFC 791) - * 10 0 0 Experimental Measurement - * 11 0 0 4 MTU Probe (obsolete) (RFC 1063) - * 12 0 0 4 MTU Reply (obsolete) (RFC 1063) - * 13 1 2 Experimental Flow Control - * 14 1 0 Experimental Access Control - * 15 0 0 ENCODE - * 16 1 0 IMI Traffic Descriptor - * 17 1 0 variable Extended Internet Protocol (RFC 1385) - * 18 0 2 12 Traceroute (RFC 1393) - * 19 1 0 10 Address Extension (RFC 1475) - * 20 1 0 4 Router Alert (RFC 2113) - * 21 1 0 6-38 Selective Directed Broadcast Mode (RFC 1770) - * 22 1 0 - * 23 1 0 Dynamic Packet State - * 24 1 0 Upstream Multicast Packet - * 25 0 0 QS, Quick-Start (RFC 4782) - * 26 - * - - * 29 - * 30 0 0 EXP - RFC3692-style Experiment (RFC 4727) - * 30 0 2 EXP - RFC3692-style Experiment (RFC 4727) - * 30 1 0 EXP - RFC3692-style Experiment RFC 4727) - * 30 1 2 EXP - RFC3692-style Experiment (RFC 4727) - * 31 - */ - -#define IPOTR_END_LEN 1 -#define IPOPT_END_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_NOTCOPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_END) - -#define IPOTR_NOOP_LEN 1 -#define IPOPT_NOOP_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_NOTCOPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_NOOP) - -#define IPOPT_SEC_LEN 11 -#define IPOPT_SEC_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_COPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_SEC) - -#define IPOPT_LSRR_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_COPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_LSRR) - -#define IPOPT_TIMESTAMP_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_NOTCOPIED, IPOPT_TYPE_CLASS_MEASURE, IPOPT_TYPE_OPTION_TIMESTAMP) - -#define IPOPT_EXTSEC_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_COPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_EXTSEC) - -#define IPOPT_COMMSEC_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_COPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_COMMSEC) - -#define IPOPT_RR_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_NOTCOPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_RR) - -#define IPOPT_SSID_LEN 4 -#define IPOPT_SSID_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_COPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_SSID) - -#define IPOPT_SSRR_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_COPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_SSRR) -#define IPOPT_EXPMEAS_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_NOTCOPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_EXPMEAS) - -#define IPOPT_MTUPROBE_LEN 4 -#define IPOPT_MTUPROBE_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_NOTCOPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_MTUPROBE) - -#define IPOPT_MTUREPLY_LEN 4 -#define IPOPT_MTUREPLY_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_NOTCOPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_MTUREPLY) - -#define IPOPT_EXPFC_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_COPIED, IPOPT_TYPE_CLASS_MEASURE, IPOPT_TYPE_OPTION_EXPFC) - -#define IPOPT_EXPAC_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_COPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_EXPAC) - -#define IPOPT_ENCODE_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_NOTCOPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_ENCODE) - -#define IPOPT_IMITD_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_COPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_IMITD) - -#define IPOPT_EXTIP_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_COPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_EXTIP) - -#define IPOPT_TR_LEN 12 -#define IPOPT_TR_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_NOTCOPIED, IPOPT_TYPE_CLASS_MEASURE, IPOPT_TYPE_OPTION_TR) - -#define IPOPT_ADDREXT_LEN 10 -#define IPOPT_ADDREXT_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_COPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_ADDREXT) - -#define IPOPT_RA_LEN 4 -#define IPOPT_RA_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_COPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_RA) -#define IPOPT_RA \ - IPOPT_MKOPTION32(IPOPT_RA_TYPE, 4, 0, 0) - -#define IPOPT_SDBM_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_COPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_SDBM) - -#define IPOPT_DPS_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_COPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_DPS) - -#define IPOPT_UMP_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_COPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_UMP) - -#define IPOPT_QS_TYPE \ - IPOPT_MKTYPE(IPOPT_TYPE_NOTCOPIED, IPOPT_TYPE_CLASS_CTRL, IPOPT_TYPE_OPTION_QS) - -/************************************************************************************************************ - * Public Type Definitions - ************************************************************************************************************/ - -/************************************************************************************************************ - * Public Data - ************************************************************************************************************/ - -/************************************************************************************************************ - * Public Function Prototypes - ************************************************************************************************************/ - -#endif /* __INCLUDE_NUTTX_NET_UIP_UIP_IPOPT_H */ diff --git a/nuttx/include/nuttx/net/uip/uip-tcp.h b/nuttx/include/nuttx/net/uip/uip-tcp.h deleted file mode 100644 index c3c800d7b..000000000 --- a/nuttx/include/nuttx/net/uip/uip-tcp.h +++ /dev/null @@ -1,460 +0,0 @@ -/**************************************************************************** - * include/nuttx/net/uip/uip-tcp.h - * Header file for the uIP TCP/IP stack. - * - * The uIP TCP/IP stack header file contains definitions for a number - * of C macros that are used by uIP programs as well as internal uIP - * structures, TCP/IP header structures and function declarations. - * - * Copyright (C) 2007, 2009-2010, 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * This logic was leveraged from uIP which also has a BSD-style license: - * - * Author Adam Dunkels - * Copyright (c) 2001-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 __INCLUDE_NUTTX_NET_UIP_UIP_TCP_H -#define __INCLUDE_NUTTX_NET_UIP_UIP_TCP_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#ifdef CONFIG_NET_TCP - -#include -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* TCP definitions */ - -#define TCP_FIN 0x01 -#define TCP_SYN 0x02 -#define TCP_RST 0x04 -#define TCP_PSH 0x08 -#define TCP_ACK 0x10 -#define TCP_URG 0x20 -#define TCP_CTL 0x3f - -#define TCP_OPT_END 0 /* End of TCP options list */ -#define TCP_OPT_NOOP 1 /* "No-operation" TCP option */ -#define TCP_OPT_MSS 2 /* Maximum segment size TCP option */ - -#define TCP_OPT_MSS_LEN 4 /* Length of TCP MSS option. */ - -/* The TCP states used in the struct uip_conn tcpstateflags field */ - -#define UIP_TS_MASK 0x0f /* Bits 0-3: TCP state */ -#define UIP_CLOSED 0x00 /* The connection is not in use and available */ -#define UIP_ALLOCATED 0x01 /* The connection is allocated, but not yet initialized */ -#define UIP_SYN_RCVD 0x02 -#define UIP_SYN_SENT 0x03 -#define UIP_ESTABLISHED 0x04 -#define UIP_FIN_WAIT_1 0x05 -#define UIP_FIN_WAIT_2 0x06 -#define UIP_CLOSING 0x07 -#define UIP_TIME_WAIT 0x08 -#define UIP_LAST_ACK 0x09 -#define UIP_STOPPED 0x10 /* Bit 4: stopped */ - /* Bit 5-7: Unused, but not available */ - -/* Flag bits in 16-bit flags+ipoffset IPv4 TCP header field */ - -#define UIP_TCPFLAG_RESERVED 0x8000 -#define UIP_TCPFLAG_DONTFRAG 0x4000 -#define UIP_TCPFLAG_MOREFRAGS 0x2000 - -/* TCP header sizes */ - -#define UIP_TCPH_LEN 20 /* Size of TCP header */ -#define UIP_IPTCPH_LEN (UIP_TCPH_LEN + UIP_IPH_LEN) /* Size of IP + TCP header */ -#define UIP_TCPIP_HLEN UIP_IPTCPH_LEN - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/* Representation of a uIP TCP connection. - * - * The uip_conn structure is used for identifying a connection. All - * but one field in the structure are to be considered read-only by an - * application. The only exception is the "private: field whos purpose - * is to let the application store application-specific state (e.g., - * file pointers) for the connection. - */ - -struct uip_driver_s; /* Forward reference */ -struct uip_callback_s; /* Forward reference */ -struct uip_backlog_s; /* Forward reference */ - -struct uip_conn -{ - dq_entry_t node; /* Implements a doubly linked list */ - uip_ipaddr_t ripaddr; /* The IP address of the remote host */ - uint16_t lport; /* The local TCP port, in network byte order */ - uint16_t rport; /* The remoteTCP port, in network byte order */ - uint8_t rcvseq[4]; /* The sequence number that we expect to - * receive next */ - uint8_t sndseq[4]; /* The sequence number that was last sent by us */ - uint16_t unacked; /* Number bytes sent but not yet ACKed */ - uint16_t mss; /* Current maximum segment size for the - * connection */ - uint16_t initialmss; /* Initial maximum segment size for the - * connection */ - uint8_t crefs; /* Reference counts on this instance */ - uint8_t sa; /* Retransmission time-out calculation state - * variable */ - uint8_t sv; /* Retransmission time-out calculation state - * variable */ - uint8_t rto; /* Retransmission time-out */ - uint8_t tcpstateflags; /* TCP state and flags */ - uint8_t timer; /* The retransmission timer (units: half-seconds) */ - uint8_t nrtx; /* The number of retransmissions for the last - * segment sent */ - - /* Read-ahead buffering. - * - * readahead - A singly linked list of type struct uip_readahead_s - * where the TCP/IP read-ahead data is retained. - */ - -#if CONFIG_NET_NTCP_READAHEAD_BUFFERS > 0 - sq_queue_t readahead; /* Read-ahead buffering */ -#endif - - /* Listen backlog support - * - * blparent - The backlog parent. If this connection is backlogged, - * this field will be non-null and will refer to the TCP connection - * structure in which this connection is backlogged. - * backlog - The pending connection backlog. If this connection is - * configured as a listener with backlog, then this refers to the - * struct uip_backlog_s tear-off structure that manages that backlog. - */ - -#ifdef CONFIG_NET_TCPBACKLOG - struct uip_conn *blparent; - struct uip_backlog_s *backlog; -#endif - - /* Application callbacks: - * - * Data transfer events are retained in 'list'. Event handlers in 'list' - * are called for events specified in the flags set within struct - * uip_callback_s - * - * When an callback is executed from 'list', the input flags are normally - * returned, however, the implementation may set one of the following: - * - * UIP_CLOSE - Gracefully close the current connection - * UIP_ABORT - Abort (reset) the current connection on an error that - * prevents UIP_CLOSE from working. - * - * And/Or set/clear the following: - * - * UIP_NEWDATA - May be cleared to indicate that the data was consumed - * and that no further process of the new data should be - * attempted. - * UIP_SNDACK - If UIP_NEWDATA is cleared, then UIP_SNDACK may be set - * to indicate that an ACK should be included in the response. - * (In UIP_NEWDATA is cleared bu UIP_SNDACK is not set, then - * dev->d_len should also be cleared). - */ - - struct uip_callback_s *list; - - /* accept() is called when the TCP logic has created a connection */ - - FAR void *accept_private; - int (*accept)(FAR struct uip_conn *listener, struct uip_conn *conn); - - /* connection_event() is called on any of the subset of connection-related events */ - - FAR void *connection_private; - void (*connection_event)(FAR struct uip_conn *conn, uint16_t flags); -}; - -/* The following structure is used to handle read-ahead buffering for TCP - * connection. When incoming TCP data is received while no application is - * listening for the data, that data will be retained in these read-ahead - * buffers so that no data is lost. - */ - -#if CONFIG_NET_NTCP_READAHEAD_BUFFERS > 0 -struct uip_readahead_s -{ - sq_entry_t rh_node; /* Supports a singly linked list */ - uint16_t rh_nbytes; /* Number of bytes available in this buffer */ - uint8_t rh_buffer[CONFIG_NET_TCP_READAHEAD_BUFSIZE]; -}; -#endif - -/* Support for listen backlog: - * - * struct uip_blcontainer_s describes one backlogged connection - * struct uip_backlog_s is a "tear-off" describing all backlog for a - * listener connection - */ - -#ifdef CONFIG_NET_TCPBACKLOG -struct uip_blcontainer_s -{ - sq_entry_t bc_node; /* Implements a singly linked list */ - FAR struct uip_conn *bc_conn; /* Holds reference to the new connection structure */ -}; - -struct uip_backlog_s -{ - sq_queue_t bl_free; /* Implements a singly-linked list of free containers */ - sq_queue_t bl_pending; /* Implements a singly-linked list of pending connections */ -}; -#endif - -/* The structure holding the TCP/IP statistics that are gathered if - * CONFIG_NET_STATISTICS is defined. - */ - -#ifdef CONFIG_NET_STATISTICS -struct uip_tcp_stats_s -{ - uip_stats_t drop; /* Number of dropped TCP segments */ - uip_stats_t recv; /* Number of received TCP segments */ - uip_stats_t sent; /* Number of sent TCP segments */ - uip_stats_t chkerr; /* Number of TCP segments with a bad checksum */ - uip_stats_t ackerr; /* Number of TCP segments with a bad ACK number */ - uip_stats_t rst; /* Number of received TCP RST (reset) segments */ - uip_stats_t rexmit; /* Number of retransmitted TCP segments */ - uip_stats_t syndrop; /* Number of dropped SYNs due to too few - available connections */ - uip_stats_t synrst; /* Number of SYNs for closed ports triggering a RST */ -}; -#endif - -/* The TCP and IP headers */ - -struct uip_tcpip_hdr -{ -#ifdef CONFIG_NET_IPv6 - - /* IPv6 Ip header */ - - uint8_t vtc; /* Bits 0-3: version, bits 4-7: traffic class (MS) */ - uint8_t tcf; /* Bits 0-3: traffic class (LS), 4-bits: flow label (MS) */ - uint16_t flow; /* 16-bit flow label (LS) */ - uint8_t len[2]; /* 16-bit Payload length */ - uint8_t proto; /* 8-bit Next header (same as IPv4 protocol field) */ - uint8_t ttl; /* 8-bit Hop limit (like IPv4 TTL field) */ - uip_ip6addr_t srcipaddr; /* 128-bit Source address */ - uip_ip6addr_t destipaddr; /* 128-bit Destination address */ - -#else /* CONFIG_NET_IPv6 */ - - /* IPv4 IP header */ - - uint8_t vhl; /* 8-bit Version (4) and header length (5 or 6) */ - uint8_t tos; /* 8-bit Type of service (e.g., 6=TCP) */ - uint8_t len[2]; /* 16-bit Total length */ - uint8_t ipid[2]; /* 16-bit Identification */ - uint8_t ipoffset[2]; /* 16-bit IP flags + fragment offset */ - uint8_t ttl; /* 8-bit Time to Live */ - uint8_t proto; /* 8-bit Protocol */ - uint16_t ipchksum; /* 16-bit Header checksum */ - uint16_t srcipaddr[2]; /* 32-bit Source IP address */ - uint16_t destipaddr[2]; /* 32-bit Destination IP address */ - -#endif /* CONFIG_NET_IPv6 */ - - /* TCP header */ - - uint16_t srcport; - uint16_t destport; - uint8_t seqno[4]; - uint8_t ackno[4]; - uint8_t tcpoffset; - uint8_t flags; - uint8_t wnd[2]; - uint16_t tcpchksum; - uint8_t urgp[2]; - uint8_t optdata[4]; -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/* uIP application functions - * - * Functions used by an application running of top of uIP. This includes - * functions for opening and closing connections, sending and receiving - * data, etc. - * - * Find a free connection structure and allocate it for use. This is - * normally something done by the implementation of the socket() API - */ - -extern struct uip_conn *uip_tcpalloc(void); - -/* Allocate a new TCP data callback */ - -#define uip_tcpcallbackalloc(conn) uip_callbackalloc(&conn->list) -#define uip_tcpcallbackfree(conn,cb) uip_callbackfree(cb, &conn->list) - -/* Free a connection structure that is no longer in use. This should - * be done by the implementation of close() - */ - -extern void uip_tcpfree(struct uip_conn *conn); - -/* Bind a TCP connection to a local address */ - -#ifdef CONFIG_NET_IPv6 -extern int uip_tcpbind(struct uip_conn *conn, const struct sockaddr_in6 *addr); -#else -extern int uip_tcpbind(struct uip_conn *conn, const struct sockaddr_in *addr); -#endif - -/* This function implements the UIP specific parts of the standard - * TCP connect() operation: It connects to a remote host using TCP. - * - * This function is used to start a new connection to the specified - * port on the specied host. It uses the connection structure that was - * allocated by a preceding socket() call. It sets the connection to - * the SYN_SENT state and sets the retransmission timer to 0. This will - * cause a TCP SYN segment to be sent out the next time this connection - * is periodically processed, which usually is done within 0.5 seconds - * after the call to uip_tcpconnect(). - * - * This function is called from normal user level code. - */ - -#ifdef CONFIG_NET_IPv6 -extern int uip_tcpconnect(struct uip_conn *conn, const struct sockaddr_in6 *addr); -#else -extern int uip_tcpconnect(struct uip_conn *conn, const struct sockaddr_in *addr); -#endif - -/* Start listening to the port bound to the specified TCP connection */ - -extern int uip_listen(struct uip_conn *conn); - -/* Stop listening to the port bound to the specified TCP connection */ - -extern int uip_unlisten(struct uip_conn *conn); - -/* Access to TCP read-ahead buffers */ - -#if CONFIG_NET_NTCP_READAHEAD_BUFFERS > 0 -extern struct uip_readahead_s *uip_tcpreadaheadalloc(void); -extern void uip_tcpreadaheadrelease(struct uip_readahead_s *buf); -#endif /* CONFIG_NET_NTCP_READAHEAD_BUFFERS */ - -/* Backlog support */ - -#ifdef CONFIG_NET_TCPBACKLOG -/* APIs to create and terminate TCP backlog support */ - -extern int uip_backlogcreate(FAR struct uip_conn *conn, int nblg); -extern int uip_backlogdestroy(FAR struct uip_conn *conn); - -/* APIs to manage individual backlog actions */ - -extern int uip_backlogadd(FAR struct uip_conn *conn, FAR struct uip_conn *blconn); -#ifndef CONFIG_DISABLE_POLL -extern bool uip_backlogavailable(FAR struct uip_conn *conn); -#else -# define uip_backlogavailable(conn) (false); -#endif -extern FAR struct uip_conn *uip_backlogremove(FAR struct uip_conn *conn); -extern int uip_backlogdelete(FAR struct uip_conn *conn, FAR struct uip_conn *blconn); - -#else -# define uip_backlogcreate(conn,nblg) (-ENOSYS) -# define uip_backlogdestroy(conn) (-ENOSYS) -# define uip_backlogadd(conn,blconn) (-ENOSYS) -# define uip_backlogavailable(conn) (false); -# define uip_backlogremove(conn) (NULL) -#endif - -/* Tell the sending host to stop sending data. - * - * This function will close our receiver's window so that we stop - * receiving data for the current connection. - */ - -#define uip_stop(conn) ((conn)->tcpstateflags |= UIP_STOPPED) - -/* Find out if the current connection has been previously stopped with - * uip_stop(). - */ - -#define uip_stopped(conn) ((conn)->tcpstateflags & UIP_STOPPED) - -/* Restart the current connection, if is has previously been stopped - * with uip_stop(). - * - * This function will open the receiver's window again so that we start - * receiving data for the current connection. - */ - -#define uip_restart(conn,f) \ - do { \ - (f) |= UIP_NEWDATA; \ - (conn)->tcpstateflags &= ~UIP_STOPPED; \ - } while(0) - -/* Get the initial maxium segment size (MSS) of the current - * connection. - */ - -#define uip_initialmss(conn) ((conn)->initialmss) - -/* Get the current maximum segment size that can be sent on the current - * connection. - * - * The current maxiumum segment size that can be sent on the connection is - * computed from the receiver's window and the MSS of the connection (which - * also is available by calling uip_initialmss()). - */ - -#define uip_mss(conn) ((conn)->mss) - -#endif /* CONFIG_NET_TCP */ -#endif /* __INCLUDE_NUTTX_NET_UIP_UIP_TCP_H */ diff --git a/nuttx/include/nuttx/net/uip/uip-udp.h b/nuttx/include/nuttx/net/uip/uip-udp.h deleted file mode 100644 index 5eb7f1711..000000000 --- a/nuttx/include/nuttx/net/uip/uip-udp.h +++ /dev/null @@ -1,206 +0,0 @@ -/**************************************************************************** - * include/nuttx/net/uip/uip-udp.h - * Header file for the uIP UDP stack. - * - * The uIP UDP stack header file contains definitions for a number - * of C macros that are used by uIP programs as well as internal uIP - * structures, UDP header structures and function declarations. - * - * Copyright (C) 2007, 2009, 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * This logic was leveraged from uIP which also has a BSD-style license: - * - * Author Adam Dunkels - * Copyright (c) 2001-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 __INCLUDE_NUTTX_NET_UIP_UIP_UDP_H -#define __INCLUDE_NUTTX_NET_UIP_UIP_UDP_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Header sizes */ - -#define UIP_UDPH_LEN 8 /* Size of UDP header */ -#define UIP_IPUDPH_LEN (UIP_UDPH_LEN + UIP_IPH_LEN) /* Size of IP + UDP header */ - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/* Representation of a uIP UDP connection */ - -struct uip_driver_s; /* Forward reference */ -struct uip_callback_s; /* Forward reference */ -struct uip_udp_conn -{ - dq_entry_t node; /* Supports a doubly linked list */ - uip_ipaddr_t ripaddr; /* The IP address of the remote peer */ - uint16_t lport; /* The local port number in network byte order */ - uint16_t rport; /* The remote port number in network byte order */ - uint8_t ttl; /* Default time-to-live */ - uint8_t crefs; /* Reference counts on this instance */ - - /* Defines the list of UDP callbacks */ - - struct uip_callback_s *list; -}; - -/* The UDP and IP headers */ - -struct uip_udpip_hdr -{ -#ifdef CONFIG_NET_IPv6 - - /* IPv6 Ip header */ - - uint8_t vtc; /* Bits 0-3: version, bits 4-7: traffic class (MS) */ - uint8_t tcf; /* Bits 0-3: traffic class (LS), 4-bits: flow label (MS) */ - uint16_t flow; /* 16-bit flow label (LS) */ - uint8_t len[2]; /* 16-bit Payload length */ - uint8_t proto; /* 8-bit Next header (same as IPv4 protocol field) */ - uint8_t ttl; /* 8-bit Hop limit (like IPv4 TTL field) */ - uip_ip6addr_t srcipaddr; /* 128-bit Source address */ - uip_ip6addr_t destipaddr; /* 128-bit Destination address */ - -#else /* CONFIG_NET_IPv6 */ - - /* IPv4 header */ - - uint8_t vhl; /* 8-bit Version (4) and header length (5 or 6) */ - uint8_t tos; /* 8-bit Type of service (e.g., 6=TCP) */ - uint8_t len[2]; /* 16-bit Total length */ - uint8_t ipid[2]; /* 16-bit Identification */ - uint8_t ipoffset[2]; /* 16-bit IP flags + fragment offset */ - uint8_t ttl; /* 8-bit Time to Live */ - uint8_t proto; /* 8-bit Protocol */ - uint16_t ipchksum; /* 16-bit Header checksum */ - uint16_t srcipaddr[2]; /* 32-bit Source IP address */ - uint16_t destipaddr[2]; /* 32-bit Destination IP address */ - -#endif /* CONFIG_NET_IPv6 */ - - /* UDP header */ - - uint16_t srcport; - uint16_t destport; - uint16_t udplen; - uint16_t udpchksum; -}; - -/* The structure holding the UDP statistics that are gathered if - * CONFIG_NET_STATISTICS is defined. - */ - -#ifdef CONFIG_NET_STATISTICS -struct uip_udp_stats_s -{ - uip_stats_t drop; /* Number of dropped UDP segments */ - uip_stats_t recv; /* Number of recived UDP segments */ - uip_stats_t sent; /* Number of sent UDP segments */ - uip_stats_t chkerr; /* Number of UDP segments with a bad checksum */ -}; -#endif - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/* uIP application functions - * - * Functions used by an application running of top of uIP. This includes - * functions for opening and closing connections, sending and receiving - * data, etc. - * - * Find a free connection structure and allocate it for use. This is - * normally something done by the implementation of the socket() API - */ - -extern struct uip_udp_conn *uip_udpalloc(void); - -/* Allocate a new TCP data callback */ - -#define uip_udpcallbackalloc(conn) uip_callbackalloc(&conn->list) -#define uip_udpcallbackfree(conn,cb) uip_callbackfree(cb, &conn->list) - -/* Free a connection structure that is no longer in use. This should - * be done by the implementation of close() - */ - -extern void uip_udpfree(struct uip_udp_conn *conn); - -/* Bind a UDP connection to a local address */ - -#ifdef CONFIG_NET_IPv6 -extern int uip_udpbind(struct uip_udp_conn *conn, const struct sockaddr_in6 *addr); -#else -extern int uip_udpbind(struct uip_udp_conn *conn, const struct sockaddr_in *addr); -#endif - -/* This function sets up a new UDP connection. The function will - * automatically allocate an unused local port for the new - * connection. However, another port can be chosen by using the - * uip_udpbind() call, after the uip_udpconnect() function has been - * called. - * - * This function is called as part of the implementation of sendto - * and recvfrom. - * - * addr The address of the remote host. - */ - -#ifdef CONFIG_NET_IPv6 -extern int uip_udpconnect(struct uip_udp_conn *conn, const struct sockaddr_in6 *addr); -#else -extern int uip_udpconnect(struct uip_udp_conn *conn, const struct sockaddr_in *addr); -#endif - -/* Enable/disable UDP callbacks on a connection */ - -extern void uip_udpenable(struct uip_udp_conn *conn); -extern void uip_udpdisable(struct uip_udp_conn *conn); - -#endif /* __INCLUDE_NUTTX_NET_UIP_UIP_UDP_H */ diff --git a/nuttx/include/nuttx/net/uip/uip.h b/nuttx/include/nuttx/net/uip/uip.h deleted file mode 100644 index 392793e68..000000000 --- a/nuttx/include/nuttx/net/uip/uip.h +++ /dev/null @@ -1,568 +0,0 @@ -/**************************************************************************** - * include/nuttx/net/uip/uip.h - * - * The uIP header file contains definitions for a number of C macros that - * are used by uIP programs as well as internal uIP structures and function - * declarations. - * - * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * This logic was leveraged from uIP which also has a BSD-style license: - * - * Author Adam Dunkels - * Copyright (c) 2001-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 __INCLUDE_NUTTX_NET_UIP_UIP_H -#define __INCLUDE_NUTTX_NET_UIP_UIP_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include - -#ifdef CONFIG_NET_NOINTS -# include -#endif - -#include - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* The following flags may be set in the set of flags before calling the - * application callback. The UIP_ACKDATA, UIP_NEWDATA, and UIP_CLOSE flags - * may be set at the same time, whereas the others are mutualy exclusive. - * - * UIP_ACKDATA IN: Signifies that the outstanding data was acked and - * the application should send out new data instead - * of retransmitting the last data (TCP only) - * OUT: Input state must be preserved on output. - * UIP_NEWDATA IN: Set to indicate that the peer has sent us new data. - * OUT: Cleared (only) by the application logic to indicate - * that the new data was consumed, suppressing further - * attempts to process the new data. - * UIP_SNDACK IN: Not used; always zero - * OUT: Set by the application if the new data was consumed - * and an ACK should be sent in the response. (TCP only) - * UIP_REXMIT IN: Tells the application to retransmit the data that - * was last sent. (TCP only) - * OUT: Not used - * UIP_POLL IN: Used for polling the application. This is provided - * periodically from the drivers to support (1) timed - * operations, and (2) to check if the application has - * data that it wants to send - * OUT: Not used - * UIP_BACKLOG IN: There is a new connection in the backlog list set - * up by the listen() command. (TCP only) - * OUT: Not used - * UIP_CLOSE IN: The remote host has closed the connection, thus the - * connection has gone away. (TCP only) - * OUT: The application signals that it wants to close the - * connection. (TCP only) - * UIP_ABORT IN: The remote host has aborted the connection, thus the - * connection has gone away. (TCP only) - * OUT: The application signals that it wants to abort the - * connection. (TCP only) - * UIP_CONNECTED IN: We have got a connection from a remote host and have - * set up a new connection for it, or an active connection - * has been successfully established. (TCP only) - * OUT: Not used - * UIP_TIMEDOUT IN: The connection has been aborted due to too many - * retransmissions. (TCP only) - * OUT: Not used - * UIP_ECHOREPLY IN: An ICMP Echo Reply has been received. Used to support - * ICMP ping from applications. (ICMP only) - * OUT: Cleared (only) by the application logic to indicate - * that the reply was processed, suppressing further - * attempts to process the reply. - */ - -#define UIP_ACKDATA (1 << 0) -#define UIP_NEWDATA (1 << 1) -#define UIP_SNDACK (1 << 2) -#define UIP_REXMIT (1 << 3) -#define UIP_POLL (1 << 4) -#define UIP_BACKLOG (1 << 5) -#define UIP_CLOSE (1 << 6) -#define UIP_ABORT (1 << 7) -#define UIP_CONNECTED (1 << 8) -#define UIP_TIMEDOUT (1 << 9) -#define UIP_ECHOREPLY (1 << 10) - -#define UIP_CONN_EVENTS (UIP_CLOSE|UIP_ABORT|UIP_CONNECTED|UIP_TIMEDOUT) - -/* The buffer size available for user data in the d_buf buffer. - * - * This macro holds the available size for user data in the - * d_buf buffer. The macro is intended to be used for checking - * bounds of available user data. - * - * Example: - * - * snprintf(dev->d_appdata, UIP_APPDATA_SIZE, "%u\n", i); - */ - -#define UIP_APPDATA_SIZE (CONFIG_NET_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN) - -#define UIP_PROTO_ICMP 1 -#define UIP_PROTO_IGMP 2 -#define UIP_PROTO_TCP 6 -#define UIP_PROTO_UDP 17 -#define UIP_PROTO_ICMP6 58 - -/* Header sizes */ - -#ifdef CONFIG_NET_IPv6 -# define UIP_IPH_LEN 40 /* Size of IP header */ -#else -# define UIP_IPH_LEN 20 /* Size of IP header */ -#endif - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/* Representation of an IP address */ - -typedef in_addr_t uip_ip4addr_t; -typedef uint16_t uip_ip6addr_t[8]; - -#ifdef CONFIG_NET_IPv6 -typedef uip_ip6addr_t uip_ipaddr_t; -#else -typedef uip_ip4addr_t uip_ipaddr_t; -#endif - -/* The IP header */ - -struct uip_ip_hdr -{ -#ifdef CONFIG_NET_IPv6 - - /* IPv6 Ip header */ - - uint8_t vtc; /* Bits 0-3: version, bits 4-7: traffic class (MS) */ - uint8_t tcf; /* Bits 0-3: traffic class (LS), 4-bits: flow label (MS) */ - uint16_t flow; /* 16-bit flow label (LS) */ - uint8_t len[2]; /* 16-bit Payload length */ - uint8_t proto; /* 8-bit Next header (same as IPv4 protocol field) */ - uint8_t ttl; /* 8-bit Hop limit (like IPv4 TTL field) */ - uip_ip6addr_t srcipaddr; /* 128-bit Source address */ - uip_ip6addr_t destipaddr; /* 128-bit Destination address */ - -#else /* CONFIG_NET_IPv6 */ - - /* IPv4 IP header */ - - uint8_t vhl; /* 8-bit Version (4) and header length (5 or 6) */ - uint8_t tos; /* 8-bit Type of service (e.g., 6=TCP) */ - uint8_t len[2]; /* 16-bit Total length */ - uint8_t ipid[2]; /* 16-bit Identification */ - uint8_t ipoffset[2]; /* 16-bit IP flags + fragment offset */ - uint8_t ttl; /* 8-bit Time to Live */ - uint8_t proto; /* 8-bit Protocol */ - uint16_t ipchksum; /* 16-bit Header checksum */ - uint16_t srcipaddr[2]; /* 32-bit Source IP address */ - uint16_t destipaddr[2]; /* 32-bit Destination IP address */ - -#endif /* CONFIG_NET_IPv6 */ -}; - -/* Describes a uIP callback - * - * flink - Supports a singly linked list - * event - Provides the address of the callback function entry point. - * pvconn is a pointer to one of struct uip_conn or struct uip_udp_conn. - * priv - Holds a reference to application specific data that will - * provided - * flags - Set by the application to inform the uIP layer which flags - * are and are not handled by the callback. - */ - -struct uip_driver_s; /* Forward reference */ -struct uip_callback_s -{ - FAR struct uip_callback_s *flink; - uint16_t (*event)(struct uip_driver_s *dev, void *pvconn, void *pvpriv, uint16_t flags); - void *priv; - uint16_t flags; -}; - -/* Protocol-specific support */ - -#ifdef CONFIG_NET_TCP -# include -#endif -#ifdef CONFIG_NET_UDP -# include -#endif -#ifdef CONFIG_NET_ICMP -# include -#endif -#ifdef CONFIG_NET_IGMP -# include -#endif - -/* The structure holding the uIP statistics that are gathered if - * CONFIG_NET_STATISTICS is defined. - */ - -#ifdef CONFIG_NET_STATISTICS -struct uip_ip_stats_s -{ - uip_stats_t drop; /* Number of dropped packets at the IP layer */ - uip_stats_t recv; /* Number of received packets at the IP layer */ - uip_stats_t sent; /* Number of sent packets at the IP layer */ - uip_stats_t vhlerr; /* Number of packets dropped due to wrong - IP version or header length */ - uip_stats_t hblenerr; /* Number of packets dropped due to wrong - IP length, high byte */ - uip_stats_t lblenerr; /* Number of packets dropped due to wrong - IP length, low byte */ - uip_stats_t fragerr; /* Number of packets dropped since they - were IP fragments */ - uip_stats_t chkerr; /* Number of packets dropped due to IP - checksum errors */ - uip_stats_t protoerr; /* Number of packets dropped since they - were neither ICMP, UDP nor TCP */ -}; - -struct uip_stats -{ - struct uip_ip_stats_s ip; /* IP statistics */ - -#ifdef CONFIG_NET_ICMP - struct uip_icmp_stats_s icmp; /* ICMP statistics */ -#endif - -#ifdef CONFIG_NET_IGMP - struct uip_igmp_stats_s igmp; /* IGMP statistics */ -#endif - -#ifdef CONFIG_NET_TCP - struct uip_tcp_stats_s tcp; /* TCP statistics */ -#endif - -#ifdef CONFIG_NET_UDP - struct uip_udp_stats_s udp; /* UDP statistics */ -#endif -}; -#endif /* CONFIG_NET_STATISTICS */ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/* This is the structure in which the statistics are gathered. */ - -#ifdef CONFIG_NET_STATISTICS -extern struct uip_stats uip_stat; -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/* uIP initialization functions - * - * The uIP initialization functions are used for booting uIP. - * - * This function should be called at boot up to initilize the uIP - * TCP/IP stack. - */ - -extern void uip_initialize(void); - -/* This function may be used at boot time to set the initial ip_id.*/ - -extern void uip_setipid(uint16_t id); - -/* Critical section management. The NuttX configuration setting - * CONFIG_NET_NOINT indicates that uIP not called from the interrupt level. - * If CONFIG_NET_NOINTS is defined, then these will map to semaphore - * controls. Otherwise, it assumed that uIP will be called from interrupt - * level handling and these will map to interrupt enable/disable controls. - */ - -#ifdef CONFIG_NET_NOINTS - -/* Semaphore based locking for non-interrupt based logic. - * - * uip_lock_t -- Not used. Only for compatibility - * uip_lockinit() -- Initializes an underlying semaphore/mutex - * uip_lock() -- Takes the semaphore(). Implements a re-entrant mutex. - * uip_unlock() -- Gives the semaphore(). - * uip_lockedwait() -- Like pthread_cond_wait(); releases the semaphore - * momemtarily to wait on another semaphore() - */ - -typedef uint8_t uip_lock_t; /* Not really used */ - -extern void uip_lockinit(void); -extern uip_lock_t uip_lock(void); -extern void uip_unlock(uip_lock_t flags); -extern int uip_lockedwait(sem_t *sem); - -#else - -/* Enable/disable locking for interrupt based logic: - * - * uip_lock_t -- The processor specific representation of interrupt state. - * uip_lockinit() -- (Does not exist). - * uip_lock() -- Disables interrupts. - * uip_unlock() -- Conditionally restores interrupts. - * uip_lockedwait() -- Just wait for the semaphore. - */ - -# define uip_lock_t irqstate_t -# define uip_lockinit() -# define uip_lock() irqsave() -# define uip_unlock(f) irqrestore(f) -# define uip_lockedwait(s) sem_wait(s) - -#endif - -/* uIP application functions - * - * Functions used by an application running of top of uIP. This includes - * functions for opening and closing connections, sending and receiving - * data, etc. - */ - -/* Send data on the current connection. - * - * This function is used to send out a single segment of TCP - * data. Only applications that have been invoked by uIP for event - * processing can send data. - * - * The amount of data that actually is sent out after a call to this - * funcion is determined by the maximum amount of data TCP allows. uIP - * will automatically crop the data so that only the appropriate - * amount of data is sent. The function uip_mss() can be used to query - * uIP for the amount of data that actually will be sent. - * - * Note: This function does not guarantee that the sent data will - * arrive at the destination. If the data is lost in the network, the - * application will be invoked with the UIP_REXMIT flag set. The - * application will then have to resend the data using this function. - * - * data A pointer to the data which is to be sent. - * - * len The maximum amount of data bytes to be sent. - */ - -extern void uip_send(struct uip_driver_s *dev, const void *buf, int len); - -/* uIP convenience and converting functions. - * - * These functions can be used for converting between different data - * formats used by uIP. - * - * Construct an IP address from four bytes. - * - * This function constructs an IPv4 address in network byte order. - * - * addr A pointer to a uip_ipaddr_t variable that will be - * filled in with the IPv4 address. - * addr0 The first octet of the IPv4 address. - * addr1 The second octet of the IPv4 address. - * addr2 The third octet of the IPv4 address. - * addr3 The forth octet of the IPv4 address. - */ - -#define uip_ipaddr(addr, addr0, addr1, addr2, addr3) \ - do { \ - addr = HTONL((addr0) << 24 | (addr1) << 16 | (addr2) << 8 | (addr3)); \ - } while(0) - -/* Convert an IPv4 address of the form uint16_t[2] to an in_addr_t */ - -#ifdef CONFIG_ENDIAN_BIG -# define uip_ip4addr_conv(addr) (((in_addr_t)((uint16_t*)addr)[0] << 16) | (in_addr_t)((uint16_t*)addr)[1]) -#else -# define uip_ip4addr_conv(addr) (((in_addr_t)((uint16_t*)addr)[1] << 16) | (in_addr_t)((uint16_t*)addr)[0]) -#endif - -/* Extract individual bytes from a 32-bit IPv4 IP address that is in network byte order */ - -#ifdef CONFIG_ENDIAN_BIG - /* Big-endian byte order: 11223344 */ - -# define ip4_addr1(ipaddr) (((ipaddr) >> 24) & 0xff) -# define ip4_addr2(ipaddr) (((ipaddr) >> 16) & 0xff) -# define ip4_addr3(ipaddr) (((ipaddr) >> 8) & 0xff) -# define ip4_addr4(ipaddr) ((ipaddr) & 0xff) -#else - /* Little endian byte order: 44223311 */ - -# define ip4_addr1(ipaddr) ((ipaddr) & 0xff) -# define ip4_addr2(ipaddr) (((ipaddr) >> 8) & 0xff) -# define ip4_addr3(ipaddr) (((ipaddr) >> 16) & 0xff) -# define ip4_addr4(ipaddr) (((ipaddr) >> 24) & 0xff) -#endif - -/* Construct an IPv6 address from eight 16-bit words. - * - * This function constructs an IPv6 address. - */ - -#define uip_ip6addr(addr, addr0,addr1,addr2,addr3,addr4,addr5,addr6,addr7) \ - do { \ - ((uint16_t*)(addr))[0] = HTONS((addr0)); \ - ((uint16_t*)(addr))[1] = HTONS((addr1)); \ - ((uint16_t*)(addr))[2] = HTONS((addr2)); \ - ((uint16_t*)(addr))[3] = HTONS((addr3)); \ - ((uint16_t*)(addr))[4] = HTONS((addr4)); \ - ((uint16_t*)(addr))[5] = HTONS((addr5)); \ - ((uint16_t*)(addr))[6] = HTONS((addr6)); \ - ((uint16_t*)(addr))[7] = HTONS((addr7)); \ - } while(0) - -/* Copy an IP address to another IP address. - * - * Copies an IP address from one place to another. - * - * Example: - * - * uip_ipaddr_t ipaddr1, ipaddr2; - * - * uip_ipaddr(&ipaddr1, 192,16,1,2); - * uip_ipaddr_copy(&ipaddr2, &ipaddr1); - * - * dest The destination for the copy. - * src The source from where to copy. - */ - -#ifndef CONFIG_NET_IPv6 -# define uip_ipaddr_copy(dest, src) \ - do { \ - (dest) = (in_addr_t)(src); \ - } while(0) -# define uiphdr_ipaddr_copy(dest, src) \ - do { \ - ((uint16_t*)(dest))[0] = ((uint16_t*)(src))[0]; \ - ((uint16_t*)(dest))[1] = ((uint16_t*)(src))[1]; \ - } while(0) -#else /* !CONFIG_NET_IPv6 */ -# define uip_ipaddr_copy(dest, src) memcpy(&dest, &src, sizeof(uip_ip6addr_t)) -# define uiphdr_ipaddr_copy(dest, src) uip_ipaddr_copy(dest, src) -#endif /* !CONFIG_NET_IPv6 */ - -/* Compare two IP addresses - * - * Example: - * - * uip_ipaddr_t ipaddr1, ipaddr2; - * - * uip_ipaddr(&ipaddr1, 192,16,1,2); - * if(uip_ipaddr_cmp(ipaddr2, ipaddr1)) { - * printf("They are the same"); - * } - * - * addr1 The first IP address. - * addr2 The second IP address. - */ - -#ifndef CONFIG_NET_IPv6 -# define uip_ipaddr_cmp(addr1, addr2) (addr1 == addr2) -# define uiphdr_ipaddr_cmp(addr1, addr2) uip_ipaddr_cmp(uip_ip4addr_conv(addr1), uip_ip4addr_conv(addr2)) -#else /* !CONFIG_NET_IPv6 */ -# define uip_ipaddr_cmp(addr1, addr2) (memcmp(&addr1, &addr2, sizeof(uip_ip6addr_t)) == 0) -# define uiphdr_ipaddr_cmp(addr1, addr2) uip_ipaddr_cmp(addr, addr2) -#endif /* !CONFIG_NET_IPv6 */ - -/* Compare two IP addresses with netmasks - * - * Compares two IP addresses with netmasks. The masks are used to mask - * out the bits that are to be compared. - * - * Example: - * - * uip_ipaddr_t ipaddr1, ipaddr2, mask; - * - * uip_ipaddr(&mask, 255,255,255,0); - * uip_ipaddr(&ipaddr1, 192,16,1,2); - * uip_ipaddr(&ipaddr2, 192,16,1,3); - * if(uip_ipaddr_maskcmp(ipaddr1, ipaddr2, &mask)) - * { - * printf("They are the same"); - * } - * - * addr1 The first IP address. - * addr2 The second IP address. - * mask The netmask. - */ - -#ifndef CONFIG_NET_IPv6 -# define uip_ipaddr_maskcmp(addr1, addr2, mask) \ - (((in_addr_t)(addr1) & (in_addr_t)(mask)) == \ - ((in_addr_t)(addr2) & (in_addr_t)(mask))) -#else -extern bool uip_ipaddr_maskcmp(uip_ipaddr_t addr1, uip_ipaddr_t addr2, - uip_ipaddr_t mask); -#endif - -/* Mask out the network part of an IP address. - * - * Masks out the network part of an IP address, given the address and - * the netmask. - * - * Example: - * - * uip_ipaddr_t ipaddr1, ipaddr2, netmask; - * - * uip_ipaddr(&ipaddr1, 192,16,1,2); - * uip_ipaddr(&netmask, 255,255,255,0); - * uip_ipaddr_mask(&ipaddr2, &ipaddr1, &netmask); - * - * In the example above, the variable "ipaddr2" will contain the IP - * address 192.168.1.0. - * - * dest Where the result is to be placed. - * src The IP address. - * mask The netmask. - */ - -#define uip_ipaddr_mask(dest, src, mask) \ - do { \ - (in_addr_t)(dest) = (in_addr_t)(src) & (in_addr_t)(mask); \ - } while(0) - -#endif /* __INCLUDE_NUTTX_NET_UIP_UIP_H */ diff --git a/nuttx/include/nuttx/net/uip/uipopt.h b/nuttx/include/nuttx/net/uip/uipopt.h deleted file mode 100644 index 9797e0482..000000000 --- a/nuttx/include/nuttx/net/uip/uipopt.h +++ /dev/null @@ -1,330 +0,0 @@ -/**************************************************************************** - * include/nuttx/net/uip/uipopt.h - * Configuration options for uIP. - * - * This file is used for tweaking various configuration options for - * uIP. You should make a copy of this file into one of your project's - * directories instead of editing this example "uipopt.h" file that - * comes with the uIP distribution. - * - * uIP is configured using the per-project configuration file - * uipopt.h. This file contains all compile-time options for uIP and - * should be tweaked to match each specific project. The uIP - * distribution contains a documented example "uipopt.h" that can be - * copied and modified for each project. - * - * Note: Most of the configuration options in the uipopt.h should not - * be changed, but rather the per-project defconfig file. - * - * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * This logic was leveraged from uIP which also has a BSD-style license: - * - * Author: Adam Dunkels - * Copyright (c) 2001-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 __INCLUDE_NUTTX_NET_UIP_UIPOPT_H -#define __INCLUDE_NUTTX_NET_UIP_UIPOPT_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Public Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/* Layer 2 Configuration Options ********************************************/ - -/* The default data link layer for uIP is Ethernet. If CONFIG_NET_SLIP is - * defined in the NuttX header file, then SLIP will be supported. The basic - * differences between the SLIP and Ethernet configurations is that when SLIP - * is selected: - * - * - The link level header (that comes before the IP header) is omitted. - * - All MAC address processing is suppressed. - * - ARP is disabled. - * - * If CONFIG_NET_SLIP is not supported, then Ethernet will be used (there is - * no need to define anything special in the configuration file to use - * Ethernet -- it is the default). - * - * The "link level header" is the offset into the d_buf where the IP header - * can be found. For Ethernet, this should be set to 14. For SLIP, this - * should be set to 0. - */ - -#undef CONFIG_NET_ETHERNET -#undef CONFIG_NET_ARP - -#ifdef CONFIG_NET_SLIP -# ifdef CONFIG_NET_IPv6 -# error "SLIP is not implemented for IPv6" -# endif -# define UIP_LLH_LEN 0 -#else -# define CONFIG_NET_ETHERNET 1 -# define CONFIG_NET_ARP 1 -# define UIP_LLH_LEN 14 -#endif - -/* Layer 3/4 Configuration Options ******************************************/ - -/* IP configuration options */ - -/* The IP TTL (time to live) of IP packets sent by uIP. - * - * This should normally not be changed. - */ - -#define UIP_TTL 64 - -/* Turn on support for IP packet reassembly. - * - * uIP supports reassembly of fragmented IP packets. This features - * requires an additonal amount of RAM to hold the reassembly buffer - * and the reassembly code size is approximately 700 bytes. The - * reassembly buffer is of the same size as the d_buf buffer - * (configured by CONFIG_NET_BUFSIZE). - * - * Note: IP packet reassembly is not heavily tested. - */ - -#define UIP_REASSEMBLY 0 - -/* The maximum time an IP fragment should wait in the reassembly - * buffer before it is dropped. Units are deci-seconds, the range - * of the timer is 8-bits. - */ - -#define UIP_REASS_MAXAGE (20*10) /* 20 seconds */ - -/* Network drivers often receive packets with garbage at the end - * and are longer than the size of packet in the TCP header. The - * following "fudge" factor increases the size of the I/O buffering - * by a small amount to allocate slightly oversize packets. After - * receipt, the packet size will be chopped down to the size indicated - * in the TCP header. - */ - -#ifndef CONFIG_NET_GUARDSIZE -# define CONFIG_NET_GUARDSIZE 2 -#endif - -/* ICMP configuration options */ - -#if !defined(CONFIG_NET_ICMP) || defined(CONFIG_DISABLE_CLOCK) -# undef CONFIG_NET_ICMP_PING -#endif - -/* UDP configuration options */ - -/* The maximum amount of concurrent UDP connection, Default: 10 */ - -#ifndef CONFIG_NET_UDP_CONNS -# ifdef CONFIG_NET_UDP -# define CONFIG_NET_UDP_CONNS 10 -# else -# define CONFIG_NET_UDP_CONNS 0 -# endif -#endif - -/* The UDP maximum packet size. This is should not be to set to more - * than CONFIG_NET_BUFSIZE - UIP_LLH_LEN - UIP_IPUDPH_LEN. - */ - -#define UIP_UDP_MSS (CONFIG_NET_BUFSIZE - UIP_LLH_LEN - UIP_IPUDPH_LEN) - -/* TCP configuration options */ - -/* The maximum number of simultaneously open TCP connections. - * - * Since the TCP connections are statically allocated, turning this - * configuration knob down results in less RAM used. Each TCP - * connection requires approximatly 30 bytes of memory. - */ - -#ifndef CONFIG_NET_TCP_CONNS -# ifdef CONFIG_NET_TCP -# define CONFIG_NET_TCP_CONNS 10 -# else -# define CONFIG_NET_TCP_CONNS 0 -# endif -#endif - -/* The maximum number of simultaneously listening TCP ports. - * - * Each listening TCP port requires 2 bytes of memory. - */ - -#ifndef CONFIG_NET_MAX_LISTENPORTS -# define CONFIG_NET_MAX_LISTENPORTS 20 -#endif - -/* Define the maximum number of concurrently active UDP and TCP - * ports. This number must be greater than the number of open - * sockets in order to support multi-threaded read/write operations. - */ - -#ifndef CONFIG_NET_NACTIVESOCKETS -# define CONFIG_NET_NACTIVESOCKETS (CONFIG_NET_TCP_CONNS + CONFIG_NET_UDP_CONNS) -#endif - -/* The initial retransmission timeout counted in timer pulses. - * - * This should not be changed. - */ - -#define UIP_RTO 3 - -/* The maximum number of times a segment should be retransmitted - * before the connection should be aborted. - * - * This should not be changed. - */ - -#define UIP_MAXRTX 8 - -/* The maximum number of times a SYN segment should be retransmitted - * before a connection request should be deemed to have been - * unsuccessful. - * - * This should not need to be changed. - */ - -#define UIP_MAXSYNRTX 5 - -/* The TCP maximum segment size. This is should not be set to more - * than CONFIG_NET_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN. - */ - -#define UIP_TCP_MSS (CONFIG_NET_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN) - -/* The size of the advertised receiver's window. - * - * Should be set low (i.e., to the size of the d_buf buffer) is the - * application is slow to process incoming data, or high (32768 bytes) - * if the application processes data quickly. - */ - -#ifndef CONFIG_NET_RECEIVE_WINDOW -# define CONFIG_NET_RECEIVE_WINDOW UIP_TCP_MSS -#endif - -/* How long a connection should stay in the TIME_WAIT state. - * - * This configiration option has no real implication, and it should be - * left untouched. Units: half second. - */ - -#define UIP_TIME_WAIT_TIMEOUT (60*2) - -/* ARP configuration options */ - -/* The size of the ARP table. - * - * This option should be set to a larger value if this uIP node will - * have many connections from the local network. - */ - -#ifndef CONFIG_NET_ARPTAB_SIZE -# define CONFIG_NET_ARPTAB_SIZE 8 -#endif - -/* The maxium age of ARP table entries measured in 10ths of seconds. - * - * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD - * default). - */ - -#define UIP_ARP_MAXAGE 120 - -/* General configuration options */ - -/* The size of the uIP packet buffer. - * - * The uIP packet buffer should not be smaller than 60 bytes, and does - * not need to be larger than 1500 bytes. Lower size results in lower - * TCP throughput, larger size results in higher TCP throughput. - */ - -#ifndef CONFIG_NET_BUFSIZE -# define CONFIG_NET_BUFSIZE 400 -#endif - -/* Number of TCP read-ahead buffers (may be zero) */ - -#ifndef CONFIG_NET_NTCP_READAHEAD_BUFFERS -# define CONFIG_NET_NTCP_READAHEAD_BUFFERS 4 -#endif - -/* The size of the TCP read buffer size */ - -#ifndef CONFIG_NET_TCP_READAHEAD_BUFSIZE -# if CONFIG_NET_NTCP_READAHEAD_BUFFERS < 1 -# define CONFIG_NET_TCP_READAHEAD_BUFSIZE 0 -# else -# define CONFIG_NET_TCP_READAHEAD_BUFSIZE UIP_TCP_MSS -# endif -#endif - -/* Delay after receive to catch a following packet. No delay should be - * required if TCP/IP read-ahead buffering is enabled. - */ - -#ifndef CONFIG_NET_TCP_RECVDELAY -# if CONFIG_NET_NTCP_READAHEAD_BUFFERS > 0 -# define CONFIG_NET_TCP_RECVDELAY 0 -# else -# define CONFIG_NET_TCP_RECVDELAY 5 -# endif -#endif - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/* Statistics datatype - * - * This typedef defines the dataype used for keeping statistics in - * uIP. - */ - -typedef uint16_t uip_stats_t; - -#endif /* __INCLUDE_NUTTX_NET_UIP_UIPOPT_H */ diff --git a/nuttx/include/nuttx/nx/nx.h b/nuttx/include/nuttx/nx/nx.h deleted file mode 100644 index 153c34a3e..000000000 --- a/nuttx/include/nuttx/nx/nx.h +++ /dev/null @@ -1,904 +0,0 @@ -/**************************************************************************** - * include/nuttx/nx/nx.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 _INCLUDE_NUTTX_NX_NX_H -#define _INCLUDE_NUTTX_NX_NX_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/* Default server MQ name used by nx_run() macro */ - -#define NX_DEFAULT_SERVER_MQNAME "/dev/nxs" - -/* Mouse button bits */ - -#define NX_MOUSE_NOBUTTONS 0x00 -#define NX_MOUSE_LEFTBUTTON 0x01 -#define NX_MOUSE_CENTERBUTTON 0x02 -#define NX_MOUSE_RIGHTBUTTON 0x04 - -/**************************************************************************** - * Public Types - ****************************************************************************/ -/* Configuration ************************************************************/ - -#ifndef CONFIG_NX_NPLANES -# define CONFIG_NX_NPLANES 1 /* Max number of color planes supported */ -#endif - -/* Check if the underlying graphic device supports read operations */ - -#if !defined(CONFIG_NX_WRITEONLY) && defined(CONFIG_NX_LCDDRIVER) && defined(CONFIG_LCD_NOGETRUN) -# define CONFIG_NX_WRITEONLY 1 -#endif - -/* Handles ******************************************************************/ - -/* The interface to the NX server is managed using a opaque handle: */ - -typedef FAR void *NXHANDLE; - -/* The interface to a specific window is managed using an opaque handle: */ - -typedef FAR void *NXWINDOW; - -/* NX server callbacks ******************************************************/ - -/* These define callbacks that must be provided to nx_openwindow. These - * callbacks will be invoked as part of the processing performed by - * nx_eventhandler() - */ - -struct nx_callback_s -{ - /************************************************************************** - * Name: redraw - * - * Descripton: - * NX requests that the client re-draw the portion of the window within - * with rectangle. - * - * Input Parameters: - * hwnd - Window handle - * rect - The rectangle that needs to be re-drawn (in window relative - * coordinates) - * more - true: More re-draw requests will follow - * arg - User provided argument (see nx_openwindow, nx_requestbkgd, - * nxtk_openwindow, or nxtk_opentoolbar) - * - * Returned Value: - * None - * - **************************************************************************/ - - void (*redraw)(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - bool more, FAR void *arg); - - /************************************************************************** - * Name: position - * - * Descripton: - * The size or position of the window has changed (or the window was - * just created with zero size. - * - * Input Parameters: - * hwnd - Window handle - * size - The size of the window - * pos - The position of the upper left hand corner of the window on - * the overall display - * bounds - The bounding rectangle that the describes the entire - * display - * arg - User provided argument (see nx_openwindow, nx_requestbkgd, - * nxtk_openwindow, or nxtk_opentoolbar) - * - * Returned Value: - * None - * - **************************************************************************/ - - void (*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); - - /************************************************************************** - * Name: mousein - * - * Descripton: - * New mouse data is available for the window. - * - * Input Parameters: - * hwnd - Window handle - * pos - The (x,y) position of the mouse - * buttons - See NX_MOUSE_* definitions - * arg - User provided argument (see nx_openwindow, nx_requestbkgd, - * nxtk_openwindow, or nxtk_opentoolbar) - * - * Returned Value: - * None - * - **************************************************************************/ - -#ifdef CONFIG_NX_MOUSE - void (*mousein)(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, - uint8_t buttons, FAR void *arg); -#endif - - /************************************************************************** - * Name: kbdin - * - * Descripton: - * New keyboard/keypad data is available for the window - * - * Input Parameters: - * hwnd - Window handle - * nch - The number of characters that are available in ch[] - * ch - The array of characters - * arg - User provided argument (see nx_openwindow, nx_requestbkgd, - * nxtk_openwindow, or nxtk_opentoolbar) - * - * Returned Value: - * None - * - **************************************************************************/ - -#ifdef CONFIG_NX_KBD - void (*kbdin)(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, FAR void *arg); -#endif - - /************************************************************************** - * Name: blocked - * - * Descripton: - * This callback is the response from nx_block (or nxtk_block). Those - * blocking interfaces are used to assure that no further messages are - * directed to the window. Receipt of the blocked callback signifies - * that (1) there are no further pending callbacks and (2) that the - * window is now 'defunct' and will receive no further callbacks. - * - * This callback supports coordinated destruction of a window in multi- - * user mode. In multi-use mode, the client window logic must stay - * intact until all of the queued callbacks are processed. Then the - * window may be safely closed. Closing the window prior with pending - * callbacks can lead to bad behavior when the callback is executed. - * - * Input Parameters: - * hwnd - Window handle of the blocked window - * arg1 - User provided argument (see nx_openwindow, nx_requestbkgd, - * nxtk_openwindow, or nxtk_opentoolbar) - * arg2 - User provided argument (see nx_block or nxtk_block) - * - * Returned Value: - * None - * - **************************************************************************/ - -#ifdef CONFIG_NX_MULTIUSER - void (*blocked)(NXWINDOW hwnd, FAR void *arg1, FAR void *arg2); -#endif -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nx_runinstance (and nx_run macro) - * - * Description: - * This is the server entry point. It does not return; the calling thread - * is dedicated to supporting NX server. - * - * NOTE that multiple instances of the NX server may run at the same time, - * with different callback and message queue names. nx_run() is simply - * a macro that can be used when only one server instance is required. In - * that case, a default server name is used. - * - * Multiple user mode only! - * - * Input Parameters: - * mqname - The name for the server incoming message queue - * dev - Vtable "object" of the framebuffer "driver" to use - * - * Return: - * This function usually does not return. If it does return, it will - * return ERROR and errno will be set appropriately. - * - ****************************************************************************/ - -#ifdef CONFIG_NX_MULTIUSER -EXTERN int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev); -# define nx_run(dev) nx_runinstance(NX_DEFAULT_SERVER_MQNAME, dev) -#endif - -/**************************************************************************** - * Name:nx_connectinstance (and nx_connect macro) - * - * Description: - * Open a connection from a client to the NX server. One one client - * connection is normally needed per thread as each connection can host - * multiple windows. - * - * NOTES: - * - This function returns before the connection is fully instantiated. - * it is necessary to wait for the connection event before using the - * returned handle. - * - Multiple instances of the NX server may run at the same time, - * each with different message queue names. - * - nx_connect() is simply a macro that can be used when only one - * server instance is required. In that case, a default server name - * is used. - * - * Multiple user mode only! - * - * Input Parameters: - * svrmqname - The name for the server incoming message queue - * - * Return: - * Success: A non-NULL handle used with subsequent NX accesses - * Failure: NULL is returned and errno is set appropriately - * - ****************************************************************************/ - -#ifdef CONFIG_NX_MULTIUSER -EXTERN NXHANDLE nx_connectinstance(FAR const char *svrmqname); -# define nx_connect(cb) nx_connectinstance(NX_DEFAULT_SERVER_MQNAME) -#endif - -/**************************************************************************** - * Name: nx_open - * - * Description: - * Create, initialize and return an NX handle for use in subsequent - * NX API calls. nx_open is the single user equivalent of nx_connect - * plus nx_run. - * - * Single user mode only! - * - * Input Parameters: - * dev - Vtable "object" of the framebuffer/LCD "driver" to use - * cb - Callbacks used to process received NX server messages - * - * Return: - * Success: A non-NULL handle used with subsequent NX accesses - * Failure: NULL is returned and errno is set appropriately - * - ****************************************************************************/ - -#ifndef CONFIG_NX_MULTIUSER -EXTERN NXHANDLE nx_open(FAR NX_DRIVERTYPE *dev); -#endif - -/**************************************************************************** - * Name: nx_disconnect - * - * Description: - * Disconnect a client from the NX server and/or free resources reserved - * by nx_connect/nx_connectinstance. nx_disconnect is muliti-user equivalent - * of nx_close. - * - * Multiple user mode only! - * - * Input Parameters: - * handle - the handle returned by nx_connect - * - * Return: - * None - * - ****************************************************************************/ - -#ifdef CONFIG_NX_MULTIUSER -EXTERN void nx_disconnect(NXHANDLE handle); -#endif - -/**************************************************************************** - * Name: nx_close - * - * Description: - * Close the single user NX interface. nx_close is single-user equivalent - * of nx_disconnect. - * - * Single user mode only! - * - * Input Parameters: - * handle - the handle returned by nx_open - * - * Return: - * None - * - ****************************************************************************/ - -#ifndef CONFIG_NX_MULTIUSER -EXTERN void nx_close(NXHANDLE handle); -#endif - -/**************************************************************************** - * Name: nx_eventhandler - * - * Description: - * The client code must call this function periodically to process - * incoming messages from the server. If CONFIG_NX_BLOCKING is defined, - * then this function not return until a server message is received. - * - * When CONFIG_NX_BLOCKING is not defined, the client must exercise - * caution in the looping to assure that it does not eat up all of - * the CPU bandwidth calling nx_eventhandler repeatedly. nx_eventnotify - * may be called to get a signal event whenever a new incoming server - * event is avaiable. - * - * Input Parameters: - * handle - the handle returned by nx_connect - * - * Return: - * OK: No errors occurred. If CONFIG_NX_BLOCKING is defined, then - * one or more server messages were processed. - * ERROR: An error occurred and errno has been set appropriately. Of - * particular interest, it will return errno == EHOSTDOWN when the - * server is disconnected. After that event, the handle can no - * longer be used. - * - ****************************************************************************/ - -#ifdef CONFIG_NX_MULTIUSER -EXTERN int nx_eventhandler(NXHANDLE handle); -#else -# define nx_eventhandler(handle) (OK) -#endif - -/**************************************************************************** - * Name: nx_eventnotify - * - * Description: - * Rather than calling nx_eventhandler periodically, the client may - * register to receive a signal when a server event is available. The - * client can then call nv_eventhandler() only when incoming events are - * available. - * - * Only one such event is issued. Upon receipt of the signal, if the client - * wishes further notifications, it must call nx_eventnotify again. - * - * Input Parameters: - * handle - the handle returned by nx_connect - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -#if defined(CONFIG_NX_MULTIUSER) && !defined(CONFIG_DISABLE_SIGNALS) -EXTERN int nx_eventnotify(NXHANDLE handle, int signo); -#else -# define nx_eventnotify(handle, signo) (OK) -#endif - -/**************************************************************************** - * Name: nx_openwindow - * - * Description: - * Create a new window. - * - * Input Parameters: - * handle - The handle returned by nx_connect or nx_open - * cb - Callbacks used to process window events - * arg - User provided value that will be returned with NX callbacks. - * - * Return: - * Success: A non-NULL handle used with subsequent NX accesses - * Failure: NULL is returned and errno is set appropriately - * - ****************************************************************************/ - -EXTERN NXWINDOW nx_openwindow(NXHANDLE handle, - FAR const struct nx_callback_s *cb, - FAR void *arg); - -/**************************************************************************** - * Name: nx_closewindow - * - * Description: - * Destroy a window created by nx_openwindow. - * - * Input Parameters: - * wnd - The window to be destroyed - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nx_closewindow(NXWINDOW hwnd); - -/**************************************************************************** - * Name: nx_block - * - * Description: - * This is callback will do to things: (1) any queue a 'blocked' callback - * to the window and then (2) block any further window messaging. - * - * The 'blocked' callback is the response from nx_block (or nxtk_block). - * Those blocking interfaces are used to assure that no further messages are - * are directed to the window. Receipt of the blocked callback signifies - * that (1) there are no further pending callbacks and (2) that the - * window is now 'defunct' and will receive no further callbacks. - * - * This callback supports coordinated destruction of a window in multi- - * user mode. In multi-use more, the client window logic must stay - * intact until all of the queued callbacks are processed. Then the - * window may be safely closed. Closing the window prior with pending - * callbacks can lead to bad behavior when the callback is executed. - * - * Multiple user mode only! - * - * Input Parameters: - * wnd - The window to be blocked - * arg - An argument that will accompany the block messages (This is arg2 - * in the blocked callback). - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -#ifdef CONFIG_NX_MULTIUSER -EXTERN int nx_block(NXWINDOW hwnd, FAR void *arg); -#endif - -/**************************************************************************** - * Name: nx_requestbkgd - * - * Description: - * NX normally controls a separate window called the background window. - * It repaints the window as necessary using only a solid color fill. The - * background window always represents the entire screen and is always - * below other windows. It is useful for an application to control the - * background window in the following conditions: - * - * - If you want to implement a windowless solution. The single screen - * can be used to creat a truly simple graphic environment. In this - * case, you should probably also de-select CONFIG_NX_MULTIUSER as well. - * - When you want more on the background than a solid color. For - * example, if you want an image in the background, or animations in the - * background, or live video, etc. - * - * This API only requests the handle of the background window. That - * handle will be returned asynchronously in a subsequent position and - * redraw callbacks. - * - * Cautions: - * - The following should never be called using the background window. - * They are guaranteed to cause severe crashes: - * - * nx_setposition, nx_setsize, nx_raise, nx_lower. - * - * - Neither nx_requestbkgd or nx_releasebkgd should be called more than - * once. Multiple instances of the background window are not supported. - * - * Input Parameters: - * handle - The handle returned by nx_connect - * cb - Callbacks to use for processing background window events - * arg - User provided value that will be returned with NX callbacks. - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nx_requestbkgd(NXHANDLE handle, - FAR const struct nx_callback_s *cb, - FAR void *arg); - -/**************************************************************************** - * Name: nx_releasebkgd - * - * Description: - * Release the background window previously acquired using nx_openbgwindow - * and return control of the background to NX. - * - * Input Parameters: - * hwnd - The handle returned (indirectly) by nx_requestbkgd - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nx_releasebkgd(NXWINDOW hwnd); - -/**************************************************************************** - * Name: nx_getposition - * - * Description: - * Request the position and size information for the selected window. The - * values will be return asynchronously through the client callback function - * pointer. - * - * Input Parameters: - * hwnd - The window handle - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nx_getposition(NXWINDOW hwnd); - -/**************************************************************************** - * Name: nx_setposition - * - * Description: - * Set the position and size for the selected window - * - * Input Parameters: - * hwnd - The window handle - * pos - The new position of the window - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nx_setposition(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos); - -/**************************************************************************** - * Name: nx_setsize - * - * Description: - * Set the size of the selected window - * - * Input Parameters: - * hwnd - The window handle - * size - The new size of the window. - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nx_setsize(NXWINDOW hwnd, FAR const struct nxgl_size_s *size); - -/**************************************************************************** - * Name: nx_raise - * - * Description: - * Bring the specified window to the top of the display. - * - * Input parameters: - * hwnd - the window to be raised - * - * Returned value: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nx_raise(NXWINDOW hwnd); - -/**************************************************************************** - * Name: nx_lower - * - * Description: - * Lower the specified window to the bottom of the display. - * - * Input parameters: - * hwnd - the window to be lowered - * - * Returned value: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nx_lower(NXWINDOW hwnd); - -/**************************************************************************** - * Name: nx_setpixel - * - * Description: - * Set a single pixel in the window to the specified color. This is simply - * a degenerate case of nx_fill(), but may be optimized in some architectures. - * - * Input Parameters: - * wnd - The window structure reference - * pos - The pixel location to be set - * col - The color to use in the set - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nx_setpixel(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); - -/**************************************************************************** - * Name: nx_fill - * - * Description: - * Fill the specified rectangle in the window with the specified color - * - * Input Parameters: - * hwnd - The window handle - * rect - The location to be filled - * color - The color to use in the fill - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nx_fill(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); - -/**************************************************************************** - * Name: nx_getrectangle - * - * Description: - * Get the raw contents of graphic memory within a rectangular region. NOTE: - * Since raw graphic memory is returned, the returned memory content may be - * the memory of windows above this one and may not necessarily belong to - * this window unless you assure that this is the top window. - * - * Input Parameters: - * wnd - The window structure reference - * rect - The location to be copied - * plane - Specifies the color plane to get from. - * dest - The location to copy the memory region - * deststride - The width, in bytes, the the dest memory - * - * Input Parameters: - * hwnd - The window handle - * rect - The location to be filled - * color - The color to use in the fill - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nx_getrectangle(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - unsigned int plane, FAR uint8_t *dest, - unsigned int deststride); - -/**************************************************************************** - * Name: nx_filltrapezoid - * - * Description: - * Fill the specified trapezoidal region in the window with the specified color - * - * Input Parameters: - * hwnd - The window handle - * clip - Clipping rectangle relative to window (may be null) - * trap - The trapezoidal region to be filled - * color - The color to use in the fill - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip, - FAR const struct nxgl_trapezoid_s *trap, - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); - -/**************************************************************************** - * Name: nx_drawline - * - * Description: - * Fill the specified line in the window with the specified color. This - * is simply a wrapper that uses nxgl_splitline() to break the line into - * trapezoids and then calls nx_filltrapezoid() to render the line. - * - * Input Parameters: - * hwnd - The window handle - * vector - Describes the line to be drawn - * width - The width of the line - * color - The color to use to fill the line - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector, - nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); - -/**************************************************************************** - * Name: nx_drawcircle - * - * Description: - * Draw a circular outline using the specified line thickness and color. - * - * Input Parameters: - * hwnd - The window handle - * center - A pointer to the point that is the center of the circle - * radius - The radius of the circle in pixels. - * width - The width of the line - * color - The color to use to fill the line - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center, - nxgl_coord_t radius, nxgl_coord_t width, - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); - -/**************************************************************************** - * Name: nx_fillcircle - * - * Description: - * Fill a circular region using the specified color. - * - * Input Parameters: - * hwnd - The window handle - * center - A pointer to the point that is the center of the circle - * radius - The radius of the circle in pixels. - * color - The color to use to fill the circle - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nx_fillcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center, - nxgl_coord_t radius, - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); - -/**************************************************************************** - * Name: nx_setbgcolor - * - * Description: - * Set the color of the background - * - * Input Parameters: - * handle - The connection handle - * color - The color to use in the background - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -int nx_setbgcolor(NXHANDLE handle, - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); - -/**************************************************************************** - * Name: nx_move - * - * Description: - * Move a rectangular region within the window - * - * Input Parameters: - * hwnd - The window within which the move is to be done - * rect - Describes the rectangular region to move - * offset - The offset to move the region. The rectangular region will be - * moved so that the origin is translated by this amount. - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nx_move(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - FAR const struct nxgl_point_s *offset); - -/**************************************************************************** - * Name: nx_bitmap - * - * Description: - * Copy a rectangular region of a larger image into the rectangle in the - * specified window. - * - * Input Parameters: - * hwnd - The window that will receive the bitmap image - * dest - Describes the rectangular region on the display that will - * receive the bit map. - * src - The start of the source image. This is an array source - * images of size CONFIG_NX_NPLANES. - * origin - The origin of the upper, left-most corner of the full bitmap. - * Both dest and origin are in window coordinates, however, origin - * may lie outside of the display. - * stride - The width of the full source image in bytes. - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nx_bitmap(NXWINDOW hwnd, FAR const struct nxgl_rect_s *dest, - FAR const void *src[CONFIG_NX_NPLANES], - FAR const struct nxgl_point_s *origin, - unsigned int stride); - -/**************************************************************************** - * Name: nx_kbdin - * - * Description: - * Used by a thread or interrupt handler that manages some kind of keypad - * hardware to report text information to the NX server. That text - * data will be routed by the NX server to the appropriate window client. - * - ****************************************************************************/ - -#ifdef CONFIG_NX_KBD -EXTERN int nx_kbdchin(NXHANDLE handle, uint8_t ch); -EXTERN int nx_kbdin(NXHANDLE handle, uint8_t nch, FAR const uint8_t *ch); -#endif - -/**************************************************************************** - * Name: nx_mousein - * - * Description: - * Used by a thread or interrupt handler that manages some kind of pointing - * hardware to report new positional data to the NX server. That positional - * data will be routed by the NX server to the appropriate window client. - * - ****************************************************************************/ - -#ifdef CONFIG_NX_MOUSE -EXTERN int nx_mousein(NXHANDLE handle, nxgl_coord_t x, nxgl_coord_t y, uint8_t buttons); -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* _INCLUDE_NUTTX_NX_NX_H */ - diff --git a/nuttx/include/nuttx/nx/nxconsole.h b/nuttx/include/nuttx/nx/nxconsole.h deleted file mode 100644 index 6ff719237..000000000 --- a/nuttx/include/nuttx/nx/nxconsole.h +++ /dev/null @@ -1,367 +0,0 @@ -/**************************************************************************** - * include/nuttx/nx/nxconsole.h - * - * Copyright (C) 2012 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_NUTTX_NX_NXCONSOLE_H -#define __INCLUDE_NUTTX_NX_NXCONSOLE_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -#ifdef CONFIG_NXCONSOLE - -/**************************************************************************** - * Pre-processor definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* Nx Console prerequistes */ - -#ifndef CONFIG_NX -# warning "NX is not enabled (CONFIG_NX) -#endif - -#ifndef CONFIG_NX_MULTIUSER -# warning "NX Console requires multi-user support (CONFIG_NX_MULTIUSER)" -#endif - -/* Nx Console configuration options: - * - * CONFIG_NXCONSOLE - * Enables building of the NxConsole driver. - * - * Output text/graphics options: - * - * CONFIG_NXCONSOLE_BPP - * Currently, NxConsole supports only a single pixel depth. This - * configuration setting must be provided to support that single pixel depth. - * Default: The smallest enabled pixel depth. (see CONFIG_NX_DISABLE_*BPP) - * CONFIG_NXCONSOLE_CURSORCHAR - * The bitmap code to use as the cursor. Default '_' - * CONFIG_NXCONSOLE_MXCHARS - * NxConsole needs to remember every character written to the console so - * that it can redraw the window. This setting determines the size of some - * internal memory allocations used to hold the character data. Default: 128. - * CONFIG_NXCONSOLE_CACHESIZE - * NxConsole supports caching of rendered fonts. This font caching is required - * for two reasons: (1) First, it improves text performance, but more - * importantly (2) it preserves the font memory. Since the NX server runs on - * a separate server thread, it requires that the rendered font memory persist - * until the server has a chance to render the font. (NOTE: There is still - * inherently a race condition in this!). Unfortunately, the font cache would - * be quite large if all fonts were saved. The CONFIG_NXCONSOLE_CACHESIZE setting - * will control the size of the font cache (in number of glyphs). Only that - * number of the most recently used glyphs will be retained. Default: 16. - * CONFIG_NXCONSOLE_LINESEPARATION - * This the space (in rows) between each row of test. Default: 0 - * CONFIG_NXCONSOLE_NOWRAP - * By default, lines will wrap when the test reaches the right hand side - * of the window. This setting can be defining to change this behavior so - * that the text is simply truncated until a new line is encountered. - * - * Input options: - * - * CONFIG_NXCONSOLE_NXKBDIN - * Take input from the NX keyboard input callback. By default, keyboard - * input is taken from stdin (/dev/console). If this option is set, then - * the interface nxcon_kbdin() is enabled. That interface may be driven - * by window callback functions so that keyboard input *only* goes to the - * top window. - * CONFIG_NXCONSOLE_KBDBUFSIZE - * If CONFIG_NXCONSOLE_NXKBDIN is enabled, then this value may be used to - * define the size of the per-window keyboard input buffer. Default: 16 - * CONFIG_NXCONSOLE_NPOLLWAITERS - * The number of threads that can be waiting for read data available. - * Default: 4 - */ - -/* Cursor character */ - -#ifndef CONFIG_NXCONSOLE_CURSORCHAR -# define CONFIG_NXCONSOLE_CURSORCHAR '_' -#endif - -/* The maximum number of characters that can be remembered */ - -#ifndef CONFIG_NXCONSOLE_MXCHARS -# define CONFIG_NXCONSOLE_MXCHARS 128 -#endif - -/* Font cache -- this is the number or pre-rendered font glyphs that can be - * remembered. - */ - -#ifndef CONFIG_NXCONSOLE_CACHESIZE -# define CONFIG_NXCONSOLE_CACHESIZE 16 -#endif - -/* Pixel depth */ - -#ifndef CONFIG_NXCONSOLE_BPP -# if !defined(CONFIG_NX_DISABLE_1BPP) -# define CONFIG_NXCONSOLE_BPP 1 -# elif !defined(CONFIG_NX_DISABLE_2BPP) -# define CONFIG_NXCONSOLE_BPP 2 -# elif !defined(CONFIG_NX_DISABLE_4BPP) -# define CONFIG_NXCONSOLE_BPP 4 -# elif !defined(CONFIG_NX_DISABLE_8BPP) -# define CONFIG_NXCONSOLE_BPP 8 -# elif !defined(CONFIG_NX_DISABLE_16BPP) -# define CONFIG_NXCONSOLE_BPP 16 -//#elif !defined(CONFIG_NX_DISABLE_24BPP) -//# define CONFIG_NXCONSOLE_BPP 24 -# elif !defined(CONFIG_NX_DISABLE_32BPP) -# define CONFIG_NXCONSOLE_BPP 32 -# else -# error "No pixel depth provided" -# endif -#endif - -/* Space (in rows) between lines */ - -#ifndef CONFIG_NXCONSOLE_LINESEPARATION -# define CONFIG_NXCONSOLE_LINESEPARATION 0 -#endif - -/* Input options */ - -#ifndef CONFIG_NX_KBD -# undef CONFIG_NXCONSOLE_NXKBDIN -#endif - -#ifdef CONFIG_NXCONSOLE_NXKBDIN - -# ifndef CONFIG_NXCONSOLE_KBDBUFSIZE -# define CONFIG_NXCONSOLE_KBDBUFSIZE 16 -# elif (CONFIG_NXCONSOLE_KBDBUFSIZE < 1) || (CONFIG_NXCONSOLE_KBDBUFSIZE > 255) -# error "CONFIG_NXCONSOLE_KBDBUFSIZE is out of range (1-255)" -# endif - -# ifndef CONFIG_NXCONSOLE_NPOLLWAITERS -# define CONFIG_NXCONSOLE_NPOLLWAITERS 4 -# endif - -#else -# undef CONFIG_NXCONSOLE_KBDBUFSIZE -# define CONFIG_NXCONSOLE_KBDBUFSIZE 0 -# define CONFIG_NXCONSOLE_NPOLLWAITERS 0 -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* This is the handle that can be used to access the consoles */ - -typedef FAR void *NXCONSOLE; - -/* This structure describes the window and font characteristics */ - -struct nxcon_window_s -{ - nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]; /* Window background color */ - nxgl_mxpixel_t fcolor[CONFIG_NX_NPLANES]; /* Font color */ - struct nxgl_size_s wsize; /* Window size */ - int fontid; /* The ID of the font to use */ -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -# define EXTERN extern "C" -extern "C" { -#else -# define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Name: nx_register - * - * Description: - * Register a console device on a raw NX window. The device will be - * registered at /dev/nxconN where N is the provided minor number. - * - * Input Parameters: - * hwnd - A handle that will be used to access the window. The window must - * persist and this handle must be valid for the life of the NX console. - * wndo - Describes the window and font to be used. The information in - * this structure is copied and the original need not persist after - * nxtool_register() returns. - * minor - The device minor number - * - * Return: - * A non-NULL handle is returned on success. - * - ****************************************************************************/ - -EXTERN NXCONSOLE nx_register(NXWINDOW hwnd, FAR struct nxcon_window_s *wndo, - int minor); - -/**************************************************************************** - * Name: nxtk_register - * - * Description: - * Register a console device on a framed NX window. The device will be - * registered at /dev/nxconN where N is the provided minor number. - * - * Input Parameters: - * hfwnd - A handle that will be used to access the window. The window must - * persist and this handle must be valid for the life of the NX console. - * wndo - Describes the window and font to be used. The information in - * this structure is copied and the original need not persist after - * nxtool_register() returns. - * minor - The device minor number - * - * Return: - * A non-NULL handle is returned on success. - * - ****************************************************************************/ - -EXTERN NXCONSOLE nxtk_register(NXTKWINDOW hfwnd, - FAR struct nxcon_window_s *wndo, int minor); - -/**************************************************************************** - * Name: nxtool_register - * - * Description: - * Register a console device on a toolbar of a framed NX window. The - * device will be registered at /dev/nxconN where N is the provided minor - * number. - * - * Input Parameters: - * hfwnd - A handle that will be used to access the toolbar. The toolbar - * must persist and this handle must be valid for the life of the NX - * console. - * wndo - Describes the window and font to be used. The information in - * this structure is copied and the original need not persist after - * nxtool_register() returns. - * minor - The device minor number - * - * Return: - * A non-NULL handle is returned on success. - * - ****************************************************************************/ - -EXTERN NXCONSOLE nxtool_register(NXTKWINDOW hfwnd, - FAR struct nxcon_window_s *wndo, int minor); - -/**************************************************************************** - * Name: nxcon_unregister - * - * Description: - * Un-register to NX console device. - * - * Input Parameters: - * handle - A handle previously returned by nx_register, nxtk_register, or - * nxtool_register. - * - * Returned Value: - * None - * - ****************************************************************************/ - -EXTERN void nxcon_unregister(NXCONSOLE handle); - -/**************************************************************************** - * Name: nxcon_redraw - * - * Description: - * Re-draw a portion of the NX console. This function should be called - * from the appropriate window callback logic. - * - * Input Parameters: - * handle - A handle previously returned by nx_register, nxtk_register, or - * nxtool_register. - * rect - The rectangle that needs to be re-drawn (in window relative - * coordinates) - * more - true: More re-draw requests will follow - * - * Returned Value: - * None - * - ****************************************************************************/ - -EXTERN void nxcon_redraw(NXCONSOLE handle, FAR const struct nxgl_rect_s *rect, - bool more); - -/**************************************************************************** - * Name: nxcon_kbdin - * - * Description: - * This function should be driven by the window kbdin callback function - * (see nx.h). When the NxConsole is the top window and keyboard input is - * received on the top window, that window callback should be directed to - * this function. This function will buffer the keyboard data and may - * it available to the NxConsole as stdin. - * - * If CONFIG_NXCONSOLE_NXKBDIN is not selected, then the NxConsole will - * receive its input from stdin (/dev/console). This works great but - * cannot be shared between different windows. Chaos will ensue if you - * try to support multiple NxConsole windows without CONFIG_NXCONSOLE_NXKBDIN - * - * Input Parameters: - * handle - A handle previously returned by nx_register, nxtk_register, or - * nxtool_register. - * buffer - The array of characters - * buflen - The number of characters that are available in buffer[] - * - * Returned Value: - * None - * - ****************************************************************************/ - -#ifdef CONFIG_NXCONSOLE_NXKBDIN -EXTERN void nxcon_kbdin(NXCONSOLE handle, FAR const uint8_t *buffer, - uint8_t buflen); -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* CONFIG_NXCONSOLE */ -#endif /* __INCLUDE_NUTTX_NX_NXCONSOLE_H */ diff --git a/nuttx/include/nuttx/nx/nxfonts.h b/nuttx/include/nuttx/nx/nxfonts.h deleted file mode 100644 index 91bce0036..000000000 --- a/nuttx/include/nuttx/nx/nxfonts.h +++ /dev/null @@ -1,386 +0,0 @@ -/**************************************************************************** - * include/nuttx/nx/nxfonts.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 __INCLUDE_NUTTX_NX_NXFONTS_H -#define __INCLUDE_NUTTX_NX_NXFONTS_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include - -#include -#include - -/**************************************************************************** - * Pre-processor definitions - ****************************************************************************/ -/* Select the default font. If no fonts are selected, then a compilation error - * is likely down the road. - */ - -/* Sans serif fonts */ - -#if defined(CONFIG_NXFONT_SANS23X27) /* The "legacy," tiny NuttX font */ -# define NXFONT_DEFAULT FONTID_SANS23X27 - -#elif defined(CONFIG_NXFONT_SANS17X22) -# define NXFONT_DEFAULT FONTID_SANS17X22 - -#elif defined(CONFIG_NXFONT_SANS20X26) -# define NXFONT_DEFAULT FONTID_SANS20X26 - -#elif defined(CONFIG_NXFONT_SANS22X29) -# define NXFONT_DEFAULT FONTID_SANS22X29 - -#elif defined(CONFIG_NXFONT_SANS28X37) -# define NXFONT_DEFAULT FONTID_SANS28X37 - -#elif defined(CONFIG_NXFONT_SANS39X48) -# define NXFONT_DEFAULT FONTID_SANS39X48 - -/* Sans serif bold fonts */ - -#elif defined(CONFIG_NXFONT_SANS17X23B) -# define NXFONT_DEFAULT FONTID_SANS17X23B - -#elif defined(CONFIG_NXFONT_SANS20X27B) -# define NXFONT_DEFAULT FONTID_SANS20X27B - -#elif defined(CONFIG_NXFONT_SANS22X29B) -# define NXFONT_DEFAULT FONTID_SANS22X29B - -#elif defined(CONFIG_NXFONT_SANS28X37B) -# define NXFONT_DEFAULT FONTID_SANS28X37B - -#elif defined(CONFIG_NXFONT_SANS40X49B) -# define NXFONT_DEFAULT FONTID_SANS40X49B - -/* Serif fonts */ - -#elif defined(CONFIG_NXFONT_SERIF22X29) -# define NXFONT_DEFAULT FONTID_SERIF22X29 - -#elif defined(CONFIG_NXFONT_SERIF29X37) -# define NXFONT_DEFAULT FONTID_SERIF29X37 - -#elif defined(CONFIG_NXFONT_SERIF38X48) -# define NXFONT_DEFAULT FONTID_SERIF38X48 - -/* Serif bold fonts */ - -#elif defined(CONFIG_NXFONT_SERIF22X28B) -# define NXFONT_DEFAULT FONTID_SERIF22X28B - -#elif defined(CONFIG_NXFONT_SERIF27X38B) -# define NXFONT_DEFAULT FONTID_SERIF27X38B - -#elif defined(CONFIG_NXFONT_SERIF38X49B) -# define NXFONT_DEFAULT FONTID_SERIF38X49B - -/* Mono-space fonts */ - -#elif defined(CONFIG_NXFONT_MONO5X8) -# define NXFONT_DEFAULT FONTID_MONO5X8 - -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* Font IDs */ - -enum nx_fontid_e -{ - FONTID_DEFAULT = 0 /* The default font */ - -/* Monospace fonts */ - -#ifdef CONFIG_NXFONT_MONO5X8 - , FONTID_MONO5X8 = 18 /* The 5x8 monospace font */ -#endif - -/* Sans Serif fonts */ - -#ifdef CONFIG_NXFONT_SANS17X22 - , FONTID_SANS17X22 = 14 /* The 17x22 sans serif font */ -#endif - -#ifdef CONFIG_NXFONT_SANS20X26 - , FONTID_SANS20X26 = 15 /* The 20x26 sans serif font */ -#endif - -#ifdef CONFIG_NXFONT_SANS23X27 - , FONTID_SANS23X27 = 1 /* The 23x27 sans serif font */ -#endif - -#ifdef CONFIG_NXFONT_SANS22X29 - , FONTID_SANS22X29 = 2 /* The 22x29 sans serif font */ -#endif - -#ifdef CONFIG_NXFONT_SANS28X37 - , FONTID_SANS28X37 = 3 /* The 28x37 sans serif font */ -#endif - -#ifdef CONFIG_NXFONT_SANS39X48 - , FONTID_SANS39X48 = 4 /* The 39x48 sans serif font */ -#endif - -/* Sans Serif bold fonts */ - -#ifdef CONFIG_NXFONT_SANS17X23B - , FONTID_SANS17X23B = 16 /* The 17x23 sans bold font */ -#endif - -#ifdef CONFIG_NXFONT_SANS20X27B - , FONTID_SANS20X27B = 17 /* The 20x27 sans bold font */ -#endif - -#ifdef CONFIG_NXFONT_SANS22X29B - , FONTID_SANS22X29B = 5 /* The 22x29 sans bold font */ -#endif - -#ifdef CONFIG_NXFONT_SANS28X37B - , FONTID_SANS28X37B = 6 /* The 28x37 sans bold font */ -#endif - -#ifdef CONFIG_NXFONT_SANS40X49B - , FONTID_SANS40X49B = 7 /* The 40x49 sans bold font */ -#endif - -/* Serif fonts */ - -#ifdef CONFIG_NXFONT_SERIF22X29 - , FONTID_SERIF22X29 = 8 /* The 22x29 serif font */ -#endif - -#ifdef CONFIG_NXFONT_SERIF29X37 - , FONTID_SERIF29X37 = 9 /* The 29x37 serif font */ -#endif - -#ifdef CONFIG_NXFONT_SERIF38X48 - , FONTID_SERIF38X48 = 10 /* The 38x48 serif font */ -#endif - -/* Serif bold fonts */ - -#ifdef CONFIG_NXFONT_SERIF22X28B - , FONTID_SERIF22X28B = 11 /* The 22x28 serif bold font */ -#endif - -#ifdef CONFIG_NXFONT_SERIF27X38B - , FONTID_SERIF27X38B = 12 /* The 27x38 serif bold font */ -#endif - -#ifdef CONFIG_NXFONT_SERIF38X49B - , FONTID_SERIF38X49B = 13 /* The 38x49 serif bold font */ -#endif -}; - -/* This structures provides the metrics for one glyph */ - -struct nx_fontmetric_s -{ - uint32_t stride : 3; /* Width of one font row in bytes */ - uint32_t width : 6; /* Width of the font in bits */ - uint32_t height : 6; /* Height of the font in rows */ - uint32_t xoffset : 6; /* Top, left-hand corner X-offset in pixels */ - uint32_t yoffset : 6; /* Top, left-hand corner y-offset in pixels */ - uint32_t unused : 5; -}; - -/* This structure binds the glyph metrics to the glyph bitmap */ - -struct nx_fontbitmap_s -{ - struct nx_fontmetric_s metric; /* Character metrics */ - FAR const uint8_t *bitmap; /* Pointer to the character bitmap */ -}; - -/* This structure describes one contiguous grouping of glyphs that - * can be described by an array starting with encoding 'first' and - * extending through (first + nchars - 1). - */ - -struct nx_fontset_s -{ - uint8_t first; /* First bitmap character code */ - uint8_t nchars; /* Number of bitmap character codes */ - FAR const struct nx_fontbitmap_s *bitmap; -}; - -/* This structure describes the overall metrics of the fontset */ - -struct nx_font_s -{ - uint8_t mxheight; /* Max height of one glyph in rows */ - uint8_t mxwidth; /* Max width of any glyph in pixels */ - uint8_t mxbits; /* Max number of bits per character code */ - uint8_t spwidth; /* The width of a space in pixels */ -}; - -/* Finally, this structure defines everything about the font set */ - -struct nx_fontpackage_s -{ - uint8_t id; /* The font ID */ - FAR const struct nx_font_s metrics; /* Font set metrics */ - FAR const struct nx_fontset_s font7; /* Fonts for 7-bit encoding */ -#if CONFIG_NXFONTS_CHARBITS >= 8 - FAR const struct nx_fontset_s font8; /* Fonts for 8-bit encoding */ -#endif -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -# define EXTERN extern "C" -extern "C" { -#else -# define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Name: nxf_getfonthandle - * - * Description: - * Given a numeric font ID, return a handle that may be subsequently be - * used to access the font data sets. - * - * Input Parameters: - * fontid: Identifies the font set to get - * - ****************************************************************************/ - -EXTERN NXHANDLE nxf_getfonthandle(enum nx_fontid_e fontid); - -/**************************************************************************** - * Name: nxf_getfontset - * - * Description: - * Return information about the current font set - * - * Input Parameters: - * handle: A font handle previously returned by nxf_getfonthandle() - * - ****************************************************************************/ - -EXTERN FAR const struct nx_font_s *nxf_getfontset(NXHANDLE handle); - -/**************************************************************************** - * Name: nxf_getbitmap - * - * Description: - * Return font bitmap information for the selected character encoding. - * - * Input Parameters: - * handle: A font handle previously returned by nxf_getfonthandle() - * ch: Character code whose bitmap is requested - * - * Returned Value: - * An instance of struct nx_fontbitmap_s describing the glyph. - * - ****************************************************************************/ - -EXTERN FAR const struct nx_fontbitmap_s * - nxf_getbitmap(NXHANDLE handle, uint16_t ch); - -/**************************************************************************** - * Name: nxf_convert_*bpp - * - * Description: - * Convert the 1BPP font to a new pixel depth - * - * Input Parameters: - * dest - The destination buffer provided by the caller. - * height - The max height of the returned char in rows - * width - The max width of the returned char in pixels - * stride - The width of the destination buffer in bytes - * bm - Describes the character glyph to convert - * color - The color to use for '1' bits in the font bitmap - * (0 bits are transparent) - * - * Returned Value: - * OK on Success, ERROR: on failure with errno set appropriately. - * (never fails) - * - ****************************************************************************/ - -EXTERN int nxf_convert_1bpp(FAR uint8_t *dest, uint16_t height, - uint16_t width, uint16_t stride, - FAR const struct nx_fontbitmap_s *bm, - nxgl_mxpixel_t color); -EXTERN int nxf_convert_2bpp(FAR uint8_t *dest, uint16_t height, - uint16_t width, uint16_t stride, - FAR const struct nx_fontbitmap_s *bm, - nxgl_mxpixel_t color); -EXTERN int nxf_convert_4bpp(FAR uint8_t *dest, uint16_t height, - uint16_t width, uint16_t stride, - FAR const struct nx_fontbitmap_s *bm, - nxgl_mxpixel_t color); -EXTERN int nxf_convert_8bpp(FAR uint8_t *dest, uint16_t height, - uint16_t width, uint16_t stride, - FAR const struct nx_fontbitmap_s *bm, - nxgl_mxpixel_t color); -EXTERN int nxf_convert_16bpp(FAR uint16_t *dest, uint16_t height, - uint16_t width, uint16_t stride, - FAR const struct nx_fontbitmap_s *bm, - nxgl_mxpixel_t color); -EXTERN int nxf_convert_24bpp(FAR uint32_t *dest, uint16_t height, - uint16_t width, uint16_t stride, - FAR const struct nx_fontbitmap_s *bm, - nxgl_mxpixel_t color); -EXTERN int nxf_convert_32bpp(FAR uint32_t *dest, uint16_t height, - uint16_t width, uint16_t stride, - FAR const struct nx_fontbitmap_s *bm, - nxgl_mxpixel_t color); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_NX_NXFONTS_H */ diff --git a/nuttx/include/nuttx/nx/nxglib.h b/nuttx/include/nuttx/nx/nxglib.h deleted file mode 100644 index 4dec40070..000000000 --- a/nuttx/include/nuttx/nx/nxglib.h +++ /dev/null @@ -1,738 +0,0 @@ -/**************************************************************************** - * include/nuttx/nx/nxglib.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 __INCLUDE_NUTTX_NX_NXGLIB_H -#define __INCLUDE_NUTTX_NX_NXGLIB_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include - -#ifdef CONFIG_NX_LCDDRIVER -# include -#else -# include -#endif - -/**************************************************************************** - * Pre-processor definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -#ifndef CONFIG_NX_NPLANES -# define CONFIG_NX_NPLANES 1 /* Max number of color planes supported */ -#endif - -/* Driver Selection *********************************************************/ -/* NX_DRIVERTYPE selects either the framebuffer or LCD driver; - * NX_PLANINFO_TYPE hides the difference in the framebuffer and LCD driver - * plane types. defines are used instead of a typedefs to avoid type - * mismatches. - */ - -#ifdef CONFIG_NX_LCDDRIVER -# define NX_DRIVERTYPE struct lcd_dev_s -# define NX_PLANEINFOTYPE struct lcd_planeinfo_s -#else -# define NX_DRIVERTYPE struct fb_vtable_s -# define NX_PLANEINFOTYPE struct fb_planeinfo_s -#endif - -/* NXGL Macros **************************************************************/ -/* Mnemonics for indices */ - -#define NX_TOP_NDX (0) -#define NX_LEFT_NDX (1) -#define NX_RIGHT_NDX (2) -#define NX_BOTTOM_NDX (3) - -/* Handy macros */ - -#define ngl_min(a,b) ((a) < (b) ? (a) : (b)) -#define ngl_max(a,b) ((a) > (b) ? (a) : (b)) -#define ngl_swap(a,b,t) do { t = a; a = b; b = t; } while (0) -#define ngl_clipl(a,mn) ((a) < (mn) ? (mn) : (a)) -#define ngl_clipr(a,mx) ((a) > (mx) ? (mx) : (a)) -#define ngl_clip(a,mx,mn) ((a) < (mn) ? (mn) : (a) > (mx) ? (mx) : (a)) - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* Pixels *******************************************************************/ - -/* The size of graphics solutions can be reduced by disabling support for - * specific resolutions. One thing we can do, for example, is to select - * the smallest common pixel representation: - */ - -#if !defined(CONFIG_NX_DISABLE_32BPP) || !defined(CONFIG_NX_DISABLE_24BPP) -typedef uint32_t nxgl_mxpixel_t; -#elif !defined(CONFIG_NX_DISABLE_16BPP) -typedef uint16_t nxgl_mxpixel_t; -#else -typedef uint8_t nxgl_mxpixel_t; -#endif - -/* Graphics structures ******************************************************/ - -/* A given coordinate is limited to the screen height an width. If either - * of those values exceed 32,767 pixels, then the following will have to need - * to change: - */ - -typedef int16_t nxgl_coord_t; - -/* Describes a point on the display */ - -struct nxgl_point_s -{ - nxgl_coord_t x; /* X position, range: 0 to screen width - 1 */ - nxgl_coord_t y; /* Y position, range: 0 to screen height - 1 */ -}; - -/* Describes the size of a rectangular region */ - -struct nxgl_size_s -{ - nxgl_coord_t w; /* Width in pixels */ - nxgl_coord_t h; /* Height in rows */ -}; - -/* Describes a positioned rectangle on the display */ - -struct nxgl_rect_s -{ - struct nxgl_point_s pt1; /* Upper, left-hand corner */ - struct nxgl_point_s pt2; /* Lower, right-hand corner */ -}; - -/* Describes a vector starting at pt1 and extending throug pt2 */ - -struct nxgl_vector_s -{ - struct nxgl_point_s pt1; /* Start position */ - struct nxgl_point_s pt2; /* End position */ -}; - -/* Describes a run, i.e., a horizontal line. Note that the start/end positions - * have fractional precision. This is necessary for good joining of trapezoids - * when a more complex shape is decomposed into trapezoids - */ - -struct nxgl_run_s -{ - b16_t x1; /* Left X position, range: 0 to x2 */ - b16_t x2; /* Right X position, range: x1 to screen width - 1 */ - nxgl_coord_t y; /* Top Y position, range: 0 to screen height - 1 */ -}; - -/* Describes a horizontal trapezoid on the display in terms the run at the - * top of the trapezoid and the run at the bottom - */ - -struct nxgl_trapezoid_s -{ - struct nxgl_run_s top; /* Top run */ - struct nxgl_run_s bot; /* bottom run */ -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -# define EXTERN extern "C" -extern "C" { -#else -# define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/* Color conversons *********************************************************/ - -/**************************************************************************** - * Name: nxgl_rgb2yuv - * - * Description: - * Convert 8-bit RGB triplet to 8-bit YUV triplet - * - ****************************************************************************/ - -EXTERN void nxgl_rgb2yuv(uint8_t r, uint8_t g, uint8_t b, - uint8_t *y, uint8_t *u, uint8_t *v); - -/**************************************************************************** - * Name: nxgl_yuv2rgb - * - * Description: - * Convert 8-bit RGB triplet to 8-bit YUV triplet - * - ****************************************************************************/ - -EXTERN void nxgl_yuv2rgb(uint8_t y, uint8_t u, uint8_t v, - uint8_t *r, uint8_t *g, uint8_t *b); - -/* Rasterizers **************************************************************/ - -/**************************************************************************** - * Name: nxgl_setpixel_*bpp - * - * Descripton: - * Draw a single pixel in graphics memory at the given position and - * with the given color. This is equivalent to nxgl_fillrectangle_*bpp() - * with a 1x1 rectangle but is more efficient. - * - ****************************************************************************/ - -EXTERN void nxgl_setpixel_1bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_point_s *pos, - uint8_t color); -EXTERN void nxgl_setpixel_2bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_point_s *pos, - uint8_t color); -EXTERN void nxgl_setpixel_4bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_point_s *pos, - uint8_t color); -EXTERN void nxgl_setpixel_8bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_point_s *pos, - uint8_t color); -EXTERN void nxgl_setpixel_16bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_point_s *pos, - uint16_t color); -EXTERN void nxgl_setpixel_24bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_point_s *pos, - uint32_t color); -EXTERN void nxgl_setpixel_32bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_point_s *pos, - uint32_t color); - -/**************************************************************************** - * Name: nxgl_fillrectangle_*bpp - * - * Descripton: - * Fill a rectangle region in the graphics memory with a fixed color - * - ****************************************************************************/ - -EXTERN void nxgl_fillrectangle_1bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - uint8_t color); -EXTERN void nxgl_fillrectangle_2bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - uint8_t color); -EXTERN void nxgl_fillrectangle_4bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - uint8_t color); -EXTERN void nxgl_fillrectangle_8bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - uint8_t color); -EXTERN void nxgl_fillrectangle_16bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - uint16_t color); -EXTERN void nxgl_fillrectangle_24bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - uint32_t color); -EXTERN void nxgl_fillrectangle_32bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - uint32_t color); - -/**************************************************************************** - * Name: nxgl_getrectangle_*bpp - * - * Descripton: - * Fetch a rectangular region from graphics memory. The source is - * expressed as a rectangle. - * - ****************************************************************************/ - -EXTERN void nxgl_getrectangle_1bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - FAR void *dest, unsigned int deststride); -EXTERN void nxgl_getrectangle_2bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - FAR void *dest, unsigned int deststride); -EXTERN void nxgl_getrectangle_4bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - FAR void *dest, unsigned int deststride); -EXTERN void nxgl_getrectangle_8bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - FAR void *dest, unsigned int deststride); -EXTERN void nxgl_getrectangle_16bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - FAR void *dest, unsigned int deststride); -EXTERN void nxgl_getrectangle_24bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - FAR void *dest, unsigned int deststride); -EXTERN void nxgl_getrectangle_32bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - FAR void *dest, unsigned int deststride); - -/**************************************************************************** - * Name: nxglib_filltrapezoid_*bpp - * - * Descripton: - * Fill a trapezoidal region in the graphics memory with a fixed color. - * Clip the trapezoid to lie within a boundng box. This is useful for - * drawing complex shapes that can be broken into a set of trapezoids. - * - ****************************************************************************/ - -EXTERN void nxgl_filltrapezoid_1bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_trapezoid_s *trap, - FAR const struct nxgl_rect_s *bounds, - uint8_t color); -EXTERN void nxgl_filltrapezoid_2bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_trapezoid_s *trap, - FAR const struct nxgl_rect_s *bounds, - uint8_t color); -EXTERN void nxgl_filltrapezoid_4bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_trapezoid_s *trap, - FAR const struct nxgl_rect_s *bounds, - uint8_t color); -EXTERN void nxgl_filltrapezoid_8bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_trapezoid_s *trap, - FAR const struct nxgl_rect_s *bounds, - uint8_t color); -EXTERN void nxgl_filltrapezoid_16bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_trapezoid_s *trap, - FAR const struct nxgl_rect_s *bounds, - uint16_t color); -EXTERN void nxgl_filltrapezoid_24bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_trapezoid_s *trap, - FAR const struct nxgl_rect_s *bounds, - uint32_t color); -EXTERN void nxgl_filltrapezoid_32bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_trapezoid_s *trap, - FAR const struct nxgl_rect_s *bounds, - uint32_t color); - -/**************************************************************************** - * Name: nxgl_moverectangle_*bpp - * - * Descripton: - * Move a rectangular region from location to another in the - * framebuffer/LCD memory. The source is expressed as a rectangle; the - * destination position is expressed as a point corresponding to the - * translation of the upper, left-hand corner. - * - ****************************************************************************/ - -EXTERN void nxgl_moverectangle_1bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - FAR struct nxgl_point_s *offset); -EXTERN void nxgl_moverectangle_2bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - FAR struct nxgl_point_s *offset); -EXTERN void nxgl_moverectangle_4bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - FAR struct nxgl_point_s *offset); -EXTERN void nxgl_moverectangle_8bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - FAR struct nxgl_point_s *offset); -EXTERN void nxgl_moverectangle_16bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - FAR struct nxgl_point_s *offset); -EXTERN void nxgl_moverectangle_24bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - FAR struct nxgl_point_s *offset); -EXTERN void nxgl_moverectangle_32bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *rect, - FAR struct nxgl_point_s *offset); - -/**************************************************************************** - * Name: nxgl_copyrectangle_*bpp - * - * Descripton: - * Copy a rectangular bitmap image into the specific position in the - * graphics memory. - * - ****************************************************************************/ - -EXTERN void nxgl_copyrectangle_1bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *dest, - FAR const void *src, - FAR const struct nxgl_point_s *origin, - unsigned int srcstride); -EXTERN void nxgl_copyrectangle_2bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *dest, - FAR const void *src, - FAR const struct nxgl_point_s *origin, - unsigned int srcstride); -EXTERN void nxgl_copyrectangle_4bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *dest, - FAR const void *src, - FAR const struct nxgl_point_s *origin, - unsigned int srcstride); -EXTERN void nxgl_copyrectangle_8bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *dest, - FAR const void *src, - FAR const struct nxgl_point_s *origin, - unsigned int srcstride); -EXTERN void nxgl_copyrectangle_16bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *dest, - FAR const void *src, - FAR const struct nxgl_point_s *origin, - unsigned int srcstride); -EXTERN void nxgl_copyrectangle_24bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *dest, - FAR const void *src, - FAR const struct nxgl_point_s *origin, - unsigned int srcstride); -EXTERN void nxgl_copyrectangle_32bpp(FAR NX_PLANEINFOTYPE *pinfo, - FAR const struct nxgl_rect_s *dest, - FAR const void *src, - FAR const struct nxgl_point_s *origin, - unsigned int srcstride); - -/**************************************************************************** - * Name: nxgl_rectcopy - * - * Description: - * This is essentially memcpy for rectangles. We don't do structure - * assignments because some compilers are not good at that. - * - ****************************************************************************/ - -EXTERN void nxgl_rectcopy(FAR struct nxgl_rect_s *dest, - FAR const struct nxgl_rect_s *src); - -/**************************************************************************** - * Name: nxgl_rectoffset - * - * Description: - * Offset the rectangle position by the specified dx, dy values. - * - ****************************************************************************/ - -EXTERN void nxgl_rectoffset(FAR struct nxgl_rect_s *dest, - FAR const struct nxgl_rect_s *src, - nxgl_coord_t dx, nxgl_coord_t dy); - -/**************************************************************************** - * Name: nxgl_vectoradd - * - * Description: - * Add two 2x1 vectors and save the result to a third. - * - ****************************************************************************/ - -EXTERN void nxgl_vectoradd(FAR struct nxgl_point_s *dest, - FAR const struct nxgl_point_s *v1, - FAR const struct nxgl_point_s *v2); - -/**************************************************************************** - * Name: nxgl_vectorsubtract - * - * Description: - * Add subtract vector v2 from vector v1 and return the result in vector dest - * - ****************************************************************************/ - -EXTERN void nxgl_vectsubtract(FAR struct nxgl_point_s *dest, - FAR const struct nxgl_point_s *v1, - FAR const struct nxgl_point_s *v2); - -/**************************************************************************** - * Name: nxgl_rectintersect - * - * Description: - * Return the rectangle representing the intersection of the two rectangles. - * - ****************************************************************************/ - -EXTERN void nxgl_rectintersect(FAR struct nxgl_rect_s *dest, - FAR const struct nxgl_rect_s *src1, - FAR const struct nxgl_rect_s *src2); - -/**************************************************************************** - * Name: nxgl_intersecting - * - * Description: - * Return true if the rectangles intersect. - * - ****************************************************************************/ - -EXTERN bool nxgl_intersecting(FAR const struct nxgl_rect_s *rect1, - FAR const struct nxgl_rect_s *rect2); - -/**************************************************************************** - * Name: nxgl_rectadd - * - * Description: - * Return the rectangle that contains exactly two other rectanges. - * - ****************************************************************************/ - -EXTERN void nxgl_rectadd(FAR struct nxgl_rect_s *dest, - FAR const struct nxgl_rect_s *src1, - FAR const struct nxgl_rect_s *src2); - -/**************************************************************************** - * Name: nxgl_rectunion - * - * Description: - * Given two rectanges, src1 and src2, return the larger rectangle that - * contains both, dest. - * - ****************************************************************************/ - -EXTERN void nxgl_rectunion(FAR struct nxgl_rect_s *dest, - FAR const struct nxgl_rect_s *src1, - FAR const struct nxgl_rect_s *src2); - -/**************************************************************************** - * Name: nxgl_nonintersecting - * - * Description: - * Return the regions of rectangle rect 1 that do not intersect with - * rect2. This will be four rectangles ,some of which may be - * degenerate (and can be picked off with nxgl_nullrect) - * - ****************************************************************************/ - -EXTERN void nxgl_nonintersecting(FAR struct nxgl_rect_s result[4], - FAR const struct nxgl_rect_s *rect1, - FAR const struct nxgl_rect_s *rect2); - -/**************************************************************************** - * Name: nxgl_rectoverlap - * - * Description: - * Return true if the two rectangles overlap - * - ****************************************************************************/ - -EXTERN bool nxgl_rectoverlap(FAR struct nxgl_rect_s *rect1, - FAR struct nxgl_rect_s *rect2); - -/**************************************************************************** - * Name: nxgl_rectinside - * - * Description: - * Return true if the point pt lies within rect. - * - ****************************************************************************/ - -EXTERN bool nxgl_rectinside(FAR const struct nxgl_rect_s *rect, - FAR const struct nxgl_point_s *pt); - -/**************************************************************************** - * Name: nxgl_rectsize - * - * Description: - * Return the size of the specified rectangle. - * - ****************************************************************************/ - -EXTERN void nxgl_rectsize(FAR struct nxgl_size_s *size, - FAR const struct nxgl_rect_s *rect); - -/**************************************************************************** - * Name: nxgl_nullrect - * - * Description: - * Return true if the area of the retangle is <= 0. - * - ****************************************************************************/ - -EXTERN bool nxgl_nullrect(FAR const struct nxgl_rect_s *rect); - -/**************************************************************************** - * Name: nxgl_runoffset - * - * Description: - * Offset the run position by the specified dx, dy values. - * - ****************************************************************************/ - -EXTERN void nxgl_runoffset(FAR struct nxgl_run_s *dest, - FAR const struct nxgl_run_s *src, - nxgl_coord_t dx, nxgl_coord_t dy); - -/**************************************************************************** - * Name: nxgl_runcopy - * - * Description: - * This is essentially memcpy for runs. We don't do structure assignments - * because some compilers are not good at that. - * - ****************************************************************************/ - -EXTERN void nxgl_runcopy(FAR struct nxgl_run_s *dest, - FAR const struct nxgl_run_s *src); - -/**************************************************************************** - * Name: nxgl_trapoffset - * - * Description: - * Offset the trapezoid position by the specified dx, dy values. - * - ****************************************************************************/ - -EXTERN void nxgl_trapoffset(FAR struct nxgl_trapezoid_s *dest, - FAR const struct nxgl_trapezoid_s *src, - nxgl_coord_t dx, nxgl_coord_t dy); - -/**************************************************************************** - * Name: nxgl_trapcopy - * - * Description: - * This is essentially memcpy for trapezoids. We don't do structure - * assignments because some compilers are not good at that. - * - ****************************************************************************/ - -EXTERN void nxgl_trapcopy(FAR struct nxgl_trapezoid_s *dest, - FAR const struct nxgl_trapezoid_s *src); - -/**************************************************************************** - * Name: nxgl_colorcopy - * - * Description: - * This is essentially memcpy for colors. This does very little for us - * other than hide all of the conditional compilation for planar colors - * in one place. - * - ****************************************************************************/ - -EXTERN void nxgl_colorcopy(nxgl_mxpixel_t dest[CONFIG_NX_NPLANES], - const nxgl_mxpixel_t src[CONFIG_NX_NPLANES]); - -/**************************************************************************** - * Name: nxgl_splitline - * - * Description: - * In the general case, a line with width can be represented as a - * parallelogram with a triangle at the top and bottom. Triangles and - * parallelograms are both degenerate versions of a trapeziod. This - * function breaks a wide line into triangles and trapezoids. This - * function also detects other degenerate cases: - * - * 1. If y1 == y2 then the line is horizontal and is better represented - * as a rectangle. - * 2. If x1 == x2 then the line is vertical and also better represented - * as a rectangle. - * 3. If the width of the line is 1, then there are no triangles at the - * top and bottome (this may also be the case if the width is narrow - * and the line is near vertical). - * 4. If the line is oriented is certain angles, it may consist only of - * the upper and lower triangles with no trapezoid in between. In - * this case, 3 trapezoids will be returned, but traps[1] will be - * degenerate. - * - * Input parameters: - * vector - A pointer to the vector described the line to be drawn. - * traps - A pointer to a array of trapezoids (size 3). - * rect - A pointer to a rectangle. - * - * Returned value: - * 0: Line successfully broken up into three trapezoids. Values in - * traps[0], traps[1], and traps[2] are valid. - * 1: Line successfully represented by one trapezoid. Value in traps[1] - * is valid. - * 2: Line successfully represented by one rectangle. Value in rect is - * valid - * <0: On errors, a negated errno value is returned. - * - ****************************************************************************/ - -EXTERN int nxgl_splitline(FAR struct nxgl_vector_s *vector, - FAR struct nxgl_trapezoid_s *traps, - FAR struct nxgl_rect_s *rect, - nxgl_coord_t linewidth); - -/**************************************************************************** - * Name: nxgl_circlepts - * - * Description: - * Given a description of a circle, return a set of 16 points on the - * circumference of the circle. These points may then be used by - * nx_drawcircle() or related APIs to draw a circle outline. - * - * Input parameters: - * center - A pointer to the point that is the center of the circle - * radius - The radius of the circle in pixels. - * circle - A pointer the first entry in an array of 16 points where the - * circle points will be returned. - * - * Returned value: - * None - * - ****************************************************************************/ - -EXTERN void nxgl_circlepts(FAR const struct nxgl_point_s *center, - nxgl_coord_t radius, - FAR struct nxgl_point_s *circle); - -/**************************************************************************** - * Name: nxgl_circletraps - * - * Description: - * Given a description of a a circle, return 8 trapezoids that can be - * used to fill the circle by nx_fillcircle() and other interfaces. - * - * Input parameters: - * center - A pointer to the point that is the center of the circle - * radius - The radius of the circle in pixels. - * circle - A pointer the first entry in an array of 8 trapezoids where - * the circle description will be returned. - * - * Returned value: - * None - * - ****************************************************************************/ - -EXTERN void nxgl_circletraps(FAR const struct nxgl_point_s *center, - nxgl_coord_t radius, - FAR struct nxgl_trapezoid_s *circle); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_NX_NXGLIB_H */ diff --git a/nuttx/include/nuttx/nx/nxtk.h b/nuttx/include/nuttx/nx/nxtk.h deleted file mode 100644 index 60080e47f..000000000 --- a/nuttx/include/nuttx/nx/nxtk.h +++ /dev/null @@ -1,713 +0,0 @@ -/**************************************************************************** - * include/nuttx/nx/nxtk.h - * - * Copyright (C) 2008-2012 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_NUTTX_NX_NXTK_H -#define __INCLUDE_NUTTX_NX_NXTK_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include - -/**************************************************************************** - * Pre-processor definitions - ****************************************************************************/ -/* Configuration ************************************************************/ - -#ifndef CONFIG_NXTK_BORDERWIDTH -# define CONFIG_NXTK_BORDERWIDTH 4 -#endif - -#ifndef CONFIG_NXTK_BORDERCOLOR1 -# if !defined(CONFIG_NX_DISABLE_32BPP) || !defined(CONFIG_NX_DISABLE_24BPP) -# define CONFIG_NXTK_BORDERCOLOR1 0x00a9a9a9 -# elif !defined(CONFIG_NX_DISABLE_16BPP) -# define CONFIG_NXTK_BORDERCOLOR1 0xad55 -# elif !defined(CONFIG_NX_DISABLE_4BPP) -# define CONFIG_NXTK_BORDERCOLOR1 6 -# else -# define CONFIG_NXTK_BORDERCOLOR1 'B' -# endif -#endif - -#ifndef CONFIG_NXTK_BORDERCOLOR2 -# if !defined(CONFIG_NX_DISABLE_32BPP) || !defined(CONFIG_NX_DISABLE_24BPP) -# define CONFIG_NXTK_BORDERCOLOR2 0x00696969 -# elif !defined(CONFIG_NX_DISABLE_16BPP) -# define CONFIG_NXTK_BORDERCOLOR2 0x6b4d -# elif !defined(CONFIG_NX_DISABLE_4BPP) -# define CONFIG_NXTK_BORDERCOLOR2 4 -# else -# define CONFIG_NXTK_BORDERCOLOR2 'b' -# endif -#endif - -#ifndef CONFIG_NXTK_BORDERCOLOR3 -# if !defined(CONFIG_NX_DISABLE_32BPP) || !defined(CONFIG_NX_DISABLE_24BPP) -# define CONFIG_NXTK_BORDERCOLOR3 0x00d9d9d9 -# elif !defined(CONFIG_NX_DISABLE_16BPP) -# define CONFIG_NXTK_BORDERCOLOR3 0xdedb -# elif !defined(CONFIG_NX_DISABLE_4BPP) -# define CONFIG_NXTK_BORDERCOLOR3 8 -# else -# define CONFIG_NXTK_BORDERCOLOR3 'S' -# endif -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* This is the handle that can be used to access the window data region */ - -typedef FAR void *NXTKWINDOW; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -# define EXTERN extern "C" -extern "C" { -#else -# define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Name: nxtk_openwindow - * - * Description: - * Create a new, framed window. - * - * Input Parameters: - * handle - The handle returned by nx_connect - * cb - Callbacks used to process window events - * arg - User provided value that will be returned with NXTK callbacks. - * - * Return: - * Success: A non-NULL handle used with subsequent NXTK window accesses - * Failure: NULL is returned and errno is set appropriately - * - ****************************************************************************/ - -EXTERN NXTKWINDOW nxtk_openwindow(NXHANDLE handle, - FAR const struct nx_callback_s *cb, - FAR void *arg); - -/**************************************************************************** - * Name: nxtk_closewindow - * - * Description: - * Close the window opened by nxtk_openwindow - * - * Input Parameters: - * hfwnd - The handle returned by nxtk_openwindow - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_closewindow(NXTKWINDOW hfwnd); - -/**************************************************************************** - * Name: nxtk_block - * - * Description: - * This is callback will do to things: (1) any queue a 'blocked' callback - * to the window and then (2) block any further window messaging. - * - * The 'blocked' callback is the response from nx_block (or nxtk_block). - * Those blocking interfaces are used to assure that no further messages are - * are directed to the window. Receipt of the blocked callback signifies - * that (1) there are no further pending callbacks and (2) that the - * window is now 'defunct' and will receive no further callbacks. - * - * This callback supports coordinated destruction of a window in multi- - * user mode. In multi-use mode, the client window logic must stay - * intact until all of the queued callbacks are processed. Then the - * window may be safely closed. Closing the window prior with pending - * callbacks can lead to bad behavior when the callback is executed. - * - * Multiple user mode only! - * - * Input Parameters: - * hfwnd - The window to be blocked - * arg - An argument that will accompany the block messages (This is arg2 - * in the blocked callback). - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -#ifdef CONFIG_NX_MULTIUSER -EXTERN int nxtk_block(NXTKWINDOW hfwnd, FAR void *arg); -#endif - -/**************************************************************************** - * Name: nxtk_getposition - * - * Description: - * Request the position and size information for the selected framed window. - * The size/position for the client window and toolbar will be returned - * asynchronously through the client callback function pointer. - * - * Input Parameters: - * hfwnd - The window handle returned by nxtk_openwindow. - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_getposition(NXTKWINDOW hfwnd); - -/**************************************************************************** - * Name: nxtk_setposition - * - * Description: - * Set the position for the selected client window. This position does not - * include the offsets for the borders nor for any toolbar. Those offsets - * will be added in to set the full window position. - * - * Input Parameters: - * hfwnd - The window handle returned by nxtk_openwindow - * pos - The new position of the client sub-window - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_setposition(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *pos); - -/**************************************************************************** - * Name: nxtk_setsize - * - * Description: - * Set the size for the selected client window. This size does not - * include the sizes of the borders nor for any toolbar. Those sizes - * will be added in to set the full window size. - * - * Input Parameters: - * hfwnd - The window handle returned by nxtk_openwindow - * size - The new size of the client sub-window. - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_setsize(NXTKWINDOW hfwnd, FAR const struct nxgl_size_s *size); - -/**************************************************************************** - * Name: nxtk_raise - * - * Description: - * Bring the window containing the specified client sub-window to the top - * of the display. - * - * Input parameters: - * hfwnd - the window to be raised. This must have been previously created - * by nxtk_openwindow(). - * - * Returned value: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_raise(NXTKWINDOW hfwnd); - -/**************************************************************************** - * Name: nxtk_lower - * - * Description: - * Lower the window containing the specified client sub-window to the - * bottom of the display. - * - * Input parameters: - * hfwnd - the window to be lowered. This must have been previously created - * by nxtk_openwindow(). - * - * Returned value: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_lower(NXTKWINDOW hfwnd); - -/**************************************************************************** - * Name: nxtk_fillwindow - * - * Description: - * Fill the specified rectangle in the client window with the specified color - * - * Input Parameters: - * hfwnd - The window handle returned by nxtk_openwindow - * rect - The location within the client window to be filled - * color - The color to use in the fill - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_fillwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect, - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); - -/**************************************************************************** - * Name: nxtk_getwindow - * - * Description: - * Get the raw contents of graphic memory within a rectangular region. NOTE: - * Since raw graphic memory is returned, the returned memory content may be - * the memory of windows above this one and may not necessarily belong to - * this window unless you assure that this is the top window. - * - * Input Parameters: - * wnd - The window structure reference - * rect - The location to be copied - * plane - Specifies the color plane to get from. - * dest - The location to copy the memory region - * deststride - The width, in bytes, the the dest memory - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_getwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect, - unsigned int plane, FAR uint8_t *dest, - unsigned int deststride); - -/**************************************************************************** - * Name: nxtk_filltrapwindow - * - * Description: - * Fill the specified trapezoid in the client window with the specified color - * - * Input Parameters: - * hfwnd - The window handle returned by nxtk_openwindow - * trap - The trapezoidal region to be filled - * color - The color to use in the fill - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_filltrapwindow(NXTKWINDOW hfwnd, - FAR const struct nxgl_trapezoid_s *trap, - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); - -/**************************************************************************** - * Name: nxtk_drawlinewindow - * - * Description: - * Fill the specified line in the window with the specified color. This - * is simply a wrapper that uses nxgl_splitline() to break the line into - * trapezoids and then calls nxtk_filltrapwindow() to render the line. - * - * Input Parameters: - * hfwnd - The window handle returned by nxtk_openwindow - * vector - Describes the line to be drawn - * width - The width of the line - * color - The color to use to fill the line - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_drawlinewindow(NXTKWINDOW hfwnd, - FAR struct nxgl_vector_s *vector, - nxgl_coord_t width, - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); - -/**************************************************************************** - * Name: nxtk_drawcirclewindow - * - * Description: - * Draw a circular outline using the specified line thickness and color. - * - * Input Parameters: - * hfwnd - The window handle returned by nxtk_openwindow() - * center - A pointer to the point that is the center of the circle - * radius - The radius of the circle in pixels. - * width - The width of the line - * color - The color to use to fill the line - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, - FAR const struct nxgl_point_s *center, - nxgl_coord_t radius, nxgl_coord_t width, - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); - -/**************************************************************************** - * Name: nxtk_fillcirclewindow - * - * Description: - * Fill a circular region using the specified color. - * - * Input Parameters: - * hfwnd - The window handle returned by nxtk_openwindow() - * center - A pointer to the point that is the center of the circle - * radius - The radius of the circle in pixels. - * color - The color to use to fill the circle - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_fillcirclewindow(NXWINDOW hfwnd, - FAR const struct nxgl_point_s *center, - nxgl_coord_t radius, - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); - -/**************************************************************************** - * Name: nxtk_movewindow - * - * Description: - * Move a rectangular region within the client sub-window of a framed window - * - * Input Parameters: - * hfwnd - The client sub-window within which the move is to be done. - * This must have been previously created by nxtk_openwindow(). - * rect - Describes the rectangular region relative to the client - * sub-window to move - * offset - The offset to move the region. The rectangular region will be - * moved so that the origin is translated by this amount. - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_movewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect, - FAR const struct nxgl_point_s *offset); - -/**************************************************************************** - * Name: nxtk_bitmapwindow - * - * Description: - * Copy a rectangular region of a larger image into the rectangle in the - * specified client sub-window. - * - * Input Parameters: - * hfwnd The client sub0window that will receive the bitmap image - * dest - Describes the rectangular region on in the client sub-window - * will receive the bit map. - * src - The start of the source image(s). This is an array source - * images of size CONFIG_NX_NPLANES. - * origin - The origin of the upper, left-most corner of the full bitmap. - * Both dest and origin are in sub-window coordinates, however, the - * origin may lie outside of the sub-window display. - * stride - The width of the full source image in pixels. - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_bitmapwindow(NXTKWINDOW hfwnd, - FAR const struct nxgl_rect_s *dest, - FAR const void **src, - FAR const struct nxgl_point_s *origin, - unsigned int stride); - -/**************************************************************************** - * Name: nxtk_opentoolbar - * - * Description: - * Create a tool bar at the top of the specified framed window - * - * Input Parameters: - * hfwnd - The handle returned by nxtk_openwindow - * height - The requested height of the toolbar in pixels - * cb - Callbacks used to process toolbar events - * arg - User provided value that will be returned with toolbar callbacks. - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_opentoolbar(NXTKWINDOW hfwnd, nxgl_coord_t height, - FAR const struct nx_callback_s *cb, - FAR void *arg); - -/**************************************************************************** - * Name: nxtk_closetoolbar - * - * Description: - * Remove the tool bar at the top of the specified framed window - * - * Input Parameters: - * hfwnd - The handle returned by nxtk_openwindow - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_closetoolbar(NXTKWINDOW hfwnd); - -/**************************************************************************** - * Name: nxtk_toolbarbounds - * - * Description: - * Return a bounding box that contains the toolbar in the coordinates of - * the containing, framed window. For example, the recturned origin - * (rect.pt1) is the offset toolbar in the framed window. - * - * NOTE: This function is unsafe in the case of the multi-user NX server - * where the width of the window may be being changed asynchronously! It - * may return the old size in this case. - * - * Input Parameters: - * hfwnd - The handle returned by nxtk_openwindow - * bounds - User provided location in which to return the bounding box. - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_toolbarbounds(NXTKWINDOW hfwnd, FAR struct nxgl_rect_s *bounds); - -/**************************************************************************** - * Name: nxtk_filltoolbar - * - * Description: - * Fill the specified rectangle in the toolbar sub-window with the specified color - * - * Input Parameters: - * hfwnd - The handle returned by nxtk_openwindow - * rect - The location within the toolbar window to be filled - * color - The color to use in the fill - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_filltoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect, - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); - -/**************************************************************************** - * Name: nxtk_gettoolbar - * - * Description: - * Get the raw contents of graphic memory within a rectangular region. NOTE: - * Since raw graphic memory is returned, the returned memory content may be - * the memory of windows above this one and may not necessarily belong to - * this window unless you assure that this is the top window. - * - * Input Parameters: - * wnd - The window structure reference - * rect - The location to be copied - * plane - Specifies the color plane to get from. - * dest - The location to copy the memory region - * deststride - The width, in bytes, the the dest memory - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_gettoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect, - unsigned int plane, FAR uint8_t *dest, - unsigned int deststride); - -/**************************************************************************** - * Name: nxtk_filltraptoolbar - * - * Description: - * Fill the specified trapezoid in the toolbar sub-window with the specified color - * - * Input Parameters: - * hfwnd - The handle returned by nxtk_openwindow - * trap - The trapezoidal region to be filled - * color - The color to use in the fill - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_filltraptoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_trapezoid_s *trap, - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); - -/**************************************************************************** - * Name: nxtk_drawlinetoolbar - * - * Description: - * Fill the specified line in the toolbar sub-window with the specified - * color. This is simply a wrapper that uses nxgl_splitline() to break the - * line into trapezoids and then calls nxtk_filltraptoolbar() to render the - * lines. - * - * Input Parameters: - * hfwnd - The window handle returned by nxtk_openwindow - * vector - Describes the line to be drawn - * width - The width of the line - * color - The color to use to fill the line - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd, - FAR struct nxgl_vector_s *vector, - nxgl_coord_t width, - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); - -/**************************************************************************** - * Name: nxtk_drawcircletoolbar - * - * Description: - * Draw a circular outline using the specified line thickness and color. - * - * Input Parameters: - * hfwnd - The window handle returned by nxtk_openwindow() - * center - A pointer to the point that is the center of the circle - * radius - The radius of the circle in pixels. - * width - The width of the line - * color - The color to use to fill the line - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, - FAR const struct nxgl_point_s *center, - nxgl_coord_t radius, nxgl_coord_t width, - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); - -/**************************************************************************** - * Name: nxtk_fillcircletoolbar - * - * Description: - * Fill a circular region using the specified color. - * - * Input Parameters: - * hfwnd - The window handle returned by nxtk_openwindow() - * center - A pointer to the point that is the center of the circle - * radius - The radius of the circle in pixels. - * color - The color to use to fill the circle - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_fillcircletoolbar(NXWINDOW hfwnd, - FAR const struct nxgl_point_s *center, - nxgl_coord_t radius, - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); - -/**************************************************************************** - * Name: nxtk_movetoolbar - * - * Description: - * Move a rectangular region within the toolbar sub-window of a framed window - * - * Input Parameters: - * hfwnd - The sub-window containing the toolbar within which the move is - * to be done. This must have been previously created by - * nxtk_openwindow(). - * rect - Describes the rectangular region relative to the toolbar - * sub-window to move - * offset - The offset to move the region. The rectangular region will be - * moved so that the origin is translated by this amount. - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_movetoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect, - FAR const struct nxgl_point_s *offset); - -/**************************************************************************** - * Name: nxtk_bitmaptoolbar - * - * Description: - * Copy a rectangular region of a larger image into the rectangle in the - * specified toolbar sub-window. - * - * Input Parameters: - * hfwnd - The sub-window twhose toolbar will receive the bitmap image - * dest - Describes the rectangular region on in the toolbar sub-window - * will receive the bit map. - * src - The start of the source image. - * origin - The origin of the upper, left-most corner of the full bitmap. - * Both dest and origin are in sub-window coordinates, however, the - * origin may lie outside of the sub-window display. - * stride - The width of the full source image in bytes. - * - * Return: - * OK on success; ERROR on failure with errno set appropriately - * - ****************************************************************************/ - -EXTERN int nxtk_bitmaptoolbar(NXTKWINDOW hfwnd, - FAR const struct nxgl_rect_s *dest, - FAR const void *src[CONFIG_NX_NPLANES], - FAR const struct nxgl_point_s *origin, - unsigned int stride); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_NX_NXTK_H */ diff --git a/nuttx/include/nuttx/page.h b/nuttx/include/nuttx/page.h deleted file mode 100644 index 2502e16ee..000000000 --- a/nuttx/include/nuttx/page.h +++ /dev/null @@ -1,467 +0,0 @@ -/**************************************************************************** - * include/nuttx/page.h - * This file defines interfaces used to support NuttX On-Demand Paging. - * - * 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 __INCLUDE_NUTTX_PAGE_H -#define __INCLUDE_NUTTX_PAGE_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#ifndef __ASSEMBLY__ -# include -# include -#endif - -#ifdef CONFIG_PAGING - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ -/* CONFIG_PAGING_PAGESIZE - The size of one managed page. This must be a - * value supported by the processor's memory management unit. The - * following may need to be extended to support additional page sizes at - * some point. - */ - -#if CONFIG_PAGING_PAGESIZE == 1024 -# define PAGESIZE 1024 -# define PAGESHIFT 10 -# define PAGEMASK 0x000003ff -#elif CONFIG_PAGING_PAGESIZE == 4096 -# define PAGESIZE 4096 -# define PAGESHIFT 12 -# define PAGEMASK 0x00000fff -#else -# error "Need extended definitions for CONFIG_PAGING_PAGESIZE" -#endif - -/* Alignment macros */ - -#define PG_ALIGNDOWN(addr) ((addr) & ~PAGEMASK) -#define PG_ALIGNUP(addr) (((addr) + PAGEMASK) & ~PAGEMASK) - -/* CONFIG_PAGING_NLOCKED - This is the number of locked pages in the memory - * map. The size of locked address region will then be given by - * PG_LOCKED_SIZE. These values applies to both physical and virtual memory - * regions. - */ - -#define PG_LOCKED_SIZE (CONFIG_PAGING_NLOCKED << PAGESHIFT) - -/* CONFIG_PAGING_LOCKED_P/VBASE - May be defined to determine the base - * address of the locked page regions (lowest in memory). If neither - * are defined, then this logic will be set the bases to CONFIG_DRAM_START - * and CONFIG_DRAM_VSTART (i.e., it assumes that the base address of the - * locked region is at the beginning of RAM). - * - * NOTE: In some architectures, it may be necessary to take some memory - * from the beginning of this region for vectors or for a page table. - * In such cases, either (1) CONFIG_PAGING_LOCKED_P/VBASE might take that - * into consideration to prevent overlapping the locked memory region - * and the system data at the beginning of SRAM, (2) you extend CONFIG_PAGING_NLOCKED - * include these pages at the beginning of memory and map let them be - * mapped read-only. - */ - -#if defined(CONFIG_PAGING_LOCKED_PBASE) && defined(CONFIG_PAGING_LOCKED_VBASE) -# define PG_LOCKED_PBASE CONFIG_PAGING_LOCKED_PBASE -# define PG_LOCKED_VBASE CONFIG_PAGING_LOCKED_VBASE -#else -# define PG_LOCKED_PBASE CONFIG_DRAM_START -# define PG_LOCKED_VBASE CONFIG_DRAM_VSTART -#endif - -#define PG_LOCKED_PEND (PG_LOCKED_PBASE + PG_LOCKED_SIZE) -#define PG_LOCKED_VEND (PG_LOCKED_VBASE + PG_LOCKED_SIZE) - -#if (PG_LOCKED_PBASE & PAGEMASK) != 0 || (PG_LOCKED_VBASE & PAGEMASK) != 0 -# error "Base address of the locked region is not page aligned" -#endif - -/* CONFIG_PAGING_NPPAGED - This is the number of physical pages available to - * support the paged text region. - * CONFIG_PAGING_NVPAGED - This actual size of the paged text region (in - * pages). This is also the number of virtual pages required to support - * the entire paged region. The on-demand paging feature is intended to - * support only the case where the virtual paged text area is much larger - * the available physical pages. Otherwise, why would you enable on-demand - * paging? - */ - -#if CONFIG_PAGING_NPPAGED >= CONFIG_PAGING_NVPAGED -# error "CONFIG_PAGING_NPPAGED must be less than CONFIG_PAGING_NVPAGED" -#endif - -/* The size of physical and virutal paged address regions will then be: */ - -#define PG_PAGED_PSIZE (CONFIG_PAGING_NPPAGED << PAGESHIFT) -#define PG_PAGED_VSIZE (CONFIG_PAGING_NVPAGED << PAGESHIFT) - -/* This positions the paging Read-Only text region. If the configuration - * did not override the default, the paged region will immediately follow - * the locked region. - */ - -#if defined(CONFIG_PAGING_LOCKED_PBASE) && defined(CONFIG_PAGING_LOCKED_VBASE) -# define PG_PAGED_PBASE CONFIG_PAGING_LOCKED_PBASE -# define PG_PAGED_VBASE CONFIG_PAGING_LOCKED_VBASE -#else -# define PG_PAGED_PBASE PG_LOCKED_PEND -# define PG_PAGED_VBASE PG_LOCKED_VEND -#endif - -#define PG_PAGED_PEND (PG_PAGED_PBASE + PG_PAGED_PSIZE) -#define PG_PAGED_VEND (PG_PAGED_VBASE + PG_PAGED_VSIZE) - -/* Size and description of the overall text section. The number of - * pages in the text section is the sum of the number of pages in - * both the locked and paged regions. The base of the text section - * is the base of the locked region. - */ - -#define PG_TEXT_NPPAGES (CONFIG_PAGING_NLOCKED + CONFIG_PAGING_NPPAGED) -#define PG_TEXT_NVPAGES (CONFIG_PAGING_NLOCKED + CONFIG_PAGING_NVPAGED) -#define PG_TEXT_PSIZE (PG_TEXT_NPPAGES << PAGESHIFT) -#define PG_TEXT_VSIZE (PG_TEXT_NVPAGES << PAGESHIFT) -#define PG_TEXT_PBASE PG_LOCKED_PBASE -#define PG_TEXT_VBASE PG_LOCKED_VBASE - -/* CONFIG_PAGING_NDATA - This is the number of data pages in the memory - * map. The data region will extend to the end of RAM unless overridden - * by a setting in the configuration file. - * - * NOTE: In some architectures, it may be necessary to take some memory - * from the end of RAM for page tables or other system usage. The - * configuration settings and linker directives must be cognizant of that: - * CONFIG_PAGING_NDATA should be defined to prevent the data region from - * extending all the way to the end of memory. - */ - -#define PG_RAM_PAGES (CONFIG_DRAM_SIZE >> PAGESHIFT) - -#ifdef CONFIG_PAGING_NDATA -# define PG_DATA_NPAGES CONFIG_PAGING_NDATA -#elif PG_RAM_PAGES > PG_TEXT_NPPAGES -# define PG_DATA_NPAGES (PG_RAM_PAGES - PG_TEXT_NPAGES) -#else -# error "Not enough memory for this page layout" -#endif - -#define PG_DATA_SIZE (PG_DATA_NPAGES << PAGESHIFT) - -/* This positions the Read/Write data region. If the configuration - * did not override the default, the paged region will immediately follow - * the paged region and will extend to the end of memory. - */ - -#if defined(CONFIG_PAGING_DATA_PBASE) && defined(CONFIG_PAGING_DATA_VBASE) -# define PG_DATA_PBASE CONFIG_PAGING_DATA_PBASE -# define PG_DATA_VBASE CONFIG_PAGING_DATA_VBASE -#else -# define PG_DATA_PBASE PG_LOCKED_PEND -# define PG_DATA_VBASE PG_LOCKED_VEND -#endif - -/* CONFIG_PAGING_DEFPRIO - The default, minimum priority of the page fill - * worker thread. The priority of the page fill work thread will be boosted - * boosted dynmically so that it matches the priority of the task on behalf - * of which it peforms the fill. This defines the minimum priority that - * will be used. Default: 50. - * CONFIG_PAGING_STACKSIZE - Defines the size of the allocated stack - * for the page fill worker thread. Default: 1024. - * CONFIG_PAGING_BLOCKINGFILL - The architecture specific up_fillpage() - * function may be blocking or non-blocking. If defined, this setting - * indicates that the up_fillpage() implementation will block until the - * transfer is completed. Default: Undefined (non-blocking). - * CONFIG_PAGING_WORKPERIOD - The page fill worker thread will wake periodically - * even if there is no mapping to do. This selection controls that wake-up - * period (in microseconds). This wake-up a failsafe that will handle any - * cases where a single is lost (that would really be a bug and shouldn't - * happen!) and also supports timeouts for case of non-blocking, asynchronous - * fills (see CONFIG_PAGING_TIMEOUT_TICKS). - * CONFIG_PAGING_TIMEOUT_TICKS - If defined, the implementation will monitor - * the (asynchronous) page fill logic. If the fill takes longer than this - * number if microseconds, then a fatal error will be declared. - * Default: No timeouts monitored. - */ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifndef __ASSEMBLY__ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Functions -- Provided by common paging logic to architecture- - * specific logic. - ****************************************************************************/ - -/**************************************************************************** - * Name: pg_miss - * - * Description: - * This function is called from architecture-specific memory segmentation - * fault handling logic. This function will perform the following - * operations: - * - * 1) Sanity checking. - * - ASSERT if the currently executing task is the page fill worker - * thread. The page fill worker thread is how the the page fault - * is resolved and all logic associated with the page fill worker - * must be "locked" and always present in memory. - * 2) Block the currently executing task. - * - Call up_block_task() to block the task at the head of the ready- - * to-run list. This should cause an interrupt level context switch - * to the next highest priority task. - * - The blocked task will be marked with state TSTATE_WAIT_PAGEFILL - * and will be retained in the g_waitingforfill prioritized task - * list. - * 3) Boost the page fill worker thread priority. - * - Check the priority of the task at the head of the g_waitingforfill - * list. If the priority of that task is higher than the current - * priority of the page fill worker thread, then boost the priority - * of the page fill worker thread to that priority. - * 4) Signal the page fill worker thread. - * - Is there a page fill pending? If not then signal the worker - * thread to start working on the queued page fill requests. - * - * Input Parameters: - * None - The head of the ready-to-run list is assumed to be task that - * caused the exception. - * - * Returned Value: - * None - Either this function function succeeds or an assertion occurs. - * - * Assumptions: - * - It is assumed that this function is called from the level of an - * exception handler and that all interrupts are disabled. - * - It is assumed that currently executing task (the one at the head of - * the ready-to-run list) is the one that cause the fault. This will - * always be true unless the page fault occurred in an interrupt handler. - * Interrupt handling logic must always be present and "locked" into - * memory. - * - The chip-specific page fault exception handler has already verified - * that the exception did not occur from interrupt/exception handling - * logic. - * - As mentioned above, the task causing the page fault must not be the - * page fill worker thread because that is the only way to complete the - * page fill. - * - * NOTES: - * 1. One way to accomplish this would be a two pass link phase: - * - In the first phase, create a partially linked objected containing - * all interrupt/exception handling logic, the page fill worker thread - * plus all parts of the IDLE thread (which must always be available - * for execution). - * - All of the .text and .rodata sections of this partial link should - * be collected into a single section. - * - The second link would link the partially linked object along with - * the remaining object to produce the final binary. The linker - * script should position the "special" section so that it lies - * in a reserved, "non-swappable" region. - * - ****************************************************************************/ - -EXTERN void pg_miss(void); - -/**************************************************************************** - * Public Functions -- Provided by architecture-specific logic to common - * paging logic. - ****************************************************************************/ - -/**************************************************************************** - * Name: up_checkmapping() - * - * Description: - * The function up_checkmapping() returns an indication if the page fill - * still needs to performed or not. In certain conditions, the page fault - * may occur on several threads and be queued multiple times. This function - * will prevent the same page from be filled multiple times. - * - * Input Parameters: - * tcb - A reference to the task control block of the task that we believe - * needs to have a page fill. Architecture-specific logic can - * retrieve page fault information from the architecture-specific - * context information in this TCB and can consult processor resources - * (page tables or TLBs or ???) to determine if the fill still needs - * to be performed or not. - * - * Returned Value: - * This function will return true if the mapping is in place and false - * if the mapping is still needed. Errors encountered should be - * interpreted as fatal. - * - * Assumptions: - * - This function is called from the normal tasking context (but with - * interrupts disabled). The implementation must take whatever actions - * are necessary to assure that the operation is safe within this - * context. - * - ****************************************************************************/ - -EXTERN bool up_checkmapping(FAR _TCB *tcb); - -/**************************************************************************** - * Name: up_allocpage() - * - * Description: - * This architecture-specific function will set aside page in memory and map - * the page to its correct virtual address. Architecture-specific context - * information saved within the TCB will provide the function with the - * information needed to identify the virtual miss address. - * - * This function will return the allocated physical page address in vpage. - * The size of the underlying physical page is determined by the - * configuration setting CONFIG_PAGING_PAGESIZE. - * - * NOTE 1: This function must always return a page allocation. If all - * available pages are in-use (the typical case), then this function will - * select a page in-use, un-map it, and make it available. - * - * NOTE 2: If an in-use page is un-mapped, it may be necessary to flush the - * instruction cache in some architectures. - * - * NOTE 3: Allocating and filling a page is a two step process. up_allocpage() - * allocates the page, and up_fillpage() fills it with data from some non- - * volatile storage device. This distinction is made because up_allocpage() - * can probably be implemented in board-independent logic whereas up_fillpage() - * probably must be implemented as board-specific logic. - * - * NOTE 4: The initial mapping of vpage should be read-able and write- - * able (but not cached). No special actions will be required of - * up_fillpage() in order to write into this allocated page. - * - * Input Parameters: - * tcb - A reference to the task control block of the task that needs to - * have a page fill. Architecture-specific logic can retrieve page - * fault information from the architecture-specific context - * information in this TCB to perform the mapping. - * - * Returned Value: - * This function will return zero (OK) if the allocation was successful. - * A negated errno value may be returned if an error occurs. All errors, - * however, are fatal. - * - * Assumptions: - * - This function is called from the normal tasking context (but with - * interrupts disabled). The implementation must take whatever actions - * are necessary to assure that the operation is safe within this - * context. - * - ****************************************************************************/ - -EXTERN int up_allocpage(FAR _TCB *tcb, FAR void **vpage); - -/**************************************************************************** - * Name: up_fillpage() - * - * Description: - * After a page is allocated and mapped by up_allocpage(), the actual - * filling of the page with data from the non-volatile, must be performed - * by a separate call to the architecture-specific function, up_fillpage(). - * This function is non-blocking, it will start an asynchronous page fill. - * The common paging logic will provide a callback function, pg_callback, - * that will be called when the page fill is finished (or an error occurs). - * This callback is assumed to occur from an interrupt level when the - * device driver completes the fill operation. - * - * NOTE 1: Allocating and filling a page is a two step process. up_allocpage() - * allocates the page, and up_fillpage() fills it with data from some non- - * volatile storage device. This distinction is made because up_allocpage() - * can probably be implemented in board-independent logic whereas up_fillpage() - * probably must be implemented as board-specific logic. - * - * NOTE 2: The initial mapping of vpage will be read-able, write-able, - * but non-cacheable. No special actions will be required of - * up_fillpage() in order to write into this allocated page. If the - * virtual address maps to a text region, however, this function should - * remap the region so that is is read/execute only. It should be made - * cache-able in any case. - * - * Input Parameters: - * tcb - A reference to the task control block of the task that needs to - * have a page fill. Architecture-specific logic can retrieve page - * fault information from the architecture-specific context - * information in this TCB to perform the fill. - * pg_callbck - The function to be called when the page fill is complete. - * - * Returned Value: - * This function will return zero (OK) if the page fill was successfully - * started (the result of the page fill is passed to the callback function - * as the result argument). A negated errno value may be returned if an - * error occurs. All errors, however, are fatal. - * - * NOTE: -EBUSY has a special meaning. It is used internally to mean that - * the callback function has not executed. Therefore, -EBUSY should - * never be provided in the result argument of pg_callback. - * - * Assumptions: - * - This function is called from the normal tasking context (but - * interrupts siabled). The implementation must take whatever actions - * are necessary to assure that the operation is safe within this context. - * - Upon return, the caller will sleep waiting for the page fill callback - * to occur. The callback function will perform the wakeup. - * - ****************************************************************************/ - -#ifdef CONFIG_PAGING_BLOCKINGFILL -EXTERN int up_fillpage(FAR _TCB *tcb, FAR void *vpage); -#else -typedef void (*up_pgcallback_t)(FAR _TCB *tcb, int result); -EXTERN int up_fillpage(FAR _TCB *tcb, FAR void *vpage, up_pgcallback_t pg_callback); -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __ASSEMBLY__ */ -#endif /* CONFIG_PAGING */ -#endif /* __INCLUDE_NUTTX_PAGE_H */ diff --git a/nuttx/include/nuttx/power/battery.h b/nuttx/include/nuttx/power/battery.h deleted file mode 100644 index 5c341789f..000000000 --- a/nuttx/include/nuttx/power/battery.h +++ /dev/null @@ -1,217 +0,0 @@ -/**************************************************************************** - * include/nuttx/power/battery.h - * NuttX Battery Interfaces - * - * Copyright (C) 2012 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_NUTTX_POWER_BATTERY_H -#define __INCLUDE_NUTTX_POWER_BATTERY_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#include -#include -#include - -#ifdef CONFIG_BATTERY - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* CONFIG_BATTERY - Upper half battery driver support - * - * Specific, lower-half drivers will have other configuration requirements - * such as: - * - * CONFIG_I2C - I2C support *may* be needed - * CONFIG_I2C_MAX1704X - The MAX1704x driver must be explictly selected. - */ - -/* IOCTL Commands ***********************************************************/ -/* The upper-half battery driver provides a character driver "wrapper" - * around the lower-half battery driver that does all of the real work. - * Since there is no real data transfer to/or from a battery, all of the - * driver interaction is through IOCTIL commands. The IOCTL commands - * supported by the upper-half driver simply provide calls into the the - * lower half as summarized below: - * - * BATIOC_STATE - Return the current state of the battery (see - * enum battery_status_e). - * Input value: A pointer to type int. - * BATIOC_ONLINE - Return 1 if the battery is online; 0 if offline. - * Input value: A pointer to type bool. - * BATIOC_VOLTAGE - Return the current battery voltage. The returned value - * is a fixed preceision number in units of volts. - * Input value: A pointer to type b16_t. - * BATIOC_CAPACITY - Return the current battery capacity or State of Charge - * (SoC). The returned value is a fixed precision percentage of the - * batteries full capacity. - * Input value: A pointer to type b16_t. - */ - -#define BATIOC_STATE _BATIOC(0x0001) -#define BATIOC_ONLINE _BATIOC(0x0002) -#define BATIOC_VOLTAGE _BATIOC(0x0003) -#define BATIOC_CAPACITY _BATIOC(0x0004) - -/**************************************************************************** - * Public Types - ****************************************************************************/ -/* Battery status */ - -enum battery_status_e -{ - BATTERY_UNKNOWN = 0, /* Battery state is not known */ - BATTERY_IDLE, /* Not full, not charging, not discharging */ - BATTERY_FULL, /* Full, not discharging */ - BATTERY_CHARGING, /* Not full, charging */ - BATTERY_DISCHARGING /* Probably not full, discharging */ -}; - - /* This structure defines the lower half battery interface */ - -struct battery_dev_s; -struct battery_operations_s -{ - /* Return the current battery state (see enum battery_status_e) */ - - int (*state)(struct battery_dev_s *dev, int *status); - - /* Return true if the batter is online */ - - int (*online)(struct battery_dev_s *dev, bool *status); - - /* Current battery voltage */ - - int (*voltage)(struct battery_dev_s *dev, b16_t *value); - - /* Battery capacity */ - - int (*capacity)(struct battery_dev_s *dev, b16_t *value); -}; - -/* This structure defines the battery driver state structure */ - -struct battery_dev_s -{ - /* Fields required by the upper-half driver */ - - FAR const struct battery_operations_s *ops; /* Battery operations */ - sem_t batsem; /* Enforce mutually exclusive access */ - - /* Data fields specific to the lower-half driver may follow */ -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifndef __ASSEMBLY__ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ -/**************************************************************************** - * Name: battery_register - * - * Description: - * Register a lower half battery driver with the common, upper-half - * battery driver. - * - * Input parameters: - * devpath - The location in the pseudo-filesystem to create the driver. - * Recommended standard is "/dev/bat0", "/dev/bat1", etc. - * dev - An instance of the battery state structure . - * - * Returned value: - * Zero on success or a negated errno value on failure. - * - ****************************************************************************/ - -EXTERN int battery_register(FAR const char *devpath, - FAR struct battery_dev_s *dev); - -/**************************************************************************** - * Name: max1704x_initialize - * - * Description: - * Initialize the MAX1704x battery driver and return an instance of the - * lower_half interface that may be used with battery_register(); - * - * This driver requires: - * - * CONFIG_BATTERY - Upper half battery driver support - * CONFIG_I2C - I2C support - * CONFIG_I2C_MAX1704X - And the driver must be explictly selected. - * CONFIG_I2C_MAX17040 or CONFIG_I2C_MAX17041 - The driver must know which - * chip is on the board in order to scale the voltage correctly. - * - * Input Parameters: - * i2c - An instance of the I2C interface to use to communicate with the MAX1704x - * addr - The I2C address of the MAX1704x (Better be 0x36). - * frequency - The I2C frequency - * - * Returned Value: - * A pointer to the intialized battery driver instance. A NULL pointer - * is returned on a failure to initialize the MAX1704x lower half. - * - ****************************************************************************/ - -#if defined(CONFIG_I2C) && defined(CONFIG_I2C_MAX1704X) -struct i2c_dev_s; /* Forward reference */ - -EXTERN FAR struct battery_dev_s * - max1704x_initialize(FAR struct i2c_dev_s *i2c, uint8_t addr, uint32_t frequency); -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __ASSEMBLY__ */ -#endif /* CONFIG_BATTERY */ -#endif /* __INCLUDE_NUTTX_POWER_BATTERY_H */ diff --git a/nuttx/include/nuttx/power/pm.h b/nuttx/include/nuttx/power/pm.h deleted file mode 100644 index 9c0568b2d..000000000 --- a/nuttx/include/nuttx/power/pm.h +++ /dev/null @@ -1,486 +0,0 @@ -/**************************************************************************** - * include/nuttx/power/pm.h - * NuttX Power Management Interfaces - * - * Copyright (C) 2011-2012 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. - * - ****************************************************************************/ -/* Definition of terms. Various "sleep" and low power consumption states - * have various names and are sometimes used in conflicting ways. In the - * PM logic, we will use the following terminology: - * - * NORMAL - The normal, full power operating mode. - * IDLE - This is still basically normal operational mode, the system is, - * however, IDLE and some simple simple steps to reduce power - * consumption provided that they do not interfere with normal - * Operation. Simply dimming the a backlight might be an example - * somethat that would be done when the system is idle. - * STANDBY - Standby is a lower power consumption mode that may involve more - * extensive power management steps such has disabling clocking or - * setting the processor into reduced power consumption modes. In - * this state, the system should still be able to resume normal - * activity almost immediately. - * SLEEP - The lowest power consumption mode. The most drastic power - * reduction measures possible should be taken in this state. It - * may require some time to get back to normal operation from - * SLEEP (some MCUs may even require going through reset). - * - * State changes always proceed from higher to lower power usage: - * - * NORMAL->IDLE->STANDBY->SLEEP - * ^ | | | - * | V V V - * +-------+------+--------+ - */ - -#ifndef __INCLUDE_NUTTX_POWER_PM_H -#define __INCLUDE_NUTTX_POWER_PM_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include - -#ifdef CONFIG_PM - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* CONFIG_IDLE_CUSTOM. Some architectures support this definition. This, - * if defined, will allow you replace the default IDLE loop with your - * own, custom idle loop to support board-specific IDLE time power management - */ - -/* Time slices. The power management module collects activity counts in - * time slices. At the end of the time slice, the count accumulated during - * that interval is applied to an averaging algorithm to determine the - * activity level. - * - * CONFIG_PM_SLICEMS provides the duration of that time slice. Default: 100 - * Milliseconds - */ - -#ifndef CONFIG_PM_SLICEMS -# define CONFIG_PM_SLICEMS 100 /* Default is 100 msec */ -#endif - -/* The averaging algorithm is simply: Y = (An*X + SUM(Ai*Yi))/SUM(Aj), where - * i = 1..n-1 and j= 1..n, n is the length of the "memory", Ai is the - * weight applied to each value, and X is the current activity. These weights - * may be negative and a limited to the range of int16_t. - * - * CONFIG_PM_MEMORY provides the memory for the algorithm. Default: 2 - * CONFIG_PM_COEFn provides weight for each sample. Default: 1 - * - * Setting CONFIG_PM_MEMORY=1 disables all smoothing. - */ - -#ifndef CONFIG_PM_MEMORY -# define CONFIG_PM_MEMORY 2 -#endif - -#ifndef CONFIG_PM_MEMORY < 1 -# error "CONFIG_PM_MEMORY must be >= 1" -#endif - -#ifndef CONFIG_PM_COEFN -# define CONFIG_PM_COEFN 1 -#endif - -#if CONFIG_PM_MEMORY > 1 && !defined(CONFIG_PM_COEF1) -# define CONFIG_PM_COEF1 1 -#endif - -#if CONFIG_PM_MEMORY > 2 && !defined(CONFIG_PM_COEF2) -# define CONFIG_PM_COEF2 1 -#endif - -#if CONFIG_PM_MEMORY > 3 && !defined(CONFIG_PM_COEF3) -# define CONFIG_PM_COEF3 1 -#endif - -#if CONFIG_PM_MEMORY > 4 && !defined(CONFIG_PM_COEF4) -# define CONFIG_PM_COEF4 1 -#endif - -#if CONFIG_PM_MEMORY > 5 && !defined(CONFIG_PM_COEF5) -# define CONFIG_PM_COEF5 1 -#endif - -#if CONFIG_PM_MEMORY > 6 -# warning "This logic needs to be extended" -#endif - -/* State changes then occur when the weight activity account crosses - * threshold values for certain periods of time (time slice count). - * - * CONFIG_PM_xxxENTER_THRESH is the threshold value for entering state xxx. - * CONFIG_PM_xxxENTER_COUNT is the count for entering state xxx. - * - * Resuming to normal state, on the other hand, is usually immediate and - * controlled by wakeup conditions established by the platform. The PM - * module only recommends reduced power states. - */ - -#ifndef CONFIG_PM_IDLEENTER_THRESH -# define CONFIG_PM_IDLEENTER_THRESH 1 /* <=1: Essentially no activity */ -#endif - -#ifndef CONFIG_PM_IDLEEXIT_THRESH -# define CONFIG_PM_IDLEEXIT_THRESH 2 /* >=2: Active */ -#endif - -#if CONFIG_PM_IDLEENTER_THRESH >= CONFIG_PM_IDLEEXIT_THRESH -# error "Must have CONFIG_PM_IDLEENTER_THRESH < CONFIG_PM_IDLEEXIT_THRESH" -#endif - -#ifndef CONFIG_PM_IDLEENTER_COUNT -# define CONFIG_PM_IDLEENTER_COUNT 30 /* Thirty IDLE slices to enter - * IDLE mode from normal - */ -#endif - -#ifndef CONFIG_PM_STANDBYENTER_THRESH -# define CONFIG_PM_STANDBYENTER_THRESH 1 /* <=1: Essentially no activity */ -#endif - -#ifndef CONFIG_PM_STANDBYEXIT_THRESH -# define CONFIG_PM_STANDBYEXIT_THRESH 2 /* >=2: Active */ -#endif - -#if CONFIG_PM_STANDBYENTER_THRESH >= CONFIG_PM_STANDBYEXIT_THRESH -# error "Must have CONFIG_PM_STANDBYENTER_THRESH < CONFIG_PM_STANDBYEXIT_THRESH" -#endif - -#ifndef CONFIG_PM_STANDBYENTER_COUNT -# define CONFIG_PM_STANDBYENTER_COUNT 50 /* Fifty IDLE slices to enter - * STANDBY mode from IDLE - */ -#endif - -#ifndef CONFIG_PM_SLEEPENTER_THRESH -# define CONFIG_PM_SLEEPENTER_THRESH 1 /* <=1: Essentially no activity */ -#endif - -#ifndef CONFIG_PM_SLEEPEXIT_THRESH -# define CONFIG_PM_SLEEPEXIT_THRESH 2 /* >=2: Active */ -#endif - -#if CONFIG_PM_SLEEPENTER_THRESH >= CONFIG_PM_SLEEPEXIT_THRESH -# error "Must have CONFIG_PM_SLEEPENTER_THRESH < CONFIG_PM_SLEEPEXIT_THRESH" -#endif - -#ifndef CONFIG_PM_SLEEPENTER_COUNT -# define CONFIG_PM_SLEEPENTER_COUNT 70 /* 70 IDLE slices to enter SLEEP - * mode from STANDBY - */ -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* This enumeration provides all power management states. Receipt of the - * state indication is the state transition event. - */ - -enum pm_state_e -{ - PM_NORMAL = 0, /* Normal full power operating mode. If the driver is in - * a reduced power usage mode, it should immediately re- - * initialize for normal operatin. - * - * PM_NORMAL may be followed by PM_IDLE. - */ - PM_IDLE, /* Drivers will receive this state change if it is - * appropriate to enter a simple IDLE power state. This - * would include simple things such as reducing display back- - * lighting. The driver should be ready to resume normal - * activity instantly. - * - * PM_IDLE may be followed by PM_STANDBY or PM_NORMAL. - */ - PM_STANDBY, /* The system is entering standby mode. Standby is a lower - * power consumption mode that may involve more extensive - * power management steps such has disabling clocking or - * setting the processor into reduced power consumption - * modes. In this state, the system should still be able - * to resume normal activity almost immediately. - * - * PM_STANDBY may be followed PM_SLEEP or by PM_NORMAL - */ - PM_SLEEP, /* The system is entering deep sleep mode. The most drastic - * power reduction measures possible should be taken in this - * state. It may require some time to get back to normal - * operation from SLEEP (some MCUs may even require going - * through reset). - * - * PM_SLEEP may be following by PM_NORMAL - */ -}; - -/* This structure contain pointers callback functions in the driver. These - * callback functions can be used to provide power management information - * to the driver. - */ - -struct pm_callback_s -{ - struct sq_entry_s entry; /* Supports a singly linked list */ - - /************************************************************************** - * Name: prepare - * - * Description: - * Request the driver to prepare for a new power state. This is a - * warning that the system is about to enter into a new power state. The - * driver should begin whatever operations that may be required to enter - * power state. The driver may abort the state change mode by returning - * a non-zero value from the callback function - * - * Input Parameters: - * cb - Returned to the driver. The driver version of the callback - * strucure may include additional, driver-specific state - * data at the end of the structure. - * pmstate - Identifies the new PM state - * - * Returned Value: - * 0 (OK) means the event was successfully processed and that the driver - * is prepared for the PM state change. Non-zero means that the driver - * is not prepared to perform the tasks needed achieve this power setting - * and will cause the state change to be aborted. NOTE: The prepare - * method will also be recalled when reverting from lower back to higher - * power consumption modes (say because another driver refused a lower - * power state change). Drivers are not permitted to return non-zero - * values when reverting back to higher power consumption modes! - * - **************************************************************************/ - - int (*prepare)(FAR struct pm_callback_s *cb, enum pm_state_e pmstate); - - /************************************************************************** - * Name: notify - * - * Description: - * Notify the driver of new power state. This callback is called after - * all drivers have had the opportunity to prepare for the new power - * state. - * - * Input Parameters: - * cb - Returned to the driver. The driver version of the callback - * strucure may include additional, driver-specific state - * data at the end of the structure. - * pmstate - Identifies the new PM state - * - * Returned Value: - * None. The driver already agreed to transition to the low power - * consumption state when when it returned OK to the prepare() call. - * At that time it should have made all preprations necessary to enter - * the new state. Now the driver must make the state transition. - * - **************************************************************************/ - - void (*notify)(FAR struct pm_callback_s *cb, enum pm_state_e pmstate); -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifndef __ASSEMBLY__ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ -/**************************************************************************** - * Name: pm_initialize - * - * Description: - * This function is called by MCU-specific logic at power-on reset in - * order to provide one-time initialization the power management subystem. - * This function must be called *very* early in the intialization sequence - * *before* any other device drivers are initialized (since they may - * attempt to register with the power management subsystem). - * - * Input parameters: - * None. - * - * Returned value: - * None. - * - ****************************************************************************/ - -EXTERN void pm_initialize(void); - -/**************************************************************************** - * Name: pm_register - * - * Description: - * This function is called by a device driver in order to register to - * receive power management event callbacks. - * - * Input parameters: - * callbacks - An instance of struct pm_callback_s providing the driver - * callback functions. - * - * Returned value: - * Zero (OK) on success; otherwise a negater errno value is returned. - * - ****************************************************************************/ - -EXTERN int pm_register(FAR struct pm_callback_s *callbacks); - -/**************************************************************************** - * Name: pm_activity - * - * Description: - * This function is called by a device driver to indicate that it is - * performing meaningful activities (non-idle). This increment an activty - * count and/or will restart a idle timer and prevent entering reduced - * power states. - * - * Input Parameters: - * priority - Activity priority, range 0-9. Larger values correspond to - * higher priorities. Higher priority activity can prevent the system - * from entering reduced power states for a longer period of time. - * - * As an example, a button press might be higher priority activity because - * it means that the user is actively interacting with the device. - * - * Returned Value: - * None. - * - * Assumptions: - * This function may be called from an interrupt handler (this is the ONLY - * PM function that may be called from an interrupt handler!). - * - ****************************************************************************/ - -EXTERN void pm_activity(int priority); - -/**************************************************************************** - * Name: pm_checkstate - * - * Description: - * This function is called from the MCU-specific IDLE loop to monitor the - * the power management conditions. This function returns the "recommended" - * power management state based on the PM configuration and activity - * reported in the last sampling periods. The power management state is - * not automatically changed, however. The IDLE loop must call - * pm_changestate() in order to make the state change. - * - * These two steps are separated because the plaform-specific IDLE loop may - * have additional situational information that is not available to the - * the PM sub-system. For example, the IDLE loop may know that the - * battery charge level is very low and may force lower power states - * even if there is activity. - * - * NOTE: That these two steps are separated in time and, hence, the IDLE - * loop could be suspended for a long period of time between calling - * pm_checkstate() and pm_changestate(). The IDLE loop may need to make - * these calls atomic by either disabling interrupts until the state change - * is completed. - * - * Input Parameters: - * None - * - * Returned Value: - * The recommended power management state. - * - ****************************************************************************/ - -EXTERN enum pm_state_e pm_checkstate(void); - -/**************************************************************************** - * Name: pm_changestate - * - * Description: - * This function is used to platform-specific power managmeent logic. It - * will announce the power management power management state change to all - * drivers that have registered for power management event callbacks. - * - * Input Parameters: - * newstate - Identifies the new PM state - * - * Returned Value: - * 0 (OK) means that the callback function for all registered drivers - * returned OK (meaning that they accept the state change). Non-zero - * means that one of the drivers refused the state change. In this case, - * the system will revert to the preceding state. - * - * Assumptions: - * It is assumed that interrupts are disabled when this function is - * called. This function is probably called from the IDLE loop... the - * lowest priority task in the system. Changing driver power management - * states may result in renewed system activity and, as a result, can - * suspend the IDLE thread before it completes the entire state change - * unless interrupts are disabled throughout the state change. - * - ****************************************************************************/ - -EXTERN int pm_changestate(enum pm_state_e newstate); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __ASSEMBLY__ */ - -/**************************************************************************** - * Stubs - ****************************************************************************/ - -#else /* CONFIG_PM */ - -/* Stubbed out versions of all of PM interface functions that may be used to - * avoid so much conditional compilation in driver code when PM is disabled: - */ - -# define pm_initialize() -# define pm_register(cb) (0) -# define pm_activity(prio) -# define pm_checkstate() (0) -# define pm_changestate(state) - -#endif /* CONFIG_PM */ -#endif /* __INCLUDE_NUTTX_POWER_PM_H */ diff --git a/nuttx/include/nuttx/progmem.h b/nuttx/include/nuttx/progmem.h deleted file mode 100644 index 2da59eab1..000000000 --- a/nuttx/include/nuttx/progmem.h +++ /dev/null @@ -1,199 +0,0 @@ -/**************************************************************************** - * include/nuttx/progmem.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_NUTTX_PROGMEM_H -#define __INCLUDE_NUTTX_PROGMEM_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_progmem_npages - * - * Description: - * Return number of pages - * - ****************************************************************************/ - -uint16_t up_progmem_npages(void); - -/**************************************************************************** - * Name: up_progmem_isuniform - * - * Description: - * Is program memory uniform or page size differs? - * - ****************************************************************************/ - -bool up_progmem_isuniform(void); - -/**************************************************************************** - * Name: up_progmem_pagesize - * - * Description: - * Return page size - * - ****************************************************************************/ - -uint16_t up_progmem_pagesize(uint16_t page); - -/**************************************************************************** - * Name: up_progmem_getpage - * - * Description: - * Address to page conversion - * - * Input Parameters: - * addr - Address with of without flash offset (absolute or aligned to page0) - * - * Returned Value: - * Page or negative value on error. The following errors are reported - * (errno is not set!): - * - * EFAULT: On invalid address - * - ****************************************************************************/ - -int up_progmem_getpage(uint32_t addr); - -/**************************************************************************** - * Name: up_progmem_erasepage - * - * Description: - * Erase selected page. - * - * Input Parameters: - * page - - * - * Returned Value: - * Page size or negative value on error. The following errors are reported - * (errno is not set!): - * - * EFAULT: On invalid page - * EIO: On unsuccessful erase - * EROFS: On access to write protected area - * EACCES: Insufficient permissions (read/write protected) - * EPERM: If operation is not permitted due to some other constraints - * (i.e. some internal block is not running etc.) - * - ****************************************************************************/ - -int up_progmem_erasepage(uint16_t page); - -/**************************************************************************** - * Name: up_progmem_ispageerased - * - * Description: - * Checks whether page is erased - * - * Input Parameters: - * page - - * - * Returned Value: - * Returns number of bytes written or negative value on error. If it - * returns zero then complete page is empty (erased). - * - * The following errors are reported (errno is not set!) - * EFAULT: On invalid page - * - ****************************************************************************/ - -int up_progmem_ispageerased(uint16_t page); - -/**************************************************************************** - * Name: up_progmem_write - * - * Description: - * Program data at given address - * - * Note: this function is not limited to single page and nor it requires - * the address be aligned inside the page boundaries. - * - * Input Parameters: - * addr - Address with or without flash offset (absolute or aligned to page0) - * buf - Pointer to buffer - * count - Number of bytes to write * - * - * Returned Value: - * Bytes written or negative value on error. The following errors are - * reported (errno is not set!) - * - * EINVAL: if count is not aligned with the flash boundaries (i.e. - * some MCU's require per half-word or even word access) - * EFAULT: On invalid address - * EIO: On unsuccessful write - * EROFS: On access to write protected area - * EACCES: Insufficient permissions (read/write protected) - * EPERM: If operation is not permitted due to some other constraints - * (i.e. some internal block is not running etc.) - * - ****************************************************************************/ - -int up_progmem_write(uint32_t addr, const void *buf, size_t count); - -/* TODO: Define the following functions and their options: - * - up_progmem_protect() - * - up_progmem_unprotect() - */ - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_PROGMEM_H */ diff --git a/nuttx/include/nuttx/pthread.h b/nuttx/include/nuttx/pthread.h deleted file mode 100644 index 2bdb88340..000000000 --- a/nuttx/include/nuttx/pthread.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** - * include/nuttx/pthread.h - * Non-standard, NuttX-specific pthread-related declarations. - * - * 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_NUTTX_PTHREAD_H -#define __INCLUDE_NUTTX_PTHREAD_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/* Default pthread attribute initializer */ - -#define PTHREAD_ATTR_INITIALIZER \ -{ \ - PTHREAD_STACK_DEFAULT, /* stacksize */ \ - PTHREAD_DEFAULT_PRIORITY, /* priority */ \ - SCHED_RR, /* policy */ \ - PTHREAD_EXPLICIT_SCHED, /* inheritsched */ \ -} - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/* Default pthread attributes (see sched/pthread_create.c). This global - * can only be shared within the kernel- or within the user- address space. - */ - -EXTERN pthread_attr_t g_default_pthread_attr; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_PTHREAD_H */ diff --git a/nuttx/include/nuttx/pwm.h b/nuttx/include/nuttx/pwm.h deleted file mode 100644 index 69fa4fc4d..000000000 --- a/nuttx/include/nuttx/pwm.h +++ /dev/null @@ -1,306 +0,0 @@ -/**************************************************************************** - * include/nuttx/pwm.h - * - * Copyright (C) 2011-2012 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_NUTTX_PWM_H -#define __INCLUDE_NUTTX_PWM_H - -/* For the purposes of this driver, a PWM device is any device that generates - * periodic output pulses s of controlled frequency and pulse width. Such a - * device might be used, for example, to perform pulse-width modulated output or - * frequency/pulse-count modulated output (such as might be needed to control - * a stepper motor). - * - * The PWM driver is split into two parts: - * - * 1) An "upper half", generic driver that provides the comman PWM interface - * to application level code, and - * 2) A "lower half", platform-specific driver that implements the low-level - * timer controls to implement the PWM functionality. - */ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#include - -#include - -#ifdef CONFIG_PWM - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* CONFIG_PWM - Enables because PWM driver support - * CONFIG_PWM_PULSECOUNT - Some hardware will support generation of a fixed - * number of pulses. This might be used, for example to support a stepper - * motor. If the hardware will support a fixed pulse count, then this - * configuration should be set to enable the capability. - * CONFIG_DEBUG_PWM - If enabled (with CONFIG_DEBUG and, optionally, - * CONFIG_DEBUG_VERBOSE), this will generate output that can be use dto - * debug the PWM driver. - */ - -/* IOCTL Commands ***********************************************************/ -/* The PWM module uses a standard character driver framework. However, since - * the PWM driver is a device control interface and not a data transfer - * interface, the majority of the functionality is implemented in driver - * ioctl calls. The PWM ioctl commands are lised below: - * - * PWMIOC_SETCHARACTERISTICS - Set the characteristics of the next pulsed - * output. This command will neither start nor stop the pulsed output. - * It will either setup the configuration that will be used when the - * output is started; or it will change the characteristics of the pulsed - * output on the fly if the timer is already started. This command will - * set the PWM characteristics and return immediately. - * - * ioctl argument: A read-only reference to struct pwm_info_s that provides - * the characteristics of the pulsed output. - * - * PWMIOC_GETCHARACTERISTICS - Get the currently selected characteristics of - * the pulsed output (independent of whether the output is start or stopped). - * - * ioctl argument: A reference to struct pwm_info_s to recevie the - * characteristics of the pulsed output. - * - * PWMIOC_START - Start the pulsed output. The PWMIOC_SETCHARACTERISTICS - * command must have previously been sent. If CONFIG_PWM_PULSECOUNT is - * defined and the pulse count was configured to a non-zero value, then - * this ioctl call will, by default, block until the programmed pulse count - * completes. That default blocking behavior can be overridden by using - * the O_NONBLOCK flag when the PWM driver is opened. - * - * ioctl argument: None - * - * PWMIOC_STOP - Stop the pulsed output. This command will stop the PWM - * and return immediately. - * - * ioctl argument: None - */ - -#define PWMIOC_SETCHARACTERISTICS _PWMIOC(1) -#define PWMIOC_GETCHARACTERISTICS _PWMIOC(2) -#define PWMIOC_START _PWMIOC(3) -#define PWMIOC_STOP _PWMIOC(4) - -/**************************************************************************** - * Public Types - ****************************************************************************/ -/* This structure describes the characteristics of the pulsed output */ - -struct pwm_info_s -{ - uint32_t frequency; /* Frequency of the pulse train */ - ub16_t duty; /* Duty of the pulse train, "1"-to-"0" duration. - * Maximum: 65535/65536 (0x0000ffff) - * Minimum: 1/65536 (0x00000001) */ -#ifdef CONFIG_PWM_PULSECOUNT - uint32_t count; /* The number of pulse to generate. 0 means to - * generate an indefinite number of pulses */ -#endif -}; - -/* This structure is a set a callback functions used to call from the upper- - * half, generic PWM driver into lower-half, platform-specific logic that - * supports the low-level timer outputs. - */ - -struct pwm_lowerhalf_s; -struct pwm_ops_s -{ - /* This method is called when the driver is opened. The lower half driver - * should configure and initialize the device so that it is ready for use. - * It should not, however, output pulses until the start method is called. - */ - - CODE int (*setup)(FAR struct pwm_lowerhalf_s *dev); - - /* This method is called when the driver is closed. The lower half driver - * should stop pulsed output, free any resources, disable the timer hardware, and - * put the system into the lowest possible power usage state - */ - - CODE int (*shutdown)(FAR struct pwm_lowerhalf_s *dev); - - /* (Re-)initialize the timer resources and start the pulsed output. The - * start method should return an error if it cannot start the timer with - * the given parameter (frequency, duty, or optionally pulse count) - */ - -#ifdef CONFIG_PWM_PULSECOUNT - CODE int (*start)(FAR struct pwm_lowerhalf_s *dev, - FAR const struct pwm_info_s *info, - FAR void *handle); -#else - CODE int (*start)(FAR struct pwm_lowerhalf_s *dev, - FAR const struct pwm_info_s *info); -#endif - - /* Stop the pulsed output and reset the timer resources*/ - - CODE int (*stop)(FAR struct pwm_lowerhalf_s *dev); - - /* Lower-half logic may support platform-specific ioctl commands */ - - CODE int (*ioctl)(FAR struct pwm_lowerhalf_s *dev, - int cmd, unsigned long arg); -}; - -/* This structure is the generic form of state structure used by lower half - * timer driver. This state structure is passed to the pwm driver when the - * driver is initialized. Then, on subsequent callbacks into the lower half - * timer logic, this structure is provided so that the timer logic can - * maintain state information. - * - * Normally that timer logic will have its own, custom state structure - * that is simply cast to struct pwm_lowerhalf_s. In order to perform such casts, - * the initial fields of the custom state structure match the initial fields - * of the following generic PWM state structure. - */ - -struct pwm_lowerhalf_s -{ - /* The first field of this state structure must be a pointer to the PWM - * callback structure: - */ - - FAR const struct pwm_ops_s *ops; - - /* The custom timer state structure may include additional fields after - * the pointer to the PWM callback structure. - */ -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * "Upper-Half" PWM Driver Interfaces - ****************************************************************************/ -/**************************************************************************** - * Name: pwm_register - * - * Description: - * This function binds an instance of a "lower half" timer driver with the - * "upper half" PWM device and registers that device so that can be used - * by application code. - * - * When this function is called, the "lower half" driver should be in the - * reset state (as if the shutdown() method had already been called). - * - * Input parameters: - * path - The full path to the driver to be registers in the NuttX pseudo- - * filesystem. The recommended convention is to name all PWM drivers - * as "/dev/pwm0", "/dev/pwm1", etc. where the driver path differs only - * in the "minor" number at the end of the device name. - * dev - A pointer to an instance of lower half timer driver. This instance - * is bound to the PWM driver and must persists as long as the driver - * persists. - * - * Returned Value: - * Zero on success; a negated errno value on failure. - * - ****************************************************************************/ - -EXTERN int pwm_register(FAR const char *path, FAR struct pwm_lowerhalf_s *dev); - -/**************************************************************************** - * Name: pwm_expired - * - * Description: - * If CONFIG_PWM_PULSECOUNT is defined and the pulse count was configured - * to a non-zero value, then the "upper half" driver will wait for the - * pulse count to expire. The sequence of expected events is as follows: - * - * 1. The upper half driver calls the start method, providing the lower - * half driver with the pulse train characteristics. If a fixed - * number of pulses is required, the 'count' value will be nonzero. - * 2. The lower half driver's start() methoc must verify that it can - * support the request pulse train (frequency, duty, AND pulse count). - * It it cannot, it should return an error. If the pulse count is - * non-zero, it should set up the hardware for that number of pulses - * and return success. NOTE: That is CONFIG_PWM_PULSECOUNT is - * defined, the start() method receives an additional parameter - * that must be used in this callback. - * 3. When the start() method returns success, the upper half driver - * will "sleep" until the pwm_expired method is called. - * 4. When the lower half detects that the pulse count has expired - * (probably through an interrupt), it must call the pwm_expired - * interface using the handle that was previously passed to the - * start() method - * - * Input parameters: - * handle - This is the handle that was provided to the lower-half - * start() method. - * - * Returned Value: - * None - * - * Assumptions: - * This function may be called from an interrupt handler. - * - ****************************************************************************/ - -#ifdef CONFIG_PWM_PULSECOUNT -EXTERN void pwm_expired(FAR void *handle); -#endif - -/**************************************************************************** - * Platform-Independent "Lower-Half" PWM Driver Interfaces - ****************************************************************************/ - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_PWM */ -#endif /* __INCLUDE_NUTTX_PWM_H */ diff --git a/nuttx/include/nuttx/ramdisk.h b/nuttx/include/nuttx/ramdisk.h deleted file mode 100644 index 7d4017c11..000000000 --- a/nuttx/include/nuttx/ramdisk.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** - * include/nuttx/ramdisk.h - * - * Copyright (C) 2008-2009, 2012 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_NUTTX_RAMDISK_H -#define __INCLUDE_NUTTX_RAMDISK_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: ramdisk_register or romdisk_register - * - * Description: - * Non-standard function to register a ramdisk or a romdisk - * - * Input Parmeters: - * minor: Selects suffix of device named /dev/ramN, N={1,2,3...} - * nsectors: Number of sectors on device - * sectize: The size of one sector - * writeenabled: true: can write to ram disk - * buffer: RAM disk backup memory - * - * Returned Valued: - * Zero on success; a negated errno value on failure. - * - ****************************************************************************/ - -#ifdef CONFIG_FS_WRITABLE -EXTERN int ramdisk_register(int minor, FAR uint8_t *buffer, uint32_t nsectors, - uint16_t sectize, bool writeenabled); -#define romdisk_register(m,b,n,s) ramdisk_register(m,b,n,s,0) -#else -EXTERN int romdisk_register(int minor, FAR uint8_t *buffer, uint32_t nsectors, - uint16_t sectize); -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_RAMDISK_H */ diff --git a/nuttx/include/nuttx/ramlog.h b/nuttx/include/nuttx/ramlog.h deleted file mode 100644 index 7831ea509..000000000 --- a/nuttx/include/nuttx/ramlog.h +++ /dev/null @@ -1,208 +0,0 @@ -/**************************************************************************** - * include/nuttx/ramlog.h - * The RAM logging driver - * - * Copyright (C) 2012 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. - * - ****************************************************************************/ -/* The RAM logging driver is a driver that was intended to support debugging - * output (syslogging) when the normal serial output is not available. For - * example, if you are using a telnet or USB serial console, the debug - * output will get lost. - * - * The RAM logging driver is similar to a pipe in that it saves the - * debugging output in a FIFO in RAM. It differs from a pipe in numerous - * details as needed to support logging. - * - * This driver is built when CONFIG_RAMLOG is defined in the Nuttx - * configuration. - */ - -#ifndef __INCLUDE_NUTTX_RAMLOG_H -#define __INCLUDE_NUTTX_RAMLOG_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#ifdef CONFIG_RAMLOG - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* CONFIG_RAMLOG - Enables the RAM logging feature - * CONFIG_RAMLOG_CONSOLE - Use the RAM logging device as a system console. - * If this feature is enabled (along with CONFIG_DEV_CONSOLE), then all - * console output will be re-directed to a circular buffer in RAM. This - * is useful, for example, if the only console is a Telnet console. Then - * in that case, console output from non-Telnet threads will go to the - * circular buffer and can be viewed using the NSH 'dmesg' command. - * CONFIG_RAMLOG_SYSLOG - Use the RAM logging device for the syslogging - * interface. If this feature is enabled (along with CONFIG_SYSLOG), - * then all debug output (only) will be re-directed to the circular - * buffer in RAM. This RAM log can be view from NSH using the 'dmesg' - * command. NOTE: Unlike the limited, generic character driver SYSLOG - * device, the RAMLOG *can* be used to generate debug output from interrupt - * level handlers. - * CONFIG_RAMLOG_NPOLLWAITERS - The number of threads than can be waiting - * for this driver on poll(). Default: 4 - * - * If CONFIG_RAMLOG_CONSOLE or CONFIG_RAMLOG_SYSLOG is selected, then the - * following may also be provided: - * - * CONFIG_RAMLOG_CONSOLE_BUFSIZE - Size of the console RAM log. Default: 1024 - */ - -#ifndef CONFIG_DEV_CONSOLE -# undef CONFIG_RAMLOG_CONSOLE -#endif - -#ifndef CONFIG_SYSLOG -# undef CONFIG_RAMLOG_SYSLOG -#endif - -#if defined(CONFIG_RAMLOG_SYSLOG) && !defined(CONFIG_SYSLOG_DEVPATH) -# define CONFIG_SYSLOG_DEVPATH "/dev/ramlog" -#endif - -#ifndef CONFIG_RAMLOG_NPOLLWAITERS -# define CONFIG_RAMLOG_NPOLLWAITERS 4 -#endif - -#ifndef CONFIG_SYSLOG -# undef CONFIG_RAMLOG_SYSLOG -#endif - -#ifndef CONFIG_RAMLOG_CONSOLE_BUFSIZE -# define CONFIG_RAMLOG_CONSOLE_BUFSIZE 1024 -#endif - -/* The normal behavior of the RAM log when used as a SYSLOG is to return - * end-of-file if there is no data in the RAM log (rather than blocking until - * data is available). That allows you to 'cat' the SYSLOG with no ill - * consequences. - */ - -#ifdef CONFIG_SYSLOG -# undef CONFIG_RAMLOG_NONBLOCKING -# define CONFIG_RAMLOG_NONBLOCKING 1 -#endif - -/* When used as a console or syslogging device, the RAM log will pre-pend - * line-feeds with carriage returns. - */ - -#if defined(CONFIG_RAMLOG_CONSOLE) || defined(CONFIG_RAMLOG_SYSLOG) -# undef CONFIG_RAMLOG_CRLF -# define CONFIG_RAMLOG_CRLF 1 -#endif - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifndef __ASSEMBLY__ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ -/**************************************************************************** - * Name: ramlog_register - * - * Description: - * Create the RAM logging device and register it at the specified path. - * Mostly likely this path will be /dev/console. - * - * This interface is not normally used but can be made available is - * someone just wants to tinker with the RAM log as a generic character - * device. Normally both CONFIG_RAMLOG_CONSOLE and CONFIG_RAMLOG_SYSLOG - * would be set (to capture all output in the log) -OR- just - * CONFIG_RAMLOG_SYSLOG would be set to capture debug output only - * in the log. - * - ****************************************************************************/ - -#if !defined(CONFIG_RAMLOG_CONSOLE) && !defined(CONFIG_RAMLOG_SYSLOG) -EXTERN int ramlog_register(FAR const char *devpath, FAR char *buffer, - size_t buflen); -#endif - -/**************************************************************************** - * Name: ramlog_consoleinit - * - * Description: - * Create the RAM logging device and register it at the specified path. - * Mostly likely this path will be /dev/console. - * - * If CONFIG_RAMLOG_SYSLOG is also defined, then the same RAM logging - * device is also registered at CONFIG_SYSLOG_DEVPATH - * - ****************************************************************************/ - -#ifdef CONFIG_RAMLOG_CONSOLE -EXTERN int ramlog_consoleinit(void); -#endif - -/**************************************************************************** - * Name: ramlog_sysloginit - * - * Description: - * Create the RAM logging device and register it at the specified path. - * Mostly likely this path will be CONFIG_SYSLOG_DEVPATH - * - * If CONFIG_RAMLOG_CONSOLE is also defined, then this functionality is - * performed when ramlog_consoleinit() is called. - * - ****************************************************************************/ - -#ifdef CONFIG_RAMLOG_SYSLOG -EXTERN int ramlog_sysloginit(void); -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __ASSEMBLY__ */ -#endif /* CONFIG_RAMLOG */ -#endif /* __INCLUDE_NUTTX_RAMLOG_H */ diff --git a/nuttx/include/nuttx/regex.h b/nuttx/include/nuttx/regex.h deleted file mode 100644 index 030823a6f..000000000 --- a/nuttx/include/nuttx/regex.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** - * include/nuttx/regex.h - * Non-standard, pattern-matching APIs available in lib/. - * - * 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 __INCLUDE_NUTTX_REGEX_H -#define __INCLUDE_NUTTX_REGEX_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: match - * - * Description: - * Simple shell-style filename pattern matcher written by Jef Poskanzer - * (See copyright notice in lib/lib_match.c). This pattern matcher only - * handles '?', '*' and '**', and multiple patterns separated by '|'. - * - * Returned Value: - * Returns 1 (match) or 0 (no-match). - * - ****************************************************************************/ - -EXTERN int match(const char *pattern, const char *string); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_REGEX_H */ diff --git a/nuttx/include/nuttx/rgbcolors.h b/nuttx/include/nuttx/rgbcolors.h deleted file mode 100644 index 0f15d8158..000000000 --- a/nuttx/include/nuttx/rgbcolors.h +++ /dev/null @@ -1,293 +0,0 @@ -/**************************************************************************** - * include/nuttx/rgbcolors.h - * User-friendly RGB color definitions - * - * 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. - * - ****************************************************************************/ - -#ifndef __INCLUDE_NUTTX_RGBCOLOR_H -#define __INCLUDE_NUTTX_RGBCOLOR_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Color Creation and Conversion Macros *************************************/ -/* This macro creates RGB24 from 8:8:8 RGB */ - -#define RGBTO24(r,g,b) \ - ((uint32_t)((r) & 0xff) << 16 | (uint32_t)((g) & 0xff) << 8 | (uint32_t)((b) & 0xff)) - -/* And these macros perform the inverse transformation */ - -#define RBG24RED(rgb) (((rgb) >> 16) & 0xff) -#define RBG24GREEN(rgb) (((rgb) >> 8) & 0xff) -#define RBG24BLUE(rgb) ( (rgb) & 0xff) - -/* This macro creates RGB16 (5:6:5) from 8:8:8 RGB: - * - * R[7:3] -> RGB[15:11] - * G[7:2] -> RGB[10:5] - * B[7:3] -> RGB[4:0] - */ - -#define RGBTO16(r,g,b) \ - ((((uint16_t)(r) << 8) & 0xf800) | (((uint16_t)(g) << 3) & 0x07e0) | (((uint16_t)(b) >> 3) & 0x001f)) - -/* And these macros perform the inverse transformation */ - -#define RBG16RED(rgb) (((rgb) >> 8) & 0xf8) -#define RBG16GREEN(rgb) (((rgb) >> 3) & 0xfc) -#define RBG16BLUE(rgb) (((rgb) << 3) & 0xf8) - -/* This macro creates RGB8 (3:3:2) from 8:8:8 RGB */ - -#define RGBTO8(r,g,b) \ - ((((uint8_t)(r) << 5) & 0xe0) | (((uint8_t)(g) << 2) & 0x1c) | ((uint8_t)(b) & 0x03)) - -/* And these macros perform the inverse transformation */ - -#define RBG8RED(rgb) ( (rgb) & 0xe0) -#define RBG8GREEN(rgb) (((rgb) << 3) & 0xe0) -#define RBG8BLUE(rgb) (((rgb) << 6) & 0xc0) - -/* This macro converts RGB24 (8:8:8) to RGB16 (5:6:5): - * - * 00000000 RRRRRRRR BBBBBBBB GGGGGGGG -> RRRRRBBB BBBGGGGG - */ - -#define RGB24TO16(rgb24) \ - (((rgb24 >> 8) & 0xf800) | ((rgb24 >> 5) & 0x07e0) | ((rgb24 >> 3) & 0x001f)) - -/* This macro converts RGB16 (5:6:5) to RGB24 (8:8:8): - * - * RRRRRBBB BBBGGGGG -> 00000000 RRRRRRRR BBBBBBBB GGGGGGGG - */ - -#define RGB16TO24(rgb16) \ - (((rgb16 & 0xf800) << 8) | ((rgb16 & 0x07e0) << 5) | ((rgb16 & 0x001f) << 3)) - -/* Standard Color Definitions ***********************************************/ -/* RGB24-888: 00000000 RRRRRRRR GGGGGGGG BBBBBBBB */ - -#define RGB24_BLACK 0x00000000 -#define RGB24_WHITE 0x00ffffff - -#define RGB24_BLUE 0x000000ff -#define RGB24_GREEN 0x0000ff00 -#define RGB24_RED 0x00ff0000 - -#define RGB24_NAVY 0x00000080 -#define RGB24_DARKBLUE 0x0000008b -#define RGB24_DARKGREEN 0x00006400 -#define RGB24_DARKCYAN 0x00008b8b -#define RGB24_CYAN 0x0000ffff -#define RGB24_TURQUOISE 0x0040e0d0 -#define RGB24_INDIGO 0x004b0082 -#define RGB24_DARKRED 0x00800000 -#define RGB24_OLIVE 0x00808000 -#define RGB24_GRAY 0x00808080 -#define RGB24_SKYBLUE 0x0087ceeb -#define RGB24_BLUEVIOLET 0x008a2be2 -#define RGB24_LIGHTGREEN 0x0090ee90 -#define RGB24_DARKVIOLET 0x009400d3 -#define RGB24_YELLOWGREEN 0x009acd32 -#define RGB24_BROWN 0x00a52a2a -#define RGB24_DARKGRAY 0x00a9a9a9 -#define RGB24_SIENNA 0x00a0522d -#define RGB24_LIGHTBLUE 0x00add8e6 -#define RGB24_GREENYELLOW 0x00adff2f -#define RGB24_SILVER 0x00c0c0c0 -#define RGB24_LIGHTGREY 0x00d3d3d3 -#define RGB24_LIGHTCYAN 0x00e0ffff -#define RGB24_VIOLET 0x00ee82ee -#define RGB24_AZUR 0x00f0ffff -#define RGB24_BEIGE 0x00f5f5dc -#define RGB24_MAGENTA 0x00ff00ff -#define RGB24_TOMATO 0x00ff6347 -#define RGB24_GOLD 0x00ffd700 -#define RGB24_ORANGE 0x00ffa500 -#define RGB24_SNOW 0x00fffafa -#define RGB24_YELLOW 0x00ffff00 - -/* RGB16-565: RRRRRGGG GGGBBBBB */ - -#define RGB16_BLACK 0x0000 -#define RGB16_WHITE 0xffff - -#define RGB16_BLUE 0x001f -#define RGB16_GREEN 0x07e0 -#define RGB16_RED 0xf800 - -#define RGB16_NAVY 0x0010 -#define RGB16_DARKBLUE 0x0011 -#define RGB16_DARKGREEN 0x0320 -#define RGB16_DARKCYAN 0x0451 -#define RGB16_CYAN 0x07ff -#define RGB16_TURQUOISE 0x471a -#define RGB16_INDIGO 0x4810 -#define RGB16_DARKRED 0x8000 -#define RGB16_OLIVE 0x8400 -#define RGB16_GRAY 0x8410 -#define RGB16_SKYBLUE 0x867d -#define RGB16_BLUEVIOLET 0x895c -#define RGB16_LIGHTGREEN 0x9772 -#define RGB16_DARKVIOLET 0x901a -#define RGB16_YELLOWGREEN 0x9e66 -#define RGB16_BROWN 0xa145 -#define RGB16_DARKGRAY 0xad55 -#define RGB16_SIENNA 0xa285 -#define RGB16_LIGHTBLUE 0xaedc -#define RGB16_GREENYELLOW 0xafe5 -#define RGB16_SILVER 0xc618 -#define RGB16_LIGHTGREY 0xd69a -#define RGB16_LIGHTCYAN 0xe7ff -#define RGB16_VIOLET 0xec1d -#define RGB16_AZUR 0xf7ff -#define RGB16_BEIGE 0xf7bb -#define RGB16_MAGENTA 0xf81f -#define RGB16_TOMATO 0xfb08 -#define RGB16_GOLD 0xfea0 -#define RGB16_ORANGE 0xfd20 -#define RGB16_SNOW 0xffdf -#define RGB16_YELLOW 0xffe0 - -/* RGB12-444: RRRR GGGGBBBB */ - -#define RGB12_BLACK 0x0000 -#define RGB12_WHITE 0x0fff - -#define RGB12_BLUE 0x000f -#define RGB12_GREEN 0x00f0 -#define RGB12_RED 0x0f00 - -#define RGB12_NAVY 0x0008 -#define RGB12_DARKBLUE 0x0009 -#define RGB12_DARKGREEN 0x0060 -#define RGB12_DARKCYAN 0x0099 -#define RGB12_CYAN 0x00ff -#define RGB12_TURQUOISE 0x04ed -#define RGB12_INDIGO 0x0508 -#define RGB12_DARKRED 0x0800 -#define RGB12_OLIVE 0x0880 -#define RGB12_GRAY 0x0888 -#define RGB12_SKYBLUE 0x08df -#define RGB12_BLUEVIOLET 0x093e -#define RGB12_LIGHTGREEN 0x09f9 -#define RGB12_DARKVIOLET 0x090d -#define RGB12_YELLOWGREEN 0x0ad3 -#define RGB12_BROWN 0x0a33 -#define RGB12_DARKGRAY 0x0bbb -#define RGB12_SIENNA 0x0a53 -#define RGB12_LIGHTBLUE 0x0bee -#define RGB12_GREENYELLOW 0x0bf3 -#define RGB12_SILVER 0x0ccc -#define RGB12_LIGHTGREY 0x0ddd -#define RGB12_LIGHTCYAN 0x0eff -#define RGB12_VIOLET 0x0f8f -#define RGB12_AZUR 0x0fff -#define RGB12_BEIGE 0x0ffe -#define RGB12_MAGENTA 0x0f0f -#define RGB12_TOMATO 0x0f64 -#define RGB12_GOLD 0x0fd0 -#define RGB12_ORANGE 0x0fa0 -#define RGB12_SNOW 0x0fff -#define RGB12_YELLOW 0x0ff0 - -/* RGB8-332: RRRGGGBB (really not enough color resolution for the following) */ - -#define RGB8_BLACK 0x00 -#define RGB8_WHITE 0xff - -#define RGB8_BLUE 0x03 -#define RGB8_GREEN 0x1c -#define RGB8_RED 0xe0 -#define RGB8_NAVY 0x02 -#define RGB8_DARKBLUE 0x02 -#define RGB8_DARKGREEN 0x0c -#define RGB8_DARKCYAN 0x16 -#define RGB8_CYAN 0x1f -#define RGB8_TURQUOISE 0x5f -#define RGB8_INDIGO 0x62 -#define RGB8_DARKRED 0x80 -#define RGB8_OLIVE 0x90 -#define RGB8_GRAY 0x92 -#define RGB8_SKYBLUE 0x9f -#define RGB8_BLUEVIOLET 0xab -#define RGB8_LIGHTGREEN 0xbe -#define RGB8_DARKVIOLET 0x93 -#define RGB8_YELLOWGREEN 0x9d -#define RGB8_BROWN 0xa9 -#define RGB8_DARKGRAY 0xdb -#define RGB8_SIENNA 0xa9 -#define RGB8_LIGHTBLUE 0xdf -#define RGB8_GREENYELLOW 0xdd -#define RGB8_SILVER 0xd9 -#define RGB8_LIGHTGREY 0xd9 -#define RGB8_LIGHTCYAN 0xff -#define RGB8_VIOLET 0xf3 -#define RGB8_AZUR 0xff -#define RGB8_BEIGE 0xff -#define RGB8_MAGENTA 0xed -#define RGB8_TOMATO 0xfc -#define RGB8_GOLD 0xfc -#define RGB8_ORANGE 0xf8 -#define RGB8_SNOW 0xff -#define RGB8_YELLOW 0xfc - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifndef __ASSEMBLY__ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __ASSEMBLY__ */ -#endif /* __INCLUDE_NUTTX_RGBCOLOR_H */ diff --git a/nuttx/include/nuttx/rtc.h b/nuttx/include/nuttx/rtc.h deleted file mode 100644 index 85dea1b4d..000000000 --- a/nuttx/include/nuttx/rtc.h +++ /dev/null @@ -1,283 +0,0 @@ -/**************************************************************************** - * include/nuttx/rtc.h - * - * Copyright(C) 2011 Uros Platise. All rights reserved. - * Author: Uros Platise - * - * With extensions, modifications by: - * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. - * Author: Gregroy 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_NUTTX_RTC_H -#define __INCLUDE_NUTTX_RTC_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* CONFIG_RTC - Enables general support for a hardware RTC. Specific - * architectures may require other specific settings. - * - * CONFIG_RTC_DATETIME - There are two general types of RTC: (1) A simple - * battery backed counter that keeps the time when power is down, and (2) - * A full date / time RTC the provides the date and time information, often - * in BCD format. If CONFIG_RTC_DATETIME is selected, it specifies this - * second kind of RTC. In this case, the RTC is used to "seed" the normal - * NuttX timer and the NuttX system timer provides for higher resoution - * time. - * - * CONFIG_RTC_HIRES - If CONFIG_RTC_DATETIME not selected, then the simple, - * battery backed counter is used. There are two different implementations - * of such simple counters based on the time resolution of the counter: - * The typical RTC keeps time to resolution of 1 second, usually - * supporting a 32-bit time_t value. In this case, the RTC is used to - * "seed" the normal NuttX timer and the NuttX timer provides for higher - * resoution time. - * - * If CONFIG_RTC_HIRES is enabled in the NuttX configuration, then the - * RTC provides higher resolution time and completely replaces the system - * timer for purpose of date and time. - * - * CONFIG_RTC_FREQUENCY - If CONFIG_RTC_HIRES is defined, then the frequency - * of the high resolution RTC must be provided. If CONFIG_RTC_HIRES is - * not defined, CONFIG_RTC_FREQUENCY is assumed to be one. - * - * CONFIG_RTC_ALARM - Enable if the RTC hardware supports setting of an - * alarm. A callback function will be executed when the alarm goes off - */ - -#ifdef CONFIG_RTC_HIRES -# ifdef CONFIG_RTC_DATETIME -# error "CONFIG_RTC_HIRES and CONFIG_RTC_DATETIME are both defined" -# endif -# ifndef CONFIG_RTC_FREQUENCY -# error "CONFIG_RTC_FREQUENCY is required for CONFIG_RTC_HIRES" -# endif -#else -# ifndef CONFIG_RTC_FREQUENCY -# define CONFIG_RTC_FREQUENCY 1 -# endif -# if CONFIG_RTC_FREQUENCY != 1 -# error "The low resolution RTC must have frequency 1Hz" -# endif -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* The form of an alarm callback */ - -typedef CODE void (*alarmcb_t)(void); - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -/* Variable determines the state of the RTC module. - * - * After initialization value is set to 'true' if RTC starts successfully. - * The value can be changed to false also during operation if RTC for - * some reason fails. - */ - -extern volatile bool g_rtc_enabled; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/************************************************************************************ - * Name: up_rtcinitialize - * - * Description: - * Initialize the hardware RTC per the selected configuration. This function is - * called once during the OS initialization sequence - * - * Input Parameters: - * None - * - * Returned Value: - * Zero (OK) on success; a negated errno on failure - * - ************************************************************************************/ - -EXTERN int up_rtcinitialize(void); - -/************************************************************************************ - * Name: up_rtc_time - * - * Description: - * Get the current time in seconds. This is similar to the standard time() - * function. This interface is only required if the low-resolution RTC/counter - * hardware implementation selected. It is only used by the RTOS during - * intialization to set up the system time when CONFIG_RTC is set but neither - * CONFIG_RTC_HIRES nor CONFIG_RTC_DATETIME are set. - * - * Input Parameters: - * None - * - * Returned Value: - * The current time in seconds - * - ************************************************************************************/ - -#ifndef CONFIG_RTC_HIRES -EXTERN time_t up_rtc_time(void); -#endif - -/************************************************************************************ - * Name: up_rtc_gettime - * - * Description: - * Get the current time from the high resolution RTC clock/counter. This interface - * is only supported by the high-resolution RTC/counter hardware implementation. - * It is used to replace the system timer. - * - * Input Parameters: - * tp - The location to return the high resolution time value. - * - * Returned Value: - * Zero (OK) on success; a negated errno on failure - * - ************************************************************************************/ - -#ifdef CONFIG_RTC_HIRES -EXTERN int up_rtc_gettime(FAR struct timespec *tp); -#endif - -/************************************************************************************ - * Name: up_rtc_getdatetime - * - * Description: - * Get the current date and time from the date/time RTC. This interface - * is only supported by the date/time RTC hardware implementation. - * It is used to replace the system timer. It is only used by the RTOS during - * intialization to set up the system time when CONFIG_RTC and CONFIG_RTC_DATETIME - * are selected (and CONFIG_RTC_HIRES is not). - * - * NOTE: Some date/time RTC hardware is capability of sub-second accuracy. That - * sub-second accuracy is lost in this interface. However, since the system time - * is reinitialized on each power-up/reset, there will be no timing inaccuracy in - * the long run. - * - * Input Parameters: - * tp - The location to return the high resolution time value. - * - * Returned Value: - * Zero (OK) on success; a negated errno on failure - * - ************************************************************************************/ - -#ifdef CONFIG_RTC_DATETIME -EXTERN int up_rtc_getdatetime(FAR struct tm *tp); -#endif - -/************************************************************************************ - * Name: up_rtc_settime - * - * Description: - * Set the RTC to the provided time. All RTC implementations must be able to - * set their time based on a standard timespec. - * - * Input Parameters: - * tp - the time to use - * - * Returned Value: - * Zero (OK) on success; a negated errno on failure - * - ************************************************************************************/ - -EXTERN int up_rtc_settime(FAR const struct timespec *tp); - -/************************************************************************************ - * Name: up_rtc_setalarm - * - * Description: - * Set up an alarm. - * - * Input Parameters: - * tp - the time to set the alarm - * callback - the function to call when the alarm expires. - * - * Returned Value: - * Zero (OK) on success; a negated errno on failure - * - ************************************************************************************/ - -#ifdef CONFIG_RTC_ALARM -EXTERN int up_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback); -#endif - -/************************************************************************************ - * Name: up_rtc_cancelalarm - * - * Description: - * Cancel a pending alarm alarm - * - * Input Parameters: - * none - * - * Returned Value: - * Zero (OK) on success; a negated errno on failure - * - ************************************************************************************/ - -#ifdef CONFIG_RTC_ALARM -EXTERN int up_rtc_cancelalarm(void); -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_RTC_H */ diff --git a/nuttx/include/nuttx/rwbuffer.h b/nuttx/include/nuttx/rwbuffer.h deleted file mode 100644 index eb7861872..000000000 --- a/nuttx/include/nuttx/rwbuffer.h +++ /dev/null @@ -1,192 +0,0 @@ -/**************************************************************************** - * include/nuttx/rwbuffer.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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#ifndef __INCLUDE_NUTTX_RWBUFFER_H -#define __INCLUDE_NUTTX_RWBUFFER_H - -/********************************************************************** - * Included Files - **********************************************************************/ - -#include - -#include -#include -#include -#include - -#if defined(CONFIG_FS_WRITEBUFFER) || defined(CONFIG_FS_READAHEAD) - -/********************************************************************** - * Pre-processor Definitions - **********************************************************************/ - -/********************************************************************** - * Public Types - **********************************************************************/ - -/* Data transfer callouts. These must be provided by the block driver - * logic in order to flush the write buffer when appropriate or to - * reload the read-ahead buffer, when appropriate. - */ - -typedef ssize_t (*rwbreload_t)(FAR void *dev, FAR uint8_t *buffer, - off_t startblock, size_t nblocks); -typedef ssize_t (*rwbflush_t)(FAR void *dev, FAR const uint8_t *buffer, - off_t startblock, size_t nblocks); - -/* This structure holds the state of the buffers. In typical usage, - * an instance of this structure is declared within each block driver - * status structure like: - * - * struct foo_dev_s - * { - * ... - * struct rwbuffer_s rwbuffer; - * ... - * }; - * - * Note that this supports buffering for multiple block devices or for - * multiple instances of same block device, because each rwbuffer instance - * supports independent buffering. - * - * A reference to the struct rwbuffer_s instance is then passed to each - * interface like: - * - * struct foo_dev_s *priv; - * ... - * ... [Setup blocksize, nblocks, dev, wrmaxblocks, wrflush, - * rhmaxblocks, rhreload] ... - * ret = rwb_initialize(&priv->rwbuffer); - */ - -struct rwbuffer_s -{ - /********************************************************************/ - /* These values must be provided by the user prior to calling - * rwb_initialize() - */ - - /* Supported geometry */ - - uint16_t blocksize; /* The size of one block */ - size_t nblocks; /* The total number blocks supported */ - FAR void *dev; /* Device state passed to callout functions */ - - /* Write buffer setup. If CONFIG_FS_WRITEBUFFER is defined, but you - * want read-ahead-only operation, (1) set wrmaxblocks to zero and do - * not use rwb_write(). - */ - -#ifdef CONFIG_FS_WRITEBUFFER - uint16_t wrmaxblocks; /* The number of blocks to buffer in memory */ - rwbflush_t wrflush; /* Callout to flush the write buffer */ -#endif - - /* Read-ahead buffer setup. If CONFIG_FS_READAHEAD is defined but you - * want write-buffer-only operation, then (1) set rhmaxblocks to zero and - * do not use rwb_read(). - */ - -#ifdef CONFIG_FS_READAHEAD - uint16_t rhmaxblocks; /* The number of blocks to buffer in memory */ - rwbreload_t rhreload; /* Callout to reload the read-ahead buffer */ -#endif - - /********************************************************************/ - /* The user should never modify any of the remaing fields */ - - /* This is the state of the write buffer */ - -#ifdef CONFIG_FS_WRITEBUFFER - sem_t wrsem; /* Enforces exclusive access to the write buffer */ - struct work_s work; /* Delayed work to flush buffer after adelay with no activity */ - uint8_t *wrbuffer; /* Allocated write buffer */ - uint16_t wrnblocks; /* Number of blocks in write buffer */ - off_t wrblockstart; /* First block in write buffer */ - off_t wrexpectedblock; /* Next block expected */ -#endif - - /* This is the state of the read-ahead buffer */ - -#ifdef CONFIG_FS_READAHEAD - sem_t rhsem; /* Enforces exclusive access to the write buffer */ - uint8_t *rhbuffer; /* Allocated read-ahead buffer */ - uint16_t rhnblocks; /* Number of blocks in read-ahead buffer */ - off_t rhblockstart; /* First block in read-ahead buffer */ -#endif -}; - -/********************************************************************** - * Global Variables - **********************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN EXTERN "C" -EXTERN "C" { -#else -#define EXTERN extern -#endif - -/********************************************************************** - * Global Function Prototypes - **********************************************************************/ - -/* Buffer initialization */ - -EXTERN int rwb_initialize(FAR struct rwbuffer_s *rwb); -EXTERN void rwb_uninitialize(FAR struct rwbuffer_s *rwb); - -/* Buffer transfers */ - -EXTERN ssize_t rwb_read(FAR struct rwbuffer_s *rwb, off_t startblock, - size_t blockcount, FAR uint8_t *rdbuffer); -EXTERN ssize_t rwb_write(FAR struct rwbuffer_s *rwb, - off_t startblock, size_t blockcount, - FAR const uint8_t *wrbuffer); -EXTERN int rwb_mediaremoved(FAR struct rwbuffer_s *rwb); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* CONFIG_FS_WRITEBUFFER || CONFIG_READAHEAD_BUFFER */ -#endif /* __INCLUDE_NUTTX_RWBUFFER_H */ diff --git a/nuttx/include/nuttx/sched.h b/nuttx/include/nuttx/sched.h deleted file mode 100644 index f8b4eb0dc..000000000 --- a/nuttx/include/nuttx/sched.h +++ /dev/null @@ -1,578 +0,0 @@ -/******************************************************************************** - * include/nuttx/sched.h - * - * Copyright (C) 2007-2013 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_NUTTX_SCHED_H -#define __INCLUDE_NUTTX_SCHED_H - -/******************************************************************************** - * Included Files - ********************************************************************************/ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************** - * Pre-processor Definitions - ********************************************************************************/ -/* Configuration ****************************************************************/ -/* Task groups currently only supported for retention of child status */ - -#undef HAVE_TASK_GROUP -#undef HAVE_GROUP_MEMBERS - -/* We need a group an group members if we are supportint the parent/child - * relationship. - */ - -#if defined(CONFIG_SCHED_HAVE_PARENT) && defined(CONFIG_SCHED_CHILD_STATUS) -# define HAVE_TASK_GROUP 1 -# define HAVE_GROUP_MEMBERS 1 - -/* We need a group (but not members) if any other resources are shared within - * a task group. - */ - -#else -# if !defined(CONFIG_DISABLE_ENVIRON) -# define HAVE_TASK_GROUP 1 -# elif CONFIG_NFILE_DESCRIPTORS > 0 -# define HAVE_TASK_GROUP 1 -# elif CONFIG_NFILE_STREAMS > 0 -# define HAVE_TASK_GROUP 1 -# elif CONFIG_NSOCKET_DESCRIPTORS > 0 -# define HAVE_TASK_GROUP 1 -# endif -#endif - -/* In any event, we don't need group members if support for pthreads is disabled */ - -#ifdef CONFIG_DISABLE_PTHREAD -# undef HAVE_GROUP_MEMBERS -#endif - -/* Task Management Definitions **************************************************/ - -/* This is the maximum number of times that a lock can be set */ - -#define MAX_LOCK_COUNT 127 - -/* Values for the _TCB flags bits */ - -#define TCB_FLAG_TTYPE_SHIFT (0) /* Bits 0-1: thread type */ -#define TCB_FLAG_TTYPE_MASK (3 << TCB_FLAG_TTYPE_SHIFT) -# define TCB_FLAG_TTYPE_TASK (0 << TCB_FLAG_TTYPE_SHIFT) /* Normal user task */ -# define TCB_FLAG_TTYPE_PTHREAD (1 << TCB_FLAG_TTYPE_SHIFT) /* User pthread */ -# define TCB_FLAG_TTYPE_KERNEL (2 << TCB_FLAG_TTYPE_SHIFT) /* Kernel thread */ -#define TCB_FLAG_NONCANCELABLE (1 << 2) /* Bit 2: Pthread is non-cancelable */ -#define TCB_FLAG_CANCEL_PENDING (1 << 3) /* Bit 3: Pthread cancel is pending */ -#define TCB_FLAG_ROUND_ROBIN (1 << 4) /* Bit 4: Round robin sched enabled */ -#define TCB_FLAG_EXIT_PROCESSING (1 << 5) /* Bit 5: Exitting */ - -/* Values for struct task_group tg_flags */ - -#define GROUP_FLAG_NOCLDWAIT (1 << 0) /* Bit 0: Do not retain child exit status */ - -/* Values for struct child_status_s ch_flags */ - -#define CHILD_FLAG_TTYPE_SHIFT (0) /* Bits 0-1: child thread type */ -#define CHILD_FLAG_TTYPE_MASK (3 << CHILD_FLAG_TTYPE_SHIFT) -# define CHILD_FLAG_TTYPE_TASK (0 << CHILD_FLAG_TTYPE_SHIFT) /* Normal user task */ -# define CHILD_FLAG_TTYPE_PTHREAD (1 << CHILD_FLAG_TTYPE_SHIFT) /* User pthread */ -# define CHILD_FLAG_TTYPE_KERNEL (2 << CHILD_FLAG_TTYPE_SHIFT) /* Kernel thread */ -#define CHILD_FLAG_EXITED (1 << 0) /* Bit 2: The child thread has exit'ed */ - -/******************************************************************************** - * Public Type Definitions - ********************************************************************************/ - -#ifndef __ASSEMBLY__ - -/* General Task Management Types ************************************************/ - -/* This is the type of the task_state field of the TCB. NOTE: the order and - * content of this enumeration is critical since there are some OS tables indexed - * by these values. The range of values is assumed to fit into a uint8_t in _TCB. - */ - -enum tstate_e -{ - TSTATE_TASK_INVALID = 0, /* INVALID - The TCB is uninitialized */ - TSTATE_TASK_PENDING, /* READY_TO_RUN - Pending preemption unlock */ - TSTATE_TASK_READYTORUN, /* READY-TO-RUN - But not running */ - TSTATE_TASK_RUNNING, /* READY_TO_RUN - And running */ - - TSTATE_TASK_INACTIVE, /* BLOCKED - Initialized but not yet activated */ - TSTATE_WAIT_SEM, /* BLOCKED - Waiting for a semaphore */ -#ifndef CONFIG_DISABLE_SIGNALS - TSTATE_WAIT_SIG, /* BLOCKED - Waiting for a signal */ -#endif -#ifndef CONFIG_DISABLE_MQUEUE - TSTATE_WAIT_MQNOTEMPTY, /* BLOCKED - Waiting for a MQ to become not empty. */ - TSTATE_WAIT_MQNOTFULL, /* BLOCKED - Waiting for a MQ to become not full. */ -#endif -#ifdef CONFIG_PAGING - TSTATE_WAIT_PAGEFILL, /* BLOCKED - Waiting for page fill */ -#endif - NUM_TASK_STATES /* Must be last */ -}; -typedef enum tstate_e tstate_t; - -/* The following definitions are determined by tstate_t */ - -#define FIRST_READY_TO_RUN_STATE TSTATE_TASK_READYTORUN -#define LAST_READY_TO_RUN_STATE TSTATE_TASK_RUNNING -#define FIRST_BLOCKED_STATE TSTATE_TASK_INACTIVE -#define LAST_BLOCKED_STATE (NUM_TASK_STATES-1) - -/* The following is the form of a thread start-up function */ - -typedef void (*start_t)(void); - -/* This is the entry point into the main thread of the task or into a created - * pthread within the task. - */ - -union entry_u -{ - pthread_startroutine_t pthread; - main_t main; -}; -typedef union entry_u entry_t; - -/* This is the type of the function called at task startup */ - -#ifdef CONFIG_SCHED_STARTHOOK -typedef CODE void (*starthook_t)(FAR void *arg); -#endif - -/* These are the types of the functions that are executed with exit() is called - * (if registered via atexit() on on_exit()). - */ - -#ifdef CONFIG_SCHED_ATEXIT -typedef CODE void (*atexitfunc_t)(void); -#endif - -#ifdef CONFIG_SCHED_ONEXIT -typedef CODE void (*onexitfunc_t)(int exitcode, FAR void *arg); -#endif - -/* POSIX Message queue */ - -typedef struct msgq_s msgq_t; - -/* struct child_status_s *********************************************************/ -/* This structure is used to maintin information about child tasks. - * pthreads work differently, they have join information. This is - * only for child tasks. - */ - -#ifdef CONFIG_SCHED_CHILD_STATUS -struct child_status_s -{ - FAR struct child_status_s *flink; - - uint8_t ch_flags; /* Child status: See CHILD_FLAG_* definitions */ - pid_t ch_pid; /* Child task ID */ - int ch_status; /* Child exit status */ -}; -#endif - -/* struct dspace_s ***************************************************************/ -/* This structure describes a reference counted D-Space region. This must be a - * separately allocated "break-away" structure that can be owned by a task and - * any pthreads created by the task. - */ - -#ifdef CONFIG_PIC -struct dspace_s -{ - /* The life of the structure allocation is determined by this reference - * count. This count is number of threads that shared the the same D-Space. - * This includes the parent task as well as any pthreads created by the - * parent task or any of its child threads. - */ - - uint16_t crefs; - - /* This is the allocated D-Space memory region. This may be a physical - * address allocated with kmalloc(), or it may be virtual address associated - * with an address environment (if CONFIG_ADDRENV=y). - */ - - FAR uint8_t *region; -}; -#endif - -/* struct task_group_s ***********************************************************/ -/* All threads created by pthread_create belong in the same task group (along with - * the thread of the original task). struct task_group_s is a shared, "breakaway" - * structure referenced by each TCB. - * - * This structure should contain *all* resources shared by tasks and threads that - * belong to the same task group: - * - * Child exit status - * Environment varibles - * PIC data space and address environments - * File descriptors - * FILE streams - * Sockets - * - * Currenty, however, this implementation only applies to child exit status. - * - * Each instance of struct task_group_s is reference counted. Each instance is - * created with a reference count of one. The reference incremeneted when each - * thread joins the group and decremented when each thread exits, leaving the - * group. When the refernce count decrements to zero, the struc task_group_s - * is free. - */ - -#ifdef HAVE_TASK_GROUP -struct task_group_s -{ -#ifdef HAVE_GROUP_MEMBERS - struct task_group_s *flink; /* Supports a singly linked list */ - gid_t tg_gid; /* The ID of this task group */ - gid_t tg_pgid; /* The ID of the parent task group */ -#endif - uint8_t tg_flags; /* See GROUP_FLAG_* definitions */ - - /* Group membership ***********************************************************/ - - uint8_t tg_nmembers; /* Number of members in the group */ -#ifdef HAVE_GROUP_MEMBERS - uint8_t tg_mxmembers; /* Number of members in allocation */ - FAR pid_t *tg_members; /* Members of the group */ -#endif - - /* Child exit status **********************************************************/ - -#if defined(CONFIG_SCHED_HAVE_PARENT) && defined(CONFIG_SCHED_CHILD_STATUS) - FAR struct child_status_s *tg_children; /* Head of a list of child status */ -#endif - - /* Environment variables ******************************************************/ - -#ifndef CONFIG_DISABLE_ENVIRON - size_t tg_envsize; /* Size of environment string allocation */ - FAR char *tg_envp; /* Allocated environment strings */ -#endif - - /* PIC data space and address environments ************************************/ - /* Logically the PIC data space belongs here (see struct dspace_s). The - * current logic needs review: There are differences in the away that the - * life of the PIC data is managed. - */ - - /* File descriptors ***********************************************************/ - -#if CONFIG_NFILE_DESCRIPTORS > 0 - struct filelist tg_filelist; /* Maps file descriptor to file */ -#endif - - /* FILE streams ***************************************************************/ - -#if CONFIG_NFILE_STREAMS > 0 - struct streamlist tg_streamlist; /* Holds C buffered I/O info */ -#endif /* CONFIG_NFILE_STREAMS */ - - /* Sockets ********************************************************************/ - -#if CONFIG_NSOCKET_DESCRIPTORS > 0 - struct socketlist tg_socketlist; /* Maps socket descriptor to socket */ -#endif -}; -#endif - -/* _TCB **************************************************************************/ -/* This is the task control block (TCB). Each task or thread is represented by - * a TCB. The TCB is the heart of the NuttX task-control logic. - */ - -struct _TCB -{ - /* Fields used to support list management *************************************/ - - FAR struct _TCB *flink; /* Doubly linked list */ - FAR struct _TCB *blink; - - /* Task Group *****************************************************************/ - -#ifdef HAVE_TASK_GROUP - FAR struct task_group_s *group; /* Pointer to shared task group data */ -#endif - - /* Task Management Fields *****************************************************/ - - pid_t pid; /* This is the ID of the thread */ - -#ifdef CONFIG_SCHED_HAVE_PARENT /* Support parent-child relationship */ -#ifndef HAVE_GROUP_MEMBERS /* Don't know pids of group members */ - pid_t ppid; /* This is the ID of the parent thread */ -#ifndef CONFIG_SCHED_CHILD_STATUS /* Retain child thread status */ - uint16_t nchildren; /* This is the number active children */ -#endif -#endif -#endif /* CONFIG_SCHED_HAVE_PARENT */ - - start_t start; /* Thread start function */ - entry_t entry; /* Entry Point into the thread */ - -#ifdef CONFIG_SCHED_STARTHOOK - starthook_t starthook; /* Task startup function */ - FAR void *starthookarg; /* The argument passed to the function */ -#endif - -#if defined(CONFIG_SCHED_ATEXIT) && !defined(CONFIG_SCHED_ONEXIT) -# if defined(CONFIG_SCHED_ATEXIT_MAX) && CONFIG_SCHED_ATEXIT_MAX > 1 - atexitfunc_t atexitfunc[CONFIG_SCHED_ATEXIT_MAX]; -# else - atexitfunc_t atexitfunc; /* Called when exit is called. */ -# endif -#endif - -#ifdef CONFIG_SCHED_ONEXIT -# if defined(CONFIG_SCHED_ONEXIT_MAX) && CONFIG_SCHED_ONEXIT_MAX > 1 - onexitfunc_t onexitfunc[CONFIG_SCHED_ONEXIT_MAX]; - FAR void *onexitarg[CONFIG_SCHED_ONEXIT_MAX]; -# else - onexitfunc_t onexitfunc; /* Called when exit is called. */ - FAR void *onexitarg; /* The argument passed to the function */ -# endif -#endif - -#if defined(CONFIG_SCHED_WAITPID) && !defined(CONFIG_SCHED_HAVE_PARENT) - sem_t exitsem; /* Support for waitpid */ - int *stat_loc; /* Location to return exit status */ -#endif - - uint8_t sched_priority; /* Current priority of the thread */ - -#ifdef CONFIG_PRIORITY_INHERITANCE -# if CONFIG_SEM_NNESTPRIO > 0 - uint8_t npend_reprio; /* Number of nested reprioritizations */ - uint8_t pend_reprios[CONFIG_SEM_NNESTPRIO]; -# endif - uint8_t base_priority; /* "Normal" priority of the thread */ -#endif - - uint8_t task_state; /* Current state of the thread */ - uint16_t flags; /* Misc. general status flags */ - int16_t lockcount; /* 0=preemptable (not-locked) */ - -#ifndef CONFIG_DISABLE_PTHREAD - FAR void *joininfo; /* Detach-able info to support join */ -#endif - -#if CONFIG_RR_INTERVAL > 0 - int timeslice; /* RR timeslice interval remaining */ -#endif - - /* Values needed to restart a task ********************************************/ - - uint8_t init_priority; /* Initial priority of the task */ - char *argv[CONFIG_MAX_TASK_ARGS+1]; /* Name+start-up parameters */ - - /* Stack-Related Fields *******************************************************/ - -#ifndef CONFIG_CUSTOM_STACK - size_t adj_stack_size; /* Stack size after adjustment */ - /* for hardware, processor, etc. */ - /* (for debug purposes only) */ - FAR void *stack_alloc_ptr; /* Pointer to allocated stack */ - /* Need to deallocate stack */ - FAR void *adj_stack_ptr; /* Adjusted stack_alloc_ptr for HW */ - /* The initial stack pointer value */ -#endif - - /* External Module Support ****************************************************/ - -#ifdef CONFIG_PIC - FAR struct dspace_s *dspace; /* Allocated area for .bss and .data */ -#endif - - /* POSIX Thread Specific Data *************************************************/ - -#if !defined(CONFIG_DISABLE_PTHREAD) && CONFIG_NPTHREAD_KEYS > 0 - FAR void *pthread_data[CONFIG_NPTHREAD_KEYS]; -#endif - - /* POSIX Semaphore Control Fields *********************************************/ - - sem_t *waitsem; /* Semaphore ID waiting on */ - - /* POSIX Signal Control Fields ************************************************/ - -#ifndef CONFIG_DISABLE_SIGNALS - sigset_t sigprocmask; /* Signals that are blocked */ - sigset_t sigwaitmask; /* Waiting for pending signals */ - sq_queue_t sigactionq; /* List of actions for signals */ - sq_queue_t sigpendingq; /* List of Pending Signals */ - sq_queue_t sigpendactionq; /* List of pending signal actions */ - sq_queue_t sigpostedq; /* List of posted signals */ - siginfo_t sigunbinfo; /* Signal info when task unblocked */ -#endif - - /* POSIX Named Message Queue Fields *******************************************/ - -#ifndef CONFIG_DISABLE_MQUEUE - sq_queue_t msgdesq; /* List of opened message queues */ - FAR msgq_t *msgwaitq; /* Waiting for this message queue */ -#endif - - /* Library related fields *****************************************************/ - - int pterrno; /* Current per-thread errno */ - - /* State save areas ***********************************************************/ - /* The form and content of these fields are processor-specific. */ - - struct xcptcontext xcp; /* Interrupt register save area */ - -#if CONFIG_TASK_NAME_SIZE > 0 - char name[CONFIG_TASK_NAME_SIZE]; /* Task name */ -#endif - -}; - -/* Certain other header files may also define this time to avoid circular header - * file inclusion issues. - */ - -#ifndef __TCB_DEFINED__ -typedef struct _TCB _TCB; -#define __TCB_DEFINED__ -#endif - -/* This is the callback type used by sched_foreach() */ - -typedef void (*sched_foreach_t)(FAR _TCB *tcb, FAR void *arg); - -#endif /* __ASSEMBLY__ */ - -/******************************************************************************** - * Public Data - ********************************************************************************/ - -#ifndef __ASSEMBLY__ -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" -{ -#else -#define EXTERN extern -#endif - -/******************************************************************************** - * Public Function Prototypes - ********************************************************************************/ - -/* TCB helpers */ - -FAR _TCB *sched_self(void); - -/* File system helpers */ - -#if CONFIG_NFILE_DESCRIPTORS > 0 -FAR struct filelist *sched_getfiles(void); -#if CONFIG_NFILE_STREAMS > 0 -FAR struct streamlist *sched_getstreams(void); -#endif /* CONFIG_NFILE_STREAMS */ -#endif /* CONFIG_NFILE_DESCRIPTORS */ - -#if CONFIG_NSOCKET_DESCRIPTORS > 0 -FAR struct socketlist *sched_getsockets(void); -#endif /* CONFIG_NSOCKET_DESCRIPTORS */ - -/* Setup up a start hook */ - -#ifdef CONFIG_SCHED_STARTHOOK -void task_starthook(FAR _TCB *tcb, starthook_t starthook, FAR void *arg); -#endif - -/* Internal vfork support.The overall sequence is: - * - * 1) User code calls vfork(). vfork() is provided in architecture-specific - * code. - * 2) vfork()and calls task_vforksetup(). - * 3) task_vforksetup() allocates and configures the child task's TCB. This - * consists of: - * - Allocation of the child task's TCB. - * - Initialization of file descriptors and streams - * - Configuration of environment variables - * - Setup the intput parameters for the task. - * - Initialization of the TCB (including call to up_initial_state() - * 4) vfork() provides any additional operating context. vfork must: - * - Allocate and initialize the stack - * - Initialize special values in any CPU registers that were not - * already configured by up_initial_state() - * 5) vfork() then calls task_vforkstart() - * 6) task_vforkstart() then executes the child thread. - * - * task_vforkabort() may be called if an error occurs between steps 3 and 6. - */ - -FAR _TCB *task_vforksetup(start_t retaddr); -pid_t task_vforkstart(FAR _TCB *child); -void task_vforkabort(FAR _TCB *child, int errcode); - -/* sched_foreach will enumerate over each task and provide the - * TCB of each task to a user callback functions. Interrupts - * will be disabled throughout this enumeration! - */ - -void sched_foreach(sched_foreach_t handler, FAR void *arg); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif -#endif /* __ASSEMBLY__ */ - -#endif /* __INCLUDE_NUTTX_SCHED_H */ diff --git a/nuttx/include/nuttx/scsi.h b/nuttx/include/nuttx/scsi.h deleted file mode 100644 index 6d0aa5b20..000000000 --- a/nuttx/include/nuttx/scsi.h +++ /dev/null @@ -1,1013 +0,0 @@ -/**************************************************************************** - * include/nuttx/scsi.h - * - * Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * References: - * "SCSI Primary Commands - 3 (SPC-3)," American National Standard - * for Information Technology, May 4, 2005 - * - * "SCSI Primary Commands - 4 (SPC-4)," American National Standard - * for Information Technology, July 19, 2008 - * - * "SCSI Block Commands -2 (SBC-2)," American National Standard - * for Information Technology, November 13, 2004 - * - * "SCSI Multimedia Commands - 3 (MMC-3)," American National Standard - * for Information Technology, November 12, 2001 - * - * 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_NUTTX_SCSI_H -#define __INCLUDE_NUTTX_SCSI_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/* SCSI commands ************************************************************/ - -#define SCSI_CMD_TESTUNITREADY 0x00 -#define SCSI_CMD_REZEROUNIT 0x01 -#define SCSI_CMD_REQUESTSENSE 0x03 -#define SCSI_CMD_FORMAT_UNIT 0x04 -#define SCSI_CMD_REASSIGNBLOCKS 0x07 -#define SCSI_CMD_READ6 0x08 -#define SCSI_CMD_WRITE6 0x0a -#define SCSI_CMD_SEEK6 0x0b -#define SCSI_CMD_SPACE6 0x11 -#define SCSI_CMD_INQUIRY 0x12 -#define SCSI_CMD_MODESELECT6 0x15 -#define SCSI_CMD_RESERVE6 0x16 -#define SCSI_CMD_RELEASE6 0x17 -#define SCSI_CMD_COPY 0x18 -#define SCSI_CMD_MODESENSE6 0x1a -#define SCSI_CMD_STARTSTOPUNIT 0x1b -#define SCSI_CMD_RECEIVEDIAGNOSTICRESULTS 0x1c -#define SCSI_CMD_SENDDIAGNOSTIC 0x1d -#define SCSI_CMD_PREVENTMEDIAREMOVAL 0x1e -#define SCSI_CMD_READFORMATCAPACITIES 0x23 -#define SCSI_CMD_READCAPACITY10 0x25 -#define SCSI_CMD_READ10 0x28 -#define SCSI_CMD_WRITE10 0x2a -#define SCSI_CMD_SEEK10 0x2b -#define SCSI_CMD_WRITEANDVERIFY 0x2e -#define SCSI_CMD_VERIFY10 0x2f -#define SCSI_CMD_SEARCHDATAHIGH 0x30 -#define SCSI_CMD_SEARCHDATAEQUAL 0x31 -#define SCSI_CMD_SEARCHDATALOW 0x32 -#define SCSI_CMD_SETLIMITS10 0x33 -#define SCSI_CMD_PREFETCH10 0x34 -#define SCSI_CMD_SYNCHCACHE10 0x35 -#define SCSI_CMD_LOCKCACHE 0x36 -#define SCSI_CMD_READDEFECTDATA10 0x37 -#define SCSI_CMD_COMPARE 0x39 -#define SCSI_CMD_COPYANDVERIFY 0x3a -#define SCSI_CMD_WRITEBUFFER 0x3b -#define SCSI_CMD_READBUFFER 0x3c -#define SCSI_CMD_READLONG10 0x3e -#define SCSI_CMD_WRITELONG10 0x3f -#define SCSI_CMD_CHANGEDEFINITION 0x40 -#define SCSI_CMD_WRITESAME10 0x41 -#define SCSI_CMD_LOGSELECT 0x4c -#define SCSI_CMD_LOGSENSE 0x4d -#define SCSI_CMD_XDWRITE10 0x50 -#define SCSI_CMD_XPWRITE10 0x51 -#define SCSI_CMD_XDREAD10 0x52 -#define SCSI_CMD_MODESELECT10 0x55 -#define SCSI_CMD_RESERVE10 0x56 -#define SCSI_CMD_RELEASE10 0x57 -#define SCSI_CMD_MODESENSE10 0x5a -#define SCSI_CMD_PERSISTENTRESERVEIN 0x5e -#define SCSI_CMD_PERSISTENTRESERVEOUT 0x5f -#define SCSI_CMD_32 0x7f -#define SCSI_CMD_XDWRITEEXTENDED 0x80 -#define SCSI_CMD_REBUILD 0x82 -#define SCSI_CMD_REGENERATE 0x82 -#define SCSI_CMD_EXTENDEDCOPY 0x83 -#define SCSI_CMD_COPYRESULTS 0x84 -#define SCSI_CMD_ACCESSCONTROLIN 0x86 -#define SCSI_CMD_ACCESSCONTROLOUT 0x87 -#define SCSI_CMD_READ16 0x88 -#define SCSI_CMD_WRITE16 0x8a -#define SCSI_CMD_READATTRIBUTE 0x8c -#define SCSI_CMD_WRITEATTRIBUTE 0x8d -#define SCSI_CMD_WRITEANDVERIFY16 0x8e -#define SCSI_CMD_PREFETCH16 0x90 -#define SCSI_CMD_SYNCHCACHE16 0x91 -#define SCSI_CMD_LOCKUNLOCKACACHE 0x92 -#define SCSI_CMD_WRITESAME16 0x93 -#define SCSI_CMD_READCAPACITY16 0x9e -#define SCSI_CMD_READLONG16 0x9e -#define SCSI_CMD_WRITELONG106 0x9f -#define SCSI_CMD_REPORTLUNS 0xa0 -#define SCSI_CMD_MAINTENANCEIN 0xa3 -#define SCSI_CMD_MAINTENANCEOUT 0xa4 -#define SCSI_CMD_MOVEMEDIUM 0xa5 -#define SCSI_CMD_MOVEMEDIUMATTACHED 0xa7 -#define SCSI_CMD_READ12 0xa8 -#define SCSI_CMD_WRITE12 0xaa -#define SCSI_CMD_READMEDIASERIALNUMBER 0xab -#define SCSI_CMD_WRITEANDVERIFY12 0xae -#define SCSI_CMD_VERIFY12 0xaf -#define SCSI_CMD_SETLIMITS12 0xb3 -#define SCSI_CMD_READELEMENTSTATUS 0xb4 -#define SCSI_CMD_READDEFECTDATA12 0xb7 -#define SCSI_CMD_REDUNDANCYGROUPIN 0xba -#define SCSI_CMD_REDUNDANCYGROUPOUT 0xbb -#define SCSI_CMD_SPAREIN 0xbc -#define SCSI_CMD_SPAREOUT 0xbd -#define SCSI_CMD_VOLUMESETIN 0xbe -#define SCSI_CMD_VOLUMESETOUT 0xbf - -/* Common SCSI KCQ values (sense Key/additional sense Code/ASC Qualifier) *** - * - * 0xnn0386 Write Fault Data Corruption - * 0xnn0500 Illegal request - * 0xnn0600 Unit attention - * 0xnn0700 Data protect - * 0xnn0800 LUN communication failure - * 0xnn0801 LUN communication timeout - * 0xnn0802 LUN communication parity error - * 0xnn0803 LUN communication CRC error - * 0xnn0900 vendor specific sense key - * 0xnn0901 servo fault - * 0xnn0904 head select fault - * 0xnn0a00 error log overflow - * 0xnn0b00 aborted command - * 0xnn0c00 write error - * 0xnn0c02 write error - auto-realloc failed - * 0xnn0e00 data miscompare - * 0xnn1200 address mark not founf for ID field - * 0xnn1400 logical block not found - * 0xnn1500 random positioning error - * 0xnn1501 mechanical positioning error - * 0xnn1502 positioning error detected by read of medium - * 0xnn2700 write protected - * 0xnn2900 POR or bus reset occurred - * 0xnn3101 format failed - * 0xnn3191 format corrupted - * 0xnn3201 defect list update error - * 0xnn3202 no spares available - * 0xnn3501 unspecified enclosure services failure - * 0xnn3700 parameter rounded - * 0xnn3d00 invalid bits in identify message - * 0xnn3e00 LUN not self-configured yet - * 0xnn4001 DRAM parity error - * 0xnn4002 DRAM parity error - * 0xnn4200 power-on or self-test failure - * 0xnn4c00 LUN failed self-configuration - * 0xnn5c00 RPL status change - * 0xnn5c01 spindles synchronized - * 0xnn5c02 spindles not synchronized - * 0xnn6500 voltage fault - * 0xnn8000 general firmware error - */ - -/* No sense KCQ values */ - -#define SCSI_KCQ_NOSENSE 0x000000 /* No error */ -#define SCSI_KCQ_PFATHRESHOLDREACHED 0x005c00 /* No sense - PFA threshold reached */ - -/* Soft error KCQ values */ - -#define SCSI_KCQSE_RWENOINDEX 0x010100 /* Recovered Write error - no index */ -#define SCSI_KCQSE_RECOVEREDNOSEEKCOMPLETION 0x010200 /* Recovered no seek completion */ -#define SCSI_KCQSE_RWEWRITEFAULT 0x010300 /* Recovered Write error - write fault */ -#define SCSI_KCQSE_TRACKFOLLOWINGERROR 0x010900 /* Track following error */ -#define SCSI_KCQSE_TEMPERATUREWARNING 0x010b01 /* Temperature warning */ -#define SCSI_KCQSE_RWEWARREALLOCATED 0x010c01 /* Recovered Write error with auto-realloc - reallocated */ -#define SCSI_KCQSE_RWERECOMMENDREASSIGN 0x010c03 /* Recovered Write error - recommend reassign */ -#define SCSI_KCQSE_RDWOEUSINGPREVLBI 0x011201 /* Recovered data without ECC using prev logical block ID */ -#define SCSI_KCQSE_RDWEUSINGPREVLBI 0x011202 /* Recovered data with ECC using prev logical block ID */ -#define SCSI_KCQSE_RECOVEREDRECORDNOTFOUND 0x011401 /* Recovered Record Not Found */ -#define SCSI_KCQSE_RWEDSME 0x011600 /* Recovered Write error - Data Sync Mark Error */ -#define SCSI_KCQSE_RWEDSEDATAREWRITTEN 0x011601 /* Recovered Write error - Data Sync Error - data rewritten */ -#define SCSI_KCQSE_RWEDSERECOMMENDREWRITE 0x011602 /* Recovered Write error - Data Sync Error - recommend rewrite */ -#define SCSI_KCQSE_RWEDSEDATAAUTOREALLOCATED 0x011603 /* Recovered Write error - Data Sync Error - data auto-reallocated */ -#define SCSI_KCQSE_RWEDSERECOMMENDREASSIGNMENT 0x011604 /* Recovered Write error - Data Sync Error - recommend reassignment */ -#define SCSI_KCQSE_RDWNECORRECTIONAPPLIED 0x011700 /* Recovered data with no error correction applied */ -#define SCSI_KCQSE_RREWITHRETRIES 0x011701 /* Recovered Read error - with retries */ -#define SCSI_KCQSE_RDUSINGPOSITIVEOFFSET 0x011702 /* Recovered data using positive offset */ -#define SCSI_KCQSE_RDUSINGNEGATIVEOFFSET 0x011703 /* Recovered data using negative offset */ -#define SCSI_KCQSE_RDUSINGPREVIOUSLBI 0x011705 /* Recovered data using previous logical block ID */ -#define SCSI_KCQSE_RREWOEAUTOREALLOCATED 0x011706 /* Recovered Read error - without ECC, auto reallocated */ -#define SCSI_KCQSE_RREWOERECOMMENDREASSIGN 0x011707 /* Recovered Read error - without ECC, recommend reassign */ -#define SCSI_KCQSE_RREWOERECOMMENDREWRITE 0x011708 /* Recovered Read error - without ECC, recommend rewrite */ -#define SCSI_KCQSE_RREWOEDATAREWRITTEN 0x011709 /* Recovered Read error - without ECC, data rewritten */ -#define SCSI_KCQSE_RREWE 0x011800 /* Recovered Read error - with ECC */ -#define SCSI_KCQSE_RDWEANDRETRIES 0x011801 /* Recovered data with ECC and retries */ -#define SCSI_KCQSE_RREWEAUTOREALLOCATED 0x011802 /* Recovered Read error - with ECC, auto reallocated */ -#define SCSI_KCQSE_RREWERECOMMENDREASSIGN 0x011805 /* Recovered Read error - with ECC, recommend reassign */ -#define SCSI_KCQSE_RDUSINGECCANDOFFSETS 0x011806 /* Recovered data using ECC and offsets */ -#define SCSI_KCQSE_RREWEDATAREWRITTEN 0x011807 /* Recovered Read error - with ECC, data rewritten */ -#define SCSI_KCQSE_DLNOTFOUND 0x011c00 /* Defect List not found */ -#define SCSI_KCQSE_PRIMARYDLNOTFOUND 0x011c01 /* Primary defect list not found */ -#define SCSI_KCQSE_GROWNDLNOTFOUND 0x011c02 /* Grown defect list not found */ -#define SCSI_KCQSE_PARTIALDLTRANSFERRED 0x011f00 /* Partial defect list transferred */ -#define SCSI_KCQSE_INTERNALTARGETFAILURE 0x014400 /* Internal target failure */ -#define SCSI_KCQSE_PFATHRESHOLDREACHED 0x015d00 /* PFA threshold reached */ -#define SCSI_KCQSE_PFATESTWARNING 0x015dff /* PFA test warning */ -#define SCSI_KCQSE_INTERNALLOGICFAILURE 0x018100 /* Internal logic failure */ - -/* Not Ready / Diagnostic Failure KCQ values */ - -#define SCSI_KCQNR_CAUSENOTREPORTABLE 0x020400 /* Not Ready - Cause not reportable. */ -#define SCSI_KCQNR_BECOMINGREADY 0x020401 /* Not Ready - becoming ready */ -#define SCSI_KCQNR_NEEDINITIALIZECOMMAND 0x020402 /* Not Ready - need initialize command (start unit) */ -#define SCSI_KCQNR_MANUALINTERVENTIONREQUIRED 0x020403 /* Not Ready - manual intervention required */ -#define SCSI_KCQNR_FORMATINPROGRESS 0x020404 /* Not Ready - format in progress */ -#define SCSI_KCQNR_SELFTESTINPROGRESS 0x020409 /* Not Ready - self-test in progress */ -#define SCSI_KCQNR_MEDIUMFORMATCORRUPTED 0x023100 /* Not Ready - medium format corrupted */ -#define SCSI_KCQNR_FORMATCOMMANDFAILED 0x023101 /* Not Ready - format command failed */ -#define SCSI_KCQNR_ESUNAVAILABLE 0x023502 /* Not Ready - enclosure services unavailable */ -#define SCSI_KCQNR_MEDIANOTPRESENT 0x023a00 /* Not Ready - media not present */ -#define SCSI_KCQDF_BRINGUPFAILORDEGRADEDMODE 0x024080 /* Diagnostic Failure - bring-up fail or degraded mode */ -#define SCSI_KCQDF_HARDDISKCONTROLLER 0x024081 /* Diagnostic Failure - Hard Disk Controller */ -#define SCSI_KCQDF_RAMMICROCODENOTLOADED 0x024085 /* Diagnostic Failure - RAM microcode not loaded */ -#define SCSI_KCQDF_RROCALIBRATION 0x024090 /* Diagnostic Failure - RRO Calibration */ -#define SCSI_KCQDF_CHANNELCALIBRATION 0x024091 /* Diagnostic Failure - Channel Calibration */ -#define SCSI_KCQDF_HEADLOAD 0x024092 /* Diagnostic Failure - Head Load */ -#define SCSI_KCQDF_WRITEAE 0x024093 /* Diagnostic Failure - Write AE */ -#define SCSI_KCQDF_12VOVERCURRENT 0x024094 /* Diagnostic Failure - 12V over current */ -#define SCSI_KCQDF_OTHERSPINDLEFAILURE 0x024095 /* Diagnostic Failure - Other spindle failure */ -#define SCSI_KCQDF_SELFRESET 0x0240b0 /* Diagnostic Failure - self-reset */ -#define SCSI_KCQDF_CONFIGNOTLOADED 0x024c00 /* Diagnostic Failure - config not loaded */ - -/* Medium error KCQ values */ - -#define SCSI_KCQME_WRITEFAULT 0x030300 /* Medium Error - write fault */ -#define SCSI_KCQME_WRITEFAULTAUTOREALLOCFAILED 0x030c02 /* Medium Error - write error - auto-realloc failed */ -#define SCSI_KCQME_WRITERTLIMITEXCEEDED 0x030cbb /* Medium Error - write recovery time limit exceeded */ -#define SCSI_KCQME_IDCRCERROR 0x031000 /* Medium Error - ID CRC error */ -#define SCSI_KCQME_UNRRE1 0x031100 /* Medium Error - unrecovered read error */ -#define SCSI_KCQME_READRETRIESEXHAUSTED 0x031101 /* Medium Error - read retries exhausted */ -#define SCSI_KCQME_ERRORTOOLONGTOCORRECT 0x031102 /* Medium Error - error too long to correct */ -#define SCSI_KCQME_UREAUTOREALLOCFAILED 0x031104 /* Medium Error - unrecovered read error - auto re-alloc failed */ -#define SCSI_KCQME_URERECOMMENDREASSIGN 0x03110b /* Medium Error - unrecovered read error - recommend reassign */ -#define SCSI_KCQME_READRTLIMITEXCEEDED 0x0311ff /* Medium Error - read recovery time limit exceeded */ -#define SCSI_KCQME_RECORDNOTFOUND 0x031401 /* Medium Error - record not found */ -#define SCSI_KCQME_DSME 0x031600 /* Medium Error - Data Sync Mark error */ -#define SCSI_KCQME_DSERECOMMENDREASSIGN 0x031604 /* Medium Error - Data Sync Error - recommend reassign */ -#define SCSI_KCQME_DLE 0x031900 /* Medium Error - defect list error */ -#define SCSI_KCQME_DLNOTAVAILABLE 0x031901 /* Medium Error - defect list not available */ -#define SCSI_KCQME_DLEINPRIMARYLIST 0x031902 /* Medium Error - defect list error in primary list */ -#define SCSI_KCQME_DLEINGROWNLIST 0x031903 /* Medium Error - defect list error in grown list */ -#define SCSI_KCQME_FEWERTHAN50PCTDLCOPIES 0x03190e /* Medium Error - fewer than 50% defect list copies */ -#define SCSI_KCQME_MEDIUMFORMATCORRUPTED 0x033100 /* Medium Error - medium format corrupted */ -#define SCSI_KCQME_FORMATCOMMANDFAILED 0x033101 /* Medium Error - format command failed */ -#define SCSI_KCQME_DATAAUTOREALLOCATED 0x038000 /* Medium Error - data auto-reallocated */ - -/* Hardware Error KCQ values */ - -#define SCSI_KCQHE_NOINDEXORSECTOR 0x040100 /* Hardware Error - no index or sector */ -#define SCSI_KCQHE_NOSEEKCOMPLETE 0x040200 /* Hardware Error - no seek complete */ -#define SCSI_KCQHE_WRITEFAULT 0x040300 /* Hardware Error - write fault */ -#define SCSI_KCQHE_COMMUNICATIONFAILURE 0x040800 /* Hardware Error - communication failure */ -#define SCSI_KCQHE_TRACKFOLLOWINGERROR 0x040900 /* Hardware Error - track following error */ -#define SCSI_KCQHE_UREINRESERVEDAREA 0x041100 /* Hardware Error - unrecovered read error in reserved area */ -#define SCSI_KCQHE_DSMEINRESERVEDAREA 0x041600 /* Hardware Error - Data Sync Mark error in reserved area */ -#define SCSI_KCQHE_DLE 0x041900 /* Hardware Error - defect list error */ -#define SCSI_KCQHE_DLEINPRIMARYLIST 0x041902 /* Hardware Error - defect list error in Primary List */ -#define SCSI_KCQHE_DLEINGROWNLIST 0x041903 /* Hardware Error - defect list error in Grown List */ -#define SCSI_KCQHE_REASSIGNFAILED 0x043100 /* Hardware Error - reassign failed */ -#define SCSI_KCQHE_NODEFECTSPAREAVAILABLE 0x043200 /* Hardware Error - no defect spare available */ -#define SCSI_KCQHE_UNSUPPORTEDENCLOSUREFUNCTION 0x043501 /* Hardware Error - unsupported enclosure function */ -#define SCSI_KCQHE_ESUNAVAILABLE 0x043502 /* Hardware Error - enclosure services unavailable */ -#define SCSI_KCQHE_ESTRANSFERFAILURE 0x043503 /* Hardware Error - enclosure services transfer failure */ -#define SCSI_KCQHE_ESREFUSED 0x043504 /* Hardware Error - enclosure services refused */ -#define SCSI_KCQHE_SELFTESTFAILED 0x043e03 /* Hardware Error - self-test failed */ -#define SCSI_KCQHE_UNABLETOUPDATESELFTEST 0x043e04 /* Hardware Error - unable to update self-test */ -#define SCSI_KCQHE_DMDIAGNOSTICFAIL 0x044080 /* Hardware Error - Degrade Mode. Diagnostic Fail */ -#define SCSI_KCQHE_DMHWERROR 0x044081 /* Hardware Error - Degrade Mode. H/W Error */ -#define SCSI_KCQHE_DMRAMMICROCODENOTLOADED 0x044085 /* Hardware Error - Degrade Mode. RAM microcode not loaded */ -#define SCSI_KCQHE_SEEKTESTFAILURE 0x044090 /* Hardware Error - seek test failure */ -#define SCSI_KCQHE_READWRITETESTFAILURE 0x0440a0 /* Hardware Error - read/write test failure */ -#define SCSI_KCQHE_DEVICESELFRESET 0x0440b0 /* Hardware Error - device self-reset */ -#define SCSI_KCQHE_COMPONENTMISMATCH 0x0440d0 /* Hardware Error - component mismatch */ -#define SCSI_KCQHE_INTERNALTARGETFAILURE 0x044400 /* Hardware Error - internal target failure */ -#define SCSI_KCQHE_INTERNALLOGICERROR 0x048100 /* Hardware Error - internal logic error */ -#define SCSI_KCQHE_COMMANDTIMEOUT 0x048200 /* Hardware Error - command timeout */ - -/* Illegal Request KCQ values */ - -#define SCSI_KCQIR_PARMLISTLENGTHERROR 0x051a00 /* Illegal Request - parm list length error */ -#define SCSI_KCQIR_INVALIDCOMMAND 0x052000 /* Illegal Request - invalid/unsupported command code */ -#define SCSI_KCQIR_LBAOUTOFRANGE 0x052100 /* Illegal Request - LBA out of range */ -#define SCSI_KCQIR_INVALIDFIELDINCBA 0x052400 /* Illegal Request - invalid field in CDB (Command Descriptor Block) */ -#define SCSI_KCQIR_INVALIDLUN 0x052500 /* Illegal Request - invalid LUN */ -#define SCSI_KCQIR_INVALIDFIELDSINPARMLIST 0x052600 /* Illegal Request - invalid fields in parm list */ -#define SCSI_KCQIR_PARAMETERNOTSUPPORTED 0x052601 /* Illegal Request - parameter not supported */ -#define SCSI_KCQIR_INVALIDPARMVALUE 0x052602 /* Illegal Request - invalid parm value */ -#define SCSI_KCQIR_IFPTHRESHOLDPARAMETER 0x052603 /* Illegal Request - invalid field parameter - threshold parameter */ -#define SCSI_KCQIR_INVALIDRELEASEOFPR 0x052604 /* Illegal Request - invalid release of persistent reservation */ -#define SCSI_KCQIR_IFPTMSFIRMWARETAG 0x052697 /* Illegal Request - invalid field parameter - TMS firmware tag */ -#define SCSI_KCQIR_IFPCHECKSUM 0x052698 /* Illegal Request - invalid field parameter - check sum */ -#define SCSI_KCQIR_IFPFIRMWARETAG 0x052699 /* Illegal Request - invalid field parameter - firmware tag */ -#define SCSI_KCQIR_COMMANDSEQUENCEERROR 0x052c00 /* Illegal Request - command sequence error */ -#define SCSI_KCQIR_UNSUPPORTEDENCLOSUREFUNCTION 0x053501 /* Illegal Request - unsupported enclosure function */ -#define SCSI_KCQIR_SAVINGPARMSNOTSUPPORTED 0x053900 /* Illegal Request - Saving parameters not supported */ -#define SCSI_KCQIR_INVALIDMESSAGE 0x054900 /* Illegal Request - invalid message */ -#define SCSI_KCQIR_MEDIALOADOREJECTFAILED 0x055300 /* Illegal Request - media load or eject failed */ -#define SCSI_KCQIR_UNLOADTAPEFAILURE 0x055301 /* Illegal Request - unload tape failure */ -#define SCSI_KCQIR_MEDIUMREMOVALPREVENTED 0x055302 /* Illegal Request - medium removal prevented */ -#define SCSI_KCQIR_SYSTEMRESOURCEFAILURE 0x055500 /* Illegal Request - system resource failure */ -#define SCSI_KCQIR_SYSTEMBUFFERFULL 0x055501 /* Illegal Request - system buffer full */ -#define SCSI_KCQIR_INSUFFICIENTRR 0x055504 /* Illegal Request - Insufficient Registration Resources */ - -/* Unit Attention KCQ values */ - -#define SCSI_KCQUA_NOTREADYTOTRANSITION 0x062800 /* Unit Attention - not-ready to ready transition (format complete) */ -#define SCSI_KCQUA_DEVICERESETOCCURRED 0x062900 /* Unit Attention - POR or device reset occurred */ -#define SCSI_KCQUA_POROCCURRED 0x062901 /* Unit Attention - POR occurred */ -#define SCSI_KCQUA_SCSIBUSRESETOCCURRED 0x062902 /* Unit Attention - SCSI bus reset occurred */ -#define SCSI_KCQUA_TARGETRESETOCCURRED 0x062903 /* Unit Attention - TARGET RESET occurred */ -#define SCSI_KCQUA_SELFINITIATEDRESETOCCURRED 0x062904 /* Unit Attention - self-initiated-reset occurred */ -#define SCSI_KCQUA_TRANSCEIVERMODECHANGETOSE 0x062905 /* Unit Attention - transceiver mode change to SE */ -#define SCSI_KCQUA_TRANSCEIVERMODECHANGETOLVD 0x062906 /* Unit Attention - transceiver mode change to LVD */ -#define SCSI_KCQUA_PARAMETERSCHANGED 0x062a00 /* Unit Attention - parameters changed */ -#define SCSI_KCQUA_MODEPARAMETERSCHANGED 0x062a01 /* Unit Attention - mode parameters changed */ -#define SCSI_KCQUA_LOGSELECTPARMSCHANGED 0x062a02 /* Unit Attention - log select parms changed */ -#define SCSI_KCQUA_RESERVATIONSPREEMPTED 0x062a03 /* Unit Attention - Reservations pre-empted */ -#define SCSI_KCQUA_RESERVATIONSRELEASED 0x062a04 /* Unit Attention - Reservations released */ -#define SCSI_KCQUA_REGISTRATIONSPREEMPTED 0x062a05 /* Unit Attention - Registrations pre-empted */ -#define SCSI_KCQUA_COMMANDSCLEARED 0x062f00 /* Unit Attention - commands cleared by another initiator */ -#define SCSI_KCQUA_OPERATINGCONDITIONSCHANGED 0x063f00 /* Unit Attention - target operating conditions have changed */ -#define SCSI_KCQUA_MICROCODECHANGED 0x063f01 /* Unit Attention - microcode changed */ -#define SCSI_KCQUA_CHANGEDOPERATINGDEFINITION 0x063f02 /* Unit Attention - changed operating definition */ -#define SCSI_KCQUA_INQUIRYPARAMETERSCHANGED 0x063f03 /* Unit Attention - inquiry parameters changed */ -#define SCSI_KCQUA_DEVICEIDENTIFIERCHANGED 0x063f05 /* Unit Attention - device identifier changed */ -#define SCSI_KCQUA_INVALIDAPMPARAMETERS 0x063f90 /* Unit Attention - invalid APM parameters */ -#define SCSI_KCQUA_WORLDWIDENAMEMISMATCH 0x063f91 /* Unit Attention - world-wide name mismatch */ -#define SCSI_KCQUA_PFATHRESHOLDREACHED 0x065d00 /* Unit Attention - PFA threshold reached */ -#define SCSI_KCQUA_PFATHRESHOLDEXCEEDED 0x065dff /* Unit Attention - PFA threshold exceeded */ - -/* Write Protect KCQ values */ - -#define SCSI_KCQWP_COMMANDNOTALLOWED 0x072700 /* Write Protect - command not allowed */ - -/* Aborted Command KCQ values */ - -#define SCSI_KCQAC_NOADDITIONALSENSECODE 0x0b0000 /* Aborted Command - no additional sense code */ -#define SCSI_KCQAC_SYNCDATATRANSFERERROR 0x0b1b00 /* Aborted Command - sync data transfer error (extra ACK) */ -#define SCSI_KCQAC_UNSUPPORTEDLUN 0x0b2500 /* Aborted Command - unsupported LUN */ -#define SCSI_KCQAC_ECHOBUFFEROVERWRITTEN 0x0b3f0f /* Aborted Command - echo buffer overwritten */ -#define SCSI_KCQAC_MESSAGEREJECTERROR 0x0b4300 /* Aborted Command - message reject error */ -#define SCSI_KCQAC_INTERNALTARGETFAILURE 0x0b4400 /* Aborted Command - internal target failure */ -#define SCSI_KCQAC_SELECTIONFAILURE 0x0b4500 /* Aborted Command - Selection/Reselection failure */ -#define SCSI_KCQAC_SCSIPARITYERROR 0x0b4700 /* Aborted Command - SCSI parity error */ -#define SCSI_KCQAC_INITIATORDETECTEDERRORECEIVED 0x0b4800 /* Aborted Command - initiator-detected error message received */ -#define SCSI_KCQAC_ILLEGALMESSAGE 0x0b4900 /* Aborted Command - inappropriate/illegal message */ -#define SCSI_KCQAC_DATAPHASEERROR 0x0b4b00 /* Aborted Command - data phase error */ -#define SCSI_KCQAC_OVERLAPPEDCOMMANDSATTEMPTED 0x0b4e00 /* Aborted Command - overlapped commands attempted */ -#define SCSI_KCQAC_LOOPINITIALIZATION 0x0b4f00 /* Aborted Command - due to loop initialization */ - -/* Other KCQ values: */ - -#define SCSO_KCQOTHER_MISCOMPARE 0x0e1d00 /* Miscompare - during verify byte check operation */ - -/* SSCSI Status Codes *******************************************************/ - -#define SCSI_STATUS_OK 0x00 /* OK */ -#define SCSI_STATUS_CHECKCONDITION 0x02 /* Check condition */ -#define SCSI_STATUS_CONDITIONMET 0x04 /* Condition met */ -#define SCSI_STATUS_BUSY 0x08 /* Busy */ -#define SCSI_STATUS_INTERMEDIATE 0x10 /* Intermediate */ -#define SCSI_STATUS_DATAOVERUNDERRUN 0x12 /* Data Under/Over Run? */ -#define SCSI_STATUS_INTERMEDIATECONDITIONMET 0x14 /* Intermediate - Condition met */ -#define SCSI_STATUS_RESERVATIONCONFLICT 0x18 /* Reservation conflict */ -#define SCSI_STATUS_COMMANDTERMINATED 0x22 /* Command terminated */ -#define SCSI_STATUS_QUEUEFULL 0x28 /* Queue (task set) full */ -#define SCSI_STATUS_ACAACTIVE 0x30 /* ACA active */ -#define SCSI_STATUS_TASKABORTED 0x40 /* Task aborted */ - -/* Definitions for selected SCSI commands ***********************************/ - -/* Inquiry */ - -#define SCSICMD_INQUIRYFLAGS_EVPD 0x01 /* Bit 0: EVPD */ - /* Bits 5-7: Peripheral Qualifier */ -#define SCSIRESP_INQUIRYPQ_CONNECTED 0x00 /* 000: Device is connected */ -#define SCSIRESP_INQUIRYPQ_NOTCONNECTED 0x20 /* 001: Device is NOT connected */ -#define SCSIRESP_INQUIRYPQ_NOTCAPABLE 0x60 /* 011: LUN not supported */ - /* Bits 0-4: Peripheral Device */ -#define SCSIRESP_INQUIRYPD_DIRECTACCESS 0x00 /* Direct-access block device */ -#define SCSIRESP_INQUIRYPD_SEQUENTIALACCESS 0x01 /* Sequential-access block device */ -#define SCSIRESP_INQUIRYPD_PRINTER 0x02 /* Printer device */ -#define SCSIRESP_INQUIRYPD_PROCESSOR 0x03 /* Processor device */ -#define SCSIRESP_INQUIRYPD_WRONCE 0x04 /* Write once device */ -#define SCSIRESP_INQUIRYPD_CDDVD 0x05 /* CD/DVD device */ -#define SCSIRESP_INQUIRYPD_SCANNER 0x06 /* Scanner device (obsolete) */ -#define SCSIRESP_INQUIRYPD_OPTICAL 0x07 /* Optical memory device */ -#define SCSIRESP_INQUIRYPD_MEDIUMCHANGER 0x08 /* Medium changer device (Jukebox) */ -#define SCSIRESP_INQUIRYPD_COMMUNICATIONS 0x09 /* Communications device (obsolete) */ -#define SCSIRESP_INQUIRYPD_STORAGEARRAY 0x0c /* Storage array controller device */ -#define SCSIRESP_INQUIRYPD_ENCLOSURESERVICES 0x0d /* Enclosure services device */ -#define SCSIRESP_INQUIRYPD_RBC 0x0e /* Simplified direct-access device */ -#define SCSIRESP_INQUIRYPD_OCRW 0x0f /* Optical reader/writer device */ -#define SCSIRESP_INQUIRYPD_BCC 0x10 /* Bridge controller commands */ -#define SCSIRESP_INQUIRYPD_OSD 0x11 /* Object-based storage device */ -#define SCSIRESP_INQUIRYPD_ADC 0x12 /* Automation/drive interface */ -#define SCSIRESP_INQUIRYPD_WKLU 0x1e /* Well-known logical unit */ -#define SCSIRESP_INQUIRYPD_UNKNOWN 0x1f /* Direct-access block device */ - -#define SCSIRESP_INQUIRYFLAGS1_RMB 0x80 /* Bit 7: RMB */ -#define SCSIRESP_INQUIRYFLAGS2_NORMACA 0x20 /* Bit 5: NormACA */ -#define SCSIRESP_INQUIRYFLAGS2_HISUP 0x10 /* Bit 4: HiSup */ -#define SCSIRESP_INQUIRYFLAGS2_FMTMASK 0x0f /* Bits 0-3: Response data format */ - -#define SCSIRESP_INQUIRYFLAGS3_SCCS 0x80 /* Bit 8: SCCS */ -#define SCSIRESP_INQUIRYFLAGS3_ACC 0x40 /* Bit 7: ACC */ -#define SCSIRESP_INQUIRYFLAGS3_TPGSMASK 0x30 /* Bits 4-5: TPGS */ -#define SCSIRESP_INQUIRYFLAGS3_3PC 0x08 /* Bit 3: 3PC */ -#define SCSIRESP_INQUIRYFLAGS3_PROTECT 0x01 /* Bit 0: Protect */ - -#define SCSIRESP_INQUIRYFLAGS4_BQUE 0x80 /* Bit 7: BQue */ -#define SCSIRESP_INQUIRYFLAGS4_ENCSERV 0x40 /* Bit 6: EncServ */ -#define SCSIRESP_INQUIRYFLAGS4_VS 0x20 /* Bit 5: VS */ -#define SCSIRESP_INQUIRYFLAGS4_MULTIP 0x10 /* Bit 4: MultIP */ -#define SCSIRESP_INQUIRYFLAGS4_MCHNGR 0x08 /* Bit 3: MChngr */ -#define SCSIRESP_INQUIRYFLAGS4_ADDR16 0x01 /* Bit 0: Addr16 */ - -#define SCSIRESP_INQUIRYFLAGS5_WBUS16 0x20 /* Bit 5: WBus16 */ -#define SCSIRESP_INQUIRYFLAGS5_SYNC 0x10 /* Bit 4: SYNC */ -#define SCSIRESP_INQUIRYFLAGS5_LINKED 0x08 /* Bit 3: LINKED */ -#define SCSIRESP_INQUIRYFLAGS5_CMDQUEUE 0x02 /* Bit 1: CmdQue */ -#define SCSIRESP_INQUIRYFLAGS5_VS 0x01 /* Bit 0: VS */ - -#define SCSIRESP_INQUIRYFLAGS6_CLOCKINGMASK 0xc0 /* Bits 2-3: Clocking */ -#define SCSIRESP_INQUIRYFLAGS6_QAS 0x02 /* Bit 1: QAS */ -#define SCSIRESP_INQUIRYFLAGS6_IUS 0x01 /* Bit 0: IUS */ - -/* Sense data */ -/* Sense data response codes */ - -#define SCSIRESP_SENSEDATA_CURRENTFIXED 0x70 /* Byte 1 is always the response code */ -#define SCSIRESP_SENSEDATA_DEFERREDFIXED 0x71 -#define SCSIRESP_SENSEDATA_CURRENTDESC 0x72 -#define SCSIRESP_SENSEDATA_DEFERREDDESC 0x73 - -#define SCSIRESP_SENSEDATA_RESPVALID 0x80 - -/* Fixed sense data flags */ - -#define SCSIRESP_SENSEDATA_FILEMARK 0x80 /* Bit 7: FileMark */ -#define SCSIRESP_SENSEDATA_EOM 0x40 /* Bit 6: EOM */ -#define SCSIRESP_SENSEDATA_ILI 0x20 /* Bit 5: ILI */ -#define SCSIRESP_SENSEDATA_SENSEKEYMASK 0x0f /* Bits 0-3: Sense key */ -#define SCSIRESP_SENSEDATA_NOSENSE 0x00 /* Nothing to be reported */ -#define SCSIRESP_SENSEDATA_RECOVEREDERROR 0x01 /* Successful after recovery action */ -#define SCSIRESP_SENSEDATA_NOTREADY 0x02 /* Logical unit is not accessible */ -#define SCSIRESP_SENSEDATA_MEDIUMERROR 0x03 /* Error posssibly caused by flaw in medium */ -#define SCSIRESP_SENSEDATA_HARDWAREERROR 0x04 /* Non-recoverable hardware error */ -#define SCSIRESP_SENSEDATA_ILLEGALREQUEST 0x05 /* Error in recived request */ -#define SCSIRESP_SENSEDATA_UNITATTENTION 0x06 /* Unit attention condition */ -#define SCSIRESP_SENSEDATA_DATAPROTECT 0x07 /* Action failed, medium protected */ -#define SCSIRESP_SENSEDATA_BLANKCHECK 0x08 /* Encountered blank media */ -#define SCSIRESP_SENSEDATA_VENDORSPECIFIC 0x09 /* Vendor specific condition */ -#define SCSIRESP_SENSEDATA_ABORTEDCOMMAND 0x0b /* Command was aborted */ - -#define SCSIRESP_SENSEDATA_KEYVALID 0x80 /* Sense-specific data valid */ - -/* Mode Select 6 */ - -#define SCSICMD_MODESELECT6_PF 0x10 /* Bit 4: PF */ -#define SCSICMD_MODESELECT6_SP 0x01 /* Bit 0: SP */ - -/* Mode Sense 6 */ - -#define SCSICMD_MODESENSE6_DBD 0x08 /* Bit 3: PF */ - -#define SCSICMD_MODESENSE_PCMASK 0xc0 /* Bits 6-7: Page control (PC) */ -#define SCSICMD_MODESENSE_PCCURRENT 0x00 /* Current values */ -#define SCSICMD_MODESENSE_PCCHANGEABLE 0x40 /* Changeable values */ -#define SCSICMD_MODESENSE_PCDEFAULT 0x80 /* Default values */ -#define SCSICMD_MODESENSE_PCSAVED 0xc0 /* Saved values */ -#define SCSICMD_MODESENSE_PGCODEMASK 0x3f /* Bits 0-5: Page code */ - -#define SCSICMD_MODESENSE6_PCDEFAULT 0x80 /* Default values */ - /* Direct-access device page codes */ -#define SCSIRESP_MODESENSE_PGCCODE_VENDOR 0x00 /* Vendor-specific */ -#define SCSIRESP_MODESENSE_PGCCODE_RWERROR 0x01 /* Read/Write error recovery mode page */ -#define SCSIRESP_MODESENSE_PGCCODE_RECONNECT 0x02 /* Disconnect-reconnect mode page */ -#define SCSIRESP_MODESENSE_PGCCODE_FORMATDEV 0x03 /* Format device mode page (obsolete) */ -#define SCSIRESP_MODESENSE_PGCCODE_RIGID 0x04 /* Rigid disk geometry mode page (obsolete) */ -#define SCSIRESP_MODESENSE_PGCCODE_FLEXIBLE 0x05 /* Flexible disk geometry mode page (obsolete) */ -#define SCSIRESP_MODESENSE_PGCCODE_VERIFY 0x07 /* Verify error recovery mode page */ -#define SCSIRESP_MODESENSE_PGCCODE_CACHING 0x08 /* Caching mode page */ -#define SCSIRESP_MODESENSE_PGCCODE_CONTROL 0x0a /* Control mode page (0x0a/0x00) */ -#define SCSIRESP_MODESENSE_PGCCODE_CONTROLEXT 0x0a /* Control extension mode page (0x0a/0x01) */ -#define SCSIRESP_MODESENSE_PGCCODE_MEDIUMTYPES 0x0b /* Medum types supported mode page (obsolete) */ -#define SCSIRESP_MODESENSE_PGCCODE_NP 0x0c /* Notch and partition mode page (obsolete) */ -#define SCSIRESP_MODESENSE_PGCCODE_XOR 0x10 /* XOR control mode page */ -#define SCSIRESP_MODESENSE_PGCCODE_ES 0x14 /* Enclosure services mode page */ -#define SCSIRESP_MODESENSE_PGCCODE_PSLUN 0x18 /* Protocol-specific LUN mode page */ -#define SCSIRESP_MODESENSE_PGCCODE_PSPORT 0x19 /* Protocol-specific port mode page */ -#define SCSIRESP_MODESENSE_PGCCODE_POWER 0x1a /* Power condition mode page */ -#define SCSIRESP_MODESENSE_PGCCODE_IE 0x1c /* Informational exceptions control mode page (0x1c/0x00) */ -#define SCSIRESP_MODESENSE_PGCCODE_BC 0x1c /* Background control mode page (0x1c/0x01) */ -#define SCSIRESP_MODESENSE_PGCCODE_RETURNALL 0x3f /* Return all mode pages */ - /* Direct-access caching mode page */ -#define SCSIRESP_CACHINGMODEPG_PS 0x80 /* Byte 0, Bit 7: PS */ -#define SCSIRESP_CACHINGMODEPG_SPF 0x60 /* Byte 0, Bit 6: SPF */ -#define SCSIRESP_CACHINGMODEPG_IC 0x80 /* Byte 2, Bit 7: IC */ -#define SCSIRESP_CACHINGMODEPG_ABPF 0x40 /* Byte 2, Bit 6: ABPF */ -#define SCSIRESP_CACHINGMODEPG_CAP 0x20 /* Byte 2, Bit 5: CAP */ -#define SCSIRESP_CACHINGMODEPG_DISC 0x10 /* Byte 2, Bit 4: DISC */ -#define SCSIRESP_CACHINGMODEPG_SIZE 0x08 /* Byte 2, Bit 3: SIZE */ -#define SCSIRESP_CACHINGMODEPG_WCE 0x04 /* Byte 2, Bit 2: Write cache enable (WCE) */ -#define SCSIRESP_CACHINGMODEPG_MF 0x02 /* Byte 2, Bit 1: MF */ -#define SCSIRESP_CACHINGMODEPG_RCD 0x01 /* Byte 2, Bit 0: Read cache disable (RCD) */ - -#define SCSIRESP_MODEPARMHDR_DAPARM_WP 0x80 /* Bit 7: WP (Direct-access block devices only) */ -#define SCSIRESP_MODEPARMHDR_DAPARM_DBPFUA 0x10 /* Bit 4: DBOFUA (Direct-access block devices only) */ - -#define SCSIRESP_PAGEFMT_PS 0x80 /* Bit 7: PS */ -#define SCSIRESP_PAGEFMT_SPF 0x40 /* Bit 6: SPF */ -#define SCSIRESP_PAGEFMT_PGCODEMASK 0x3f /* Bits 0-5: Page code */ - -/* Prevent / Allow Medium Removal */ - -#define SCSICMD_PREVENTMEDIUMREMOVAL_TRANSPORT 0x01 /* Removal prohibited from data transport */ -#define SCSICMD_PREVENTMEDIUMREMOVAL_MCHANGER 0x02 /* Removal prohibited from medium changer */ - -/* Read format capacities */ - -#define SCIRESP_RDFMTCAPACITIES_UNFORMATED 0x01 /* Unformatted media */ -#define SCIRESP_RDFMTCAPACITIES_FORMATED 0x02 /* Formatted media */ -#define SCIRESP_RDFMTCAPACITIES_NOMEDIA 0x03 /* No media */ - -/* Read 6 */ - -#define SCSICMD_READ6_MSLBAMASK 0x1f - -/* Write 6 */ - -#define SCSICMD_WRITE6_MSLBAMASK 0x1f - -/* Mode Select 10 */ - -#define SCSICMD_MODESELECT10_PF 0x10 /* Bit 4: PF */ -#define SCSICMD_MODESELECT10_SP 0x01 /* Bit 0: SP */ - -/* Mode Sense 10 */ - -#define SCSICMD_MODESENSE10_LLBAA 0x10 /* Bit 4: LLBAA */ -#define SCSICMD_MODESENSE10_DBD 0x08 /* Bit 3: PF */ - -/* Read 10 */ - -#define SCSICMD_READ10FLAGS_RDPROTECTMASK 0xe0 -#define SCSICMD_READ10FLAGS_DPO 0x10 /* Disable Page Out */ -#define SCSICMD_READ10FLAGS_FUA 0x08 -#define SCSICMD_READ10FLAGS_FUANV 0x02 - -/* Write 10 */ - -#define SCSICMD_WRITE10FLAGS_WRPROTECTMASK 0xe0 -#define SCSICMD_WRITE10FLAGS_DPO 0x10 /* Disable Page Out */ -#define SCSICMD_WRITE10FLAGS_FUA 0x08 -#define SCSICMD_WRITE10FLAGS_FUANV 0x02 - -/* Verify 10 */ - -#define SCSICMD_VERIFY10_VRPROTECTMASK 0xe0 /* Byte 1: Bits 5-7: VRPROTECT */ -#define SCSICMD_VERIFY10_DPO 0x10 /* Byte 1: Bit 4: Disable Page Out (DPO) */ -#define SCSICMD_VERIFY10_BYTCHK 0x02 /* Byte 1: Bit 2: BytChk */ - -/* Read 12 */ - -#define SCSICMD_READ12FLAGS_RDPROTECTMASK 0xe0 -#define SCSICMD_READ12FLAGS_DPO 0x10 /* Disable Page Out */ -#define SCSICMD_READ12FLAGS_FUA 0x08 -#define SCSICMD_READ12FLAGS_FUANV 0x02 - -/* Write 12 */ - -#define SCSICMD_WRITE12FLAGS_WRPROTECTMASK 0xe0 -#define SCSICMD_WRITE12FLAGS_DPO 0x10 /* Disable Page Out */ -#define SCSICMD_WRITE12FLAGS_FUA 0x08 -#define SCSICMD_WRITE12FLAGS_FUANV 0x02 - -/* Verify 12 */ - -#define SCSICMD_VERIFY12_VRPROTECTMASK 0xe0 /* Byte 1: Bits 5-7: VRPROTECT */ -#define SCSICMD_VERIFY12_DPO 0x10 /* Byte 1: Bit 4: Disable Page Out (DPO) */ -#define SCSICMD_VERIFY12_BYTCHK 0x02 /* Byte 1: Bit 2: BytChk */ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* Format structures for selected SCSI primary commands */ - -#define SCSICMD_TESTUNITREADY_SIZEOF 6 - -struct scsicmd_requestsense_s -{ - uint8_t opcode; /* 0: 0x03 */ - uint8_t flags; /* 1: See SCSICMD_REQUESTSENSE_FLAGS_* */ - uint8_t reserved[2]; /* 2-3: Reserved */ - uint8_t alloclen; /* 4: Allocation length */ - uint8_t control; /* 5: Control */ -}; -#define SCSICMD_REQUESTSENSE_SIZEOF 6 -#define SCSICMD_REQUESTSENSE_MSSIZEOF 12 /* MS-Windows REQUEST SENSE with cbw->cdblen == 12 */ - -struct scsiresp_fixedsensedata_s -{ - uint8_t code; /* 0: Response code See SCSIRESP_SENSEDATA_*FIXED defns */ - uint8_t obsolete; /* 1: */ - uint8_t flags; /* 2: See SCSIRESP_SENSEDATA_* definitions */ - uint8_t info[4]; /* 3-6: Information */ - uint8_t len; /* 7: Additional length */ - uint8_t cmdinfo[4]; /* 8-11: Command-specific information */ - uint8_t code2; /* 12: Additional sense code */ - uint8_t qual2; /* 13: Additional sense code qualifier */ - uint8_t fru; /* 14: Field replacement unit code */ - uint8_t key[3]; /* 15-17: Sense key specific */ - /* 18-: Additional bytes may follow */ -}; -#define SCSIRESP_FIXEDSENSEDATA_SIZEOF 18 /* Minimum size */ - -struct scscicmd_inquiry_s -{ - uint8_t opcode; /* 0: 0x12 */ - uint8_t flags; /* 1: See SCSICMD_INQUIRY_FLAGS_* */ - uint8_t pagecode; /* 2: Page code */ - uint8_t alloclen[2]; /* 3-4: Allocation length */ - uint8_t control; /* 5: Control */ -}; -#define SCSICMD_INQUIRY_SIZEOF 6 - -struct scsiresp_inquiry_s -{ - /* Mandatory */ - - uint8_t qualtype; /* 0: Bits 5-7: Peripheral qualifier; Bits 0-4: Peripheral device type */ - uint8_t flags1; /* 1: See SCSIRESP_INQUIRY_FLAGS1_* */ - uint8_t version; /* 2: Version */ - uint8_t flags2; /* 3: See SCSIRESP_INQUIRY_FLAGS2_* */ - uint8_t len; /* 4: Additional length */ - uint8_t flags3; /* 5: See SCSIRESP_INQUIRY_FLAGS3_* */ - uint8_t flags4; /* 6: See SCSIRESP_INQUIRY_FLAGS4_* */ - uint8_t flags5; /* 7: See SCSIRESP_INQUIRY_FLAGS5_* */ - uint8_t vendorid[8]; /* 8-15: T10 Vendor Identification */ - uint8_t productid[16]; /* 16-31: Product Identification */ - uint8_t revision[4]; /* 32-35: Product Revision Level */ - - /* Optional */ - - uint8_t vendor[20]; /* 36-55: Vendor specific */ - uint8_t flags6; /* 56: See SCSIRESP_INQUIRY_FLAGS6_* */ - uint8_t reserved1; /* 57: Reserved */ - uint8_t version1[2]; /* 58-59: Version Descriptor 1 */ - uint8_t version2[2]; /* 60-61: Version Descriptor 2 */ - uint8_t version3[2]; /* 62-63: Version Descriptor 3 */ - uint8_t version4[2]; /* 64-65: Version Descriptor 4 */ - uint8_t version5[2]; /* 66-67: Version Descriptor 5 */ - uint8_t version6[2]; /* 68-69: Version Descriptor 6 */ - uint8_t version7[2]; /* 70-71: Version Descriptor 7 */ - uint8_t version8[2]; /* 72-73: Version Descriptor 8 */ - uint8_t reserved2[22]; /* 74-95: Reserved */ - /* 96-: Vendor-specific parameters may follow */ -}; -#define SCSIRESP_INQUIRY_SIZEOF 36 /* Minimum size */ - -struct scsicmd_modeselect6_s -{ - uint8_t opcode; /* 0x15 */ - uint8_t flags; /* 1: See SCSICMD_MODESELECT6_FLAGS_* */ - uint8_t reserved[2]; /* 2-3: Reserved */ - uint8_t plen; /* 4: Parameter list length */ - uint8_t control; /* 5: Control */ -}; -#define SCSICMD_MODESELECT6_SIZEOF 6 - -struct scsicmd_modesense6_s -{ - uint8_t opcode; /* 0x1a */ - uint8_t flags; /* 1: See SCSICMD_MODESENSE6_FLAGS_* */ - uint8_t pcpgcode; /* 2: Bits 6-7: PC, bits 0-5: page code */ - uint8_t subpgcode; /* 3: subpage code */ - uint8_t alloclen; /* 4: Allocation length */ - uint8_t control; /* 5: Control */ -}; -#define SCSICMD_MODESENSE6_SIZEOF 6 - -struct scsiresp_modeparameterhdr6_s -{ - uint8_t mdlen; /* 0: Mode data length */ - uint8_t type; /* 1: Medium type */ - uint8_t param; /* 2: Device-specific parameter */ - uint8_t bdlen; /* 3: Block descriptor length */ -}; -#define SCSIRESP_MODEPARAMETERHDR6_SIZEOF 4 - -struct scsiresp_blockdesc_s -{ - uint8_t density; /* 0: density code */ - uint8_t nblocks[3]; /* 1-3: Number of blocks */ - uint8_t reserved; /* 4: reserved */ - uint8_t blklen[3]; /* 5-7: Block len */ -}; -#define SCSIRESP_BLOCKDESC_SIZEOF 8 - -struct scsiresp_pageformat_s -{ - uint8_t pgcode; /* 0: See SCSIRESP_PAGEFMT_* definitions */ - uint8_t pglen; /* 1: Page length (n-1) */ - uint8_t parms[1]; /* 2-n: Mode parameters */ -}; - -struct scsiresp_subpageformat_s -{ - uint8_t pgcode; /* 0: See SCSIRESP_PAGEFMT_* definitions */ - uint8_t subpgcode; /* 1: sub-page code */ - uint8_t pglen[2]; /* 2-3: Page length (n-3) */ - uint8_t parms[1]; /* 4-n: Mode parameters */ -}; - -struct scsiresp_cachingmodepage_s -{ - uint8_t pgcode; /* 0: Bit 7: PS; Bit 6: SPF, Bits 0-5: page code == 8 */ - uint8_t len; /* 1: Page length (18) */ - uint8_t flags1; /* 2: See SCSIRESP_CACHINGMODEPG_* definitions */ - uint8_t priority; /* 3: Bits 4-7: Demand read retention priority; Bits 0-3: Write retention priority */ - uint8_t dpflen[2]; /* 4-5: Disable prefetch transfer length */ - uint8_t minpf[2]; /* 6-7: Minimum pre-fetch */ - uint8_t maxpf[2]; /* 8-9: Maximum pre-fetch */ - uint8_t maxpfc[2]; /* 10-11: Maximum pref-fetch ceiling */ - uint8_t flags2; /* 12: See SCSIRESP_CACHINGMODEPG_* definitions */ - uint8_t nsegments; /* 13: Number of cache segments */ - uint8_t segsize[2]; /* 14-15: Cache segment size */ - uint8_t reserved; /* 16: Reserved */ - uint8_t obsolete[3]; /* 17-19: Obsolete */ -}; - -/* Format structures for selected SCSI block commands */ - -struct scsicmd_read6_s -{ - uint8_t opcode; /* 0: 0x08 */ - uint8_t mslba; /* 1: Bits 5-7: reserved; Bits 0-6: MS Logical Block Address (LBA) */ - uint8_t lslba[2]; /* 2-3: LS Logical Block Address (LBA) */ - uint8_t xfrlen; /* 4: Transfer length (in contiguous logical blocks)*/ - uint8_t control; /* 5: Control */ -}; -#define SCSICMD_READ6_SIZEOF 6 - -struct scsicmd_write6_s -{ - uint8_t opcode; /* 0: 0x0a */ - uint8_t mslba; /* 1: Bits 5-7: reserved; Bits 0-6: MS Logical Block Address (LBA) */ - uint8_t lslba[2]; /* 2-3: LS Logical Block Address (LBA) */ - uint8_t xfrlen; /* 4: Transfer length (in contiguous logical blocks) */ - uint8_t control; /* 5: Control */ -}; -#define SCSICMD_WRITE6_SIZEOF 6 - -struct scsicmd_startstopunit_s -{ - uint8_t opcode; /* 0: 0x1b */ - uint8_t immed; /* 1: Bits 2-7: Reserved, Bit 0: Immed */ - uint8_t reserved; /* 2: reserved */ - uint8_t pcm; /* 3: Bits 4-7: Reserved, Bits 0-3: Power condition modifier */ - uint8_t pc; /* 4: Bits 4-7: Power condition, Bit 2: NO_FLUSH, Bit 1: LOEJ, Bit 0: START */ - uint8_t control; /* 5: Control */ -}; -#define SCSICMD_STARTSTOPUNIT_SIZEOF 6 - -struct scsicmd_preventmediumremoval_s -{ - uint8_t opcode; /* 0: 0x1e */ - uint8_t reserved[3]; /* 1-3: Reserved */ - uint8_t prevent; /* 4: Bits 2-7: Reserved, Bits 0:1: prevent */ - uint8_t control; /* 5: Control */ -}; -#define SCSICMD_PREVENTMEDIUMREMOVAL_SIZEOF 6 - -struct scsicmd_readformatcapcacities_s -{ - uint8_t opcode; /* 0: 0x23 */ - uint8_t reserved[6]; /* 1-6: Reserved */ - uint8_t alloclen[2]; /* 7-8: Allocation length */ - uint8_t control; /* 9: Control */ -}; -#define SCSICMD_READFORMATCAPACITIES_SIZEOF 10 - -struct scsiresp_readformatcapacities_s -{ - /* Current capacity header */ - - uint8_t reserved[3]; /* 0-2: Reserved */ - uint8_t listlen; /* 3: Capacity list length */ - - /* Current/Maximum Capacity Descriptor (actually a separate structure) */ - - uint8_t nblocks[4]; /* 4-7: Number of blocks */ - uint8_t type; /* 8: Bits 2-7: Reserved, Bits 0-1: Descriptor type */ - uint8_t blocklen[3]; /* 9-11: Block length */ -}; -#define SCSIRESP_READFORMATCAPACITIES_SIZEOF 12 -#define SCSIRESP_CURRCAPACITYDESC_SIZEOF 8 - -struct scsiresp_formattedcapacitydesc_s -{ - uint8_t nblocks[4]; /* 0-3: Number of blocks */ - uint8_t type; /* 4: Bits 2-7: Type, bits 0-1, reserved */ - uint8_t param[3]; /* 5-7: Type dependent parameter */ -}; -#define SCSIRESP_FORMATTEDCAPACITYDESC_SIZEOF 8 - -struct scsicmd_readcapacity10_s -{ - uint8_t opcode; /* 0: 0x25 */ - uint8_t reserved1; /* 1: Bits 1-7: Reserved, Bit 0: Obsolete */ - uint8_t lba[4]; /* 2-5: Logical block address (LBA) */ - uint8_t reserved2[2]; /* 6-7: Reserved */ - uint8_t pmi; /* 8: Bits 1-7 Reserved; Bit 0: PMI */ - uint8_t control; /* 9: Control */ -}; -#define SCSICMD_READCAPACITY10_SIZEOF 10 - -struct scsiresp_readcapacity10_s -{ - uint8_t lba[4]; /* 0-3: Returned logical block address (LBA) */ - uint8_t blklen[4]; /* 4-7: Logical block length (in bytes) */ -}; -#define SCSIRESP_READCAPACITY10_SIZEOF 8 - -struct scsicmd_read10_s -{ - uint8_t opcode; /* 0: 0x28 */ - uint8_t flags; /* 1: See SCSICMD_READ10FLAGS_* */ - uint8_t lba[4]; /* 2-5: Logical Block Address (LBA) */ - uint8_t groupno; /* 6: Bits 5-7: reserved; Bits 0-6: group number */ - uint8_t xfrlen[2]; /* 7-8: Transfer length (in contiguous logical blocks) */ - uint8_t control; /* 9: Control */ -}; -#define SCSICMD_READ10_SIZEOF 10 - -struct scsicmd_write10_s -{ - uint8_t opcode; /* 0: 0x2a */ - uint8_t flags; /* 1: See SCSICMD_WRITE10FLAGS_* */ - uint8_t lba[4]; /* 2-5: Logical Block Address (LBA) */ - uint8_t groupno; /* 6: Bits 5-7: reserved; Bits 0-6: group number */ - uint8_t xfrlen[2]; /* 7-8: Transfer length (in contiguous logical blocks) */ - uint8_t control; /* 9: Control */ -}; -#define SCSICMD_WRITE10_SIZEOF 10 - -struct scsicmd_verify10_s -{ - uint8_t opcode; /* 0: 0x2f */ - uint8_t flags; /* 1: See SCSICMD_VERIFY10_* definitions */ - uint8_t lba[4]; /* 2-5: Logical block address (LBA) */ - uint8_t groupno; /* 6: Bit 7: restricted; Bits 5-6: Reserved, Bits 0-4: Group number */ - uint8_t len[2]; /* 7-8: Verification length (in blocks) */ - uint8_t control; /* 9: Control */ -}; -#define SCSICMD_VERIFY10_SIZEOF 10 - -struct scsicmd_synchronizecache10_s -{ - uint8_t opcode; /* 0: 0x35 */ - uint8_t flags; /* 1: See SCSICMD_SYNCHRONIZECACHE10_* definitions */ - uint8_t lba[4]; /* 2-5: Logical block address (LBA) */ - uint8_t groupno; /* 6: Bit 7: restricted; Bits 5-6: Reserved, Bits 0-4: Group number */ - uint8_t len[2]; /* 7-8: Number of logical blocks */ - uint8_t control; /* 9: Control */ -}; -#define SCSICMD_SYNCHRONIZECACHE10_SIZEOF 10 - -struct scsicmd_modeselect10_s -{ - uint8_t opcode; /* 0: 0x55 */ - uint8_t flags; /* 1: See SCSICMD_MODESELECT10_FLAGS_* */ - uint8_t reserved[5]; /* 2-6: Reserved */ - uint8_t parmlen[2]; /* 7-8: Parameter list length */ - uint8_t control; /* 9: Control */ -}; -#define SCSICMD_MODESELECT10_SIZEOF 10 - -struct scsiresp_modeparameterhdr10_s -{ - uint8_t mdlen[2]; /* 0-1: Mode data length */ - uint8_t type; /* 2: Medium type */ - uint8_t param; /* 3: Device-specific parameter */ - uint8_t reserved[2]; /* 4-5: reserved */ - uint8_t bdlen[2]; /* 6-7: Block descriptor length */ -}; -#define SCSIRESP_MODEPARAMETERHDR10_SIZEOF 8 - -struct scsicmd_modesense10_s -{ - uint8_t opcode; /* O: 0x5a */ - uint8_t flags; /* 1: See SCSICMD_MODESENSE10_FLAGS_* */ - uint8_t pcpgcode; /* 2: Bits 6-7: PC, bits 0-5: page code */ - uint8_t subpgcode; /* 3: subpage code */ - uint8_t reserved[3]; /* 4-6: reserved */ - uint8_t alloclen[2]; /* 7-8: Allocation length */ - uint8_t control; /* 9: Control */ -}; -#define SCSICMD_MODESENSE10_SIZEOF 10 - -struct scsicmd_readcapacity16_s -{ - uint8_t opcode; /* 0: 0x9e */ - uint8_t action; /* 1: Bits 5-7: Reserved, Bits 0-4: Service action */ - uint8_t lba[8]; /* 2-9: Logical block address (LBA) */ - uint8_t len[4]; /* 10-13: Allocation length */ - uint8_t reserved; /* 14: Reserved */ - uint8_t control; /* 15: Control */ -}; -#define SCSICMD_READCAPACITY16_SIZEOF 16 - -struct scsicmd_read12_s -{ - uint8_t opcode; /* 0: 0xa8 */ - uint8_t flags; /* 1: See SCSICMD_READ12FLAGS_* */ - uint8_t lba[4]; /* 2-5: Logical Block Address (LBA) */ - uint8_t xfrlen[4]; /* 6-9: Transfer length (in contiguous logical blocks) */ - uint8_t groupno; /* 10: Bit 7: restricted; Bits 5-6: reserved; Bits 0-6: group number */ - uint8_t control; /* 11: Control */ -}; -#define SCSICMD_READ12_SIZEOF 12 - -struct scsicmd_write12_s -{ - uint8_t opcode; /* 0: 0xaa */ - uint8_t flags; /* 1: See SCSICMD_WRITE12FLAGS_* */ - uint8_t lba[4]; /* 2-5: Logical Block Address (LBA) */ - uint8_t xfrlen[4]; /* 6-9: Transfer length (in contiguous logical blocks) */ - uint8_t groupno; /* 10: Bit 7: restricted; Bits 5-6: reserved; Bits 0-6: group number */ - uint8_t control; /* 11: Control */ -}; -#define SCSICMD_WRITE12_SIZEOF 12 - -struct scsicmd_verify12_s -{ - uint8_t opcode; /* 0: 0xaf */ - uint8_t flags; /* 1: See SCSICMD_VERIFY12_* definitions */ - uint8_t lba[4]; /* 2-5: Logical block address (LBA) */ - uint8_t len[4]; /* 6-9: Verification length */ - uint8_t groupno; /* 10: Bit 7: restricted; Bits 5-6: Reserved, Bits 0-4: Group number */ - uint8_t control; /* 11: Control */ -}; -#define SCSICMD_VERIFY12_SIZEOF 12 - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_SCSI_H */ diff --git a/nuttx/include/nuttx/sdio.h b/nuttx/include/nuttx/sdio.h deleted file mode 100644 index 10612db85..000000000 --- a/nuttx/include/nuttx/sdio.h +++ /dev/null @@ -1,855 +0,0 @@ -/**************************************************************************** - * include/nuttx/sdio.h - * - * Copyright (C) 2009, 2011-2012 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_NUTTX_SDIO_H -#define __INCLUDE_NUTTX_SDIO_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/* SDIO events needed by the driver - * - * Wait events are used for event-waiting by SDIO_WAITENABLE and SDIO_EVENTWAIT - */ - -#define SDIOWAIT_CMDDONE (1 << 0) /* Bit 0: Command complete */ -#define SDIOWAIT_RESPONSEDONE (1 << 1) /* Bit 1: Response to command available */ -#define SDIOWAIT_TRANSFERDONE (1 << 2) /* Bit 2: Data transfer/DMA done */ -#define SDIOWAIT_TIMEOUT (1 << 3) /* Bit 3: Timeout */ -#define SDIOWAIT_ERROR (1 << 4) /* Bit 4: Some other error occurred */ - -#define SDIOWAIT_ALLEVENTS 0x1f - -/* Media events are used for enable/disable registered event callbacks */ - -#define SDIOMEDIA_EJECTED (1 << 0) /* Bit 0: Mmedia removed */ -#define SDIOMEDIA_INSERTED (1 << 1) /* Bit 1: Media inserted */ - -/* Commands are bit-encoded to provide as much information to the SDIO driver as - * possible in 32-bits. The encoding is as follows: - * - * ---- ---- ---- ---- ---T TTRR RRCC CCCC - * - * CCCCCC - Bits 0-5: 6-bit command index (Range 9-63) - * RRRR - Bits 6-9: 4-bit response code (R1, R1B, R2-5) - * TTT - Bits 10-12: Data transfer type - */ - -/* MMC, SD, SDIO Common Indices */ - -#define MMCSD_CMDIDX_SHIFT (0) -#define MMCSD_CMDIDX_MASK (0x3f << MMCSD_CMDIDX_SHIFT) -# define MMCSD_CMDIDX0 0 /* GO_IDLE_STATE: Resets all cards to idle state - * -Broadcast, no response */ -# define MMC_CMDIDX1 1 /* SEND_OP_COND: Sends capacity support information - * -Broadcast, R3 response, 31:0=OCR */ -# define MMCSD_CMDIDX2 2 /* ALL_SEND_CID - * -Broadcast, R2 response */ -# define MMC_CMDIDX3 3 /* SET_RELATIVE_ADDR - * -Addressed Command, R1 response 31:16=RCA */ -# define SD_CMDIDX3 3 /* SEND_RELATIVE_ADDR - * -Addressed Command, R6 response 31:16=RCA */ -# define MMCSD_CMDIDX4 4 /* SET_DSR - * -Broadcast command, no response 31:16=RCA */ -# define SDIO_CMDIDX5 5 /* SDIO_SEND_OP_COND - * -Addressed Command, R4 response 47:16=IO_OCR */ -# define MMCSD_CMDIDX6 6 /* HS_SWITCH: Checks switchable function */ -# define MMCSD_CMDIDX7 7 /* SELECT/DESELECT CARD - * -Addressed Command, R1 response 31:16=RCA */ -# define SD_CMDIDX8 8 /* IF_COND: Sends SD Memory Card interface condition - * R7 response */ -# define MMCSD_CMDIDX9 9 /* SEND_CSD: Asks card to send its card specific data (CSD) - * -Addressed Command, R2 response 31:16=RCA */ -# define MMCSD_CMDIDX10 10 /* SEND_CID: Asks card to send its card identification (CID) - * -Addressed Command, R2 response 31:16=RCA */ -# define MMC_CMDIDX11 11 /* READ_DAT_UNTIL_STOP - * -Addressed data transfer command, R1 response 31:0=DADR */ -# define MMCSD_CMDIDX12 12 /* STOP_TRANSMISSION: Forces the card to stop transmission - * -Addressed Command, R1b response */ -# define MMCSD_CMDIDX13 13 /* SEND_STATUS: Asks card to send its status register - * -Addressed Command, R1 response 31:16=RCA */ -# define MMCSD_CMDIDX14 14 /* HS_BUSTEST_READ: */ -# define MMCSD_CMDIDX15 15 /* GO_INACTIVE_STATE - * Addressed Command, Response 31:16=RCA */ -# define MMCSD_CMDIDX16 16 /* SET_BLOCKLEN: Sets a block length (in bytes) - * -Addressed Command, R1 response 31:0=BLEN */ -# define MMCSD_CMDIDX17 17 /* READ_SINGLE_BLOCK: Reads a block of the selected size - * -Addressed data transfer command, R1 response 31:0=DADR */ -# define MMCSD_CMDIDX18 18 /* READ_MULTIPLE_BLOCK: Continuously transfers blocks from card to host - * -Addressed data transfer command, R1 response 31:0=DADR */ -# define MMCSD_CMDIDX19 19 /* HS_BUSTEST_WRITE: */ -# define MMC_CMDIDX20 20 /* WRITE_DAT_UNTIL_STOP: (MMC) - * -Addressed data transfer command, R1 response 31:0=DADR R1 */ -# define MMC_CMDIDX23 23 /* SET_BLOCK_COUNT: (MMC) - * -Addressed command, R1 response 31:0=DADR */ -# define MMCSD_CMDIDX24 24 /* WRITE_BLOCK: Writes a block of the selected size - * -Addressed data transfer command, R1 response 31:0=DADR */ -# define MMCSD_CMDIDX25 25 /* WRITE_MULTIPLE_BLOCK: Continuously writes blocks of data - * -Addressed data transfer command, R1 response 31:0=DADR */ -# define MMCSD_CMDIDX26 26 /* PROGRAM_CID: (Manufacturers only) - * -Addressed data transfer command, R1 response */ -# define MMCSD_CMDIDX27 27 /* PROGRAM_CSD: Set programmable bits of the CSD - * -Addressed data transfer command, R1 response */ -# define MMCSD_CMDIDX28 28 /* SET_WRITE_PROT: Sets the write protection bit of group - * -Addressed Command, R1b response 31:0=DADR */ -# define MMCSD_CMDIDX29 29 /* CLR_WRITE_PROT: Clears the write protection bit of group - * -Addressed Command, R1b response 31:0=DADR */ -# define MMCSD_CMDIDX30 30 /* SEND_WRITE_PROT: Asks card to send state of write protection bits - * -Addressed data transfer command, R1 response 31:0=WADR */ -# define SD_CMDIDX32 32 /* ERASE_GRP_START: Sets address of first block to erase (SD) - * -Addressed Command, R1 response 31:0=DADR */ -# define SD_CMDIDX33 33 /* ERASE_GRP_END: Sets address of last block to erase (SD) - * -Addressed Command, R1 response 31:0=DADR */ -# define MMC_CMDIDX34 34 /* UNTAG_SECTOR: (MMC) - * -Addressed Command, R1 response 31:0=DADR */ -# define MMC_CMDIDX35 35 /* TAG_ERASE_GROUP_START: Sets address of first block to erase (MMC) - * -Addressed Command, R1 response 31:0=DADR */ -# define MMC_CMDIDX36 36 /* TAG_ERASE_GROUP_END: Sets address of last block to erase (MMC) - * -Addressed Command, R1 response 31:0=DADR */ -# define MMC_CMDIDX37 37 /* UNTAG_ERASE_GROUP: (MMC) - * -Addressed Command, R1 response 31:0=DADR */ -# define MMCSD_CMDIDX38 38 /* ERASE: Erases all previously selected write blocks - * -Addressed Command, R1b response */ -# define MMC_CMDIDX39 39 /* FAST_IO: (MMC) - * -Addressed Command, R4 response (Complex) */ -# define MMC_CMDIDX40 40 /* GO_IRQ_STATE: (MMC) - * -Broadcast command, R5 response */ -# define MMCSD_CMDIDX42 42 /* LOCK_UNLOCK: Used to Set/Reset the Password or lock/unlock card - * -Addressed data transfer command, R1b response */ -# define SD_CMDIDX55 55 /* APP_CMD: Tells card that the next command is an application specific command - * - Addressed Command, R1 response 31:16=RCA */ -# define MMCSD_CMDIDX56 56 /* GEN_CMD: Used transfer a block to or get block from card - * -Addressed data transfer command, R1 Response */ - -/* SD/SDIO APP commands (must be preceded by CMD55) */ - -# define SD_ACMDIDX6 6 /* SET_BUS_WIDTH: - * -Addressed Command, R1 response 1:0=BUSW */ -# define SD_ACMDIDX13 13 /* SD_STATUS: Send the SD Status - * -Addressed data transfer command, R1 response */ -# define SD_ACMDIDX18 18 /* SECURE_READ_MULTIPLE_BLOCK: */ -# define SD_ACMDIDX22 22 /* SEND_NUM_WR_BLOCKS: Send number of the errorfree blocks - * -Addressed data transfer command, R1 response */ -# define SD_ACMDIDX23 23 /* SET_WR_BLK_ERASE_COUNT: Set number blocks to erase before writing - * -Addressed Command, R1 response 22:0=NBLK */ -# define SD_ACMDIDX25 25 /* SECURE_WRITE_MULTIPLE_BLOCK: */ -# define SD_ACMDIDX38 38 /* SECURE_ERASE: */ -# define SD_ACMDIDX41 41 /* SD_SEND_OP_COND: Sends host capacity support information - * -Broadcast command, R3 response 31:0=OCR */ -# define SD_ACMDIDX42 42 /* SET_CLR_CARD_DETECT: Connect/disconnect pull-up resistor on CS - * Addressed Command, R1 response 0:0=CD */ -# define SD_ACMDIDX43 43 /* GET_MKB: */ -# define SD_ACMDIDX44 44 /* GET_MID: */ -# define SD_ACMDIDX45 45 /* SET_CER_RN1: */ -# define SD_ACMDIDX46 46 /* GET_CER_RN2: */ -# define SD_ACMDIDX47 47 /* SET_CER_RES2: */ -# define SD_ACMDIDX48 48 /* GET_CER_RES1/WRITE_MKB: */ -# define SD_ACMDIDX49 49 /* CHANGE_SECURE_AREA: */ -# define SD_ACMDIDX51 51 /* SEND_SCR: Reads the SD Configuration Register (SCR) - * Addressed data transfer command, R1 response */ -# define SDIO_ACMDIDX52 52 /* IO_RW_DIRECT: (SDIO only) - * -R5 response, 23:16=status 15:8=data */ -# define SDIO_ACMDIDX53 53 /* IO_RW_EXTENDED: (SDIO only) - * -R5 response, 23:16=status */ - -/* Response Encodings: - * - * xxxx xxxx xxxx xxxx OSMX XXRR RRCC CCCC - * - * x - Bit not used - * C - Bits 0-5: Command index - * R - Bits 6-9: Response type - * X - Bits 10-12: Data transfer type - * M - Bit 13: Multiple block transfer - * S - Bit 14: Stop data transfer - * O - Bit 15: Open drain - */ - -#define MMCSD_RESPONSE_SHIFT (6) -#define MMCSD_RESPONSE_MASK (15 << MMCSD_RESPONSE_SHIFT) -# define MMCSD_NO_RESPONSE (0) -# define MMCSD_R1_RESPONSE (1 << MMCSD_RESPONSE_SHIFT) /* 48-bit */ -# define MMCSD_R1B_RESPONSE (2 << MMCSD_RESPONSE_SHIFT) /* 48-bit */ -# define MMCSD_R2_RESPONSE (3 << MMCSD_RESPONSE_SHIFT) /* 128-bit */ -# define MMCSD_R3_RESPONSE (4 << MMCSD_RESPONSE_SHIFT) /* 48-bit */ -# define MMCSD_R4_RESPONSE (5 << MMCSD_RESPONSE_SHIFT) /* 48-bit */ -# define MMCSD_R5_RESPONSE (6 << MMCSD_RESPONSE_SHIFT) /* 48-bit */ -# define MMCSD_R6_RESPONSE (7 << MMCSD_RESPONSE_SHIFT) /* 48-bit */ -# define MMCSD_R7_RESPONSE (8 << MMCSD_RESPONSE_SHIFT) /* 48-bit */ - -/* Data Transfer Type */ - -#define MMCSD_DATAXFR_SHIFT (10) -#define MMCSD_DATAXFR_MASK (7 << MMCSD_DATAXFR_SHIFT) -# define MMCSD_DATAXFR (1 << MMCSD_DATAXFR_SHIFT) -# define MMCSD_STREAM (2 << MMCSD_DATAXFR_SHIFT) -# define MMCSD_WRXFR (4 << MMCSD_DATAXFR_SHIFT) - -# define MMCSD_NODATAXFR (0) -# define MMCSD_RDSTREAM (MMCSD_STREAM) -# define MMCSD_WRSTREAM (MMCSD_STREAM|MMCSD_WRXFR) -# define MMCSD_RDDATAXFR (MMCSD_DATAXFR) -# define MMCSD_WRDATAXFR (MMCSD_DATAXFR|MMCSD_WRXFR) - -#define MMCSD_MULTIBLOCK (1 << 13) -#define MMCSD_STOPXFR (1 << 14) - -/* Other options */ - -#define MMCSD_OPENDRAIN (1 << 15) - -/* Fully decorated MMC, SD, SDIO commands */ - -#define MMCSD_CMD0 (MMCSD_CMDIDX0 |MMCSD_NO_RESPONSE |MMCSD_NODATAXFR) -#define MMC_CMD1 (MMC_CMDIDX1 |MMCSD_R3_RESPONSE |MMCSD_NODATAXFR |MMCSD_OPENDRAIN) -#define MMCSD_CMD2 (MMCSD_CMDIDX2 |MMCSD_R2_RESPONSE |MMCSD_NODATAXFR) -#define MMC_CMD3 (MMC_CMDIDX3 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define SD_CMD3 (SD_CMDIDX3 |MMCSD_R6_RESPONSE |MMCSD_NODATAXFR) -#define MMCSD_CMD4 (MMCSD_CMDIDX4 |MMCSD_NO_RESPONSE |MMCSD_NODATAXFR) -#define SDIO_CMD5 (SDIO_CMDIDX5 |MMCSD_R4_RESPONSE |MMCSD_NODATAXFR) -#define MMCSD_CMD6 (MMCSD_CMDIDX6 |MMCSD_R1_RESPONSE |MMCSD_RDDATAXFR) -#define MMCSD_CMD7S (MMCSD_CMDIDX7 |MMCSD_R1B_RESPONSE|MMCSD_NODATAXFR) -#define MMCSD_CMD7D (MMCSD_CMDIDX7 |MMCSD_NO_RESPONSE |MMCSD_NODATAXFR) /* No response when de-selecting card */ -#define SD_CMD8 (SD_CMDIDX8 |MMCSD_R7_RESPONSE |MMCSD_NODATAXFR) -#define MMCSD_CMD9 (MMCSD_CMDIDX9 |MMCSD_R2_RESPONSE |MMCSD_NODATAXFR) -#define MMCSD_CMD10 (MMCSD_CMDIDX10|MMCSD_R2_RESPONSE |MMCSD_NODATAXFR) -#define MMC_CMD11 (MMC_CMDIDX11 |MMCSD_R1_RESPONSE |MMCSD_RDSTREAM ) -#define MMCSD_CMD12 (MMCSD_CMDIDX12|MMCSD_R1B_RESPONSE|MMCSD_NODATAXFR |MMCSD_STOPXFR) -#define MMCSD_CMD13 (MMCSD_CMDIDX13|MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define MMCSD_CMD14 (MMCSD_CMDIDX14|MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define MMCSD_CMD15 (MMCSD_CMDIDX15|MMCSD_NO_RESPONSE |MMCSD_NODATAXFR) -#define MMCSD_CMD16 (MMCSD_CMDIDX16|MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define MMCSD_CMD17 (MMCSD_CMDIDX17|MMCSD_R1_RESPONSE |MMCSD_RDDATAXFR) -#define MMCSD_CMD18 (MMCSD_CMDIDX18|MMCSD_R1_RESPONSE |MMCSD_RDDATAXFR |MMCSD_MULTIBLOCK) -#define MMCSD_CMD19 (MMCSD_CMDIDX19|MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define MMC_CMD20 (MMC_CMDIDX20 |MMCSD_R1B_RESPONSE|MMCSD_WRSTREAM ) -#define MMC_CMD23 (MMC_CMDIDX23 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define MMCSD_CMD24 (MMCSD_CMDIDX24|MMCSD_R1_RESPONSE |MMCSD_WRDATAXFR) -#define MMCSD_CMD25 (MMCSD_CMDIDX25|MMCSD_R1_RESPONSE |MMCSD_WRDATAXFR |MMCSD_MULTIBLOCK) -#define MMCSD_CMD26 (MMCSD_CMDIDX26|MMCSD_R1_RESPONSE |MMCSD_WRDATAXFR) -#define MMCSD_CMD27 (MMCSD_CMDIDX27|MMCSD_R1_RESPONSE |MMCSD_WRDATAXFR) -#define MMCSD_CMD28 (MMCSD_CMDIDX28|MMCSD_R1B_RESPONSE|MMCSD_NODATAXFR) -#define MMCSD_CMD29 (MMCSD_CMDIDX29|MMCSD_R1B_RESPONSE|MMCSD_NODATAXFR) -#define MMCSD_CMD30 (MMCSD_CMDIDX30|MMCSD_R1_RESPONSE |MMCSD_RDDATAXFR) -#define SD_CMD32 (SD_CMDIDX32 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define SD_CMD33 (SD_CMDIDX33 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define MMC_CMD34 (MMC_CMDIDX34 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define MMC_CMD35 (MMC_CMDIDX35 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define MMC_CMD36 (MMC_CMDIDX36 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define MMC_CMD37 (MMC_CMDIDX37 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define MMCSD_CMD38 (MMCSD_CMDIDX38|MMCSD_R1B_RESPONSE|MMCSD_NODATAXFR) -#define MMC_CMD39 (MMC_CMDIDX39 |MMCSD_R4_RESPONSE |MMCSD_NODATAXFR) -#define MMC_CMD40 (MMC_CMDIDX40 |MMCSD_R5_RESPONSE |MMCSD_NODATAXFR) -#define MMCSD_CMD42 (MMCSD_CMDIDX42|MMCSD_R1B_RESPONSE|MMCSD_WRDATAXFR) -#define SD_CMD55 (SD_CMDIDX55 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define MMCSD_CMD56 (MMCSD_CMDIDX56|MMCSD_R1_RESPONSE |MMCSD_RDDATAXFR) - -/* SD/SDIO APP commands (must be preceded by CMD55) */ - -#define SD_ACMD6 (SD_ACMDIDX6 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define SD_ACMD13 (SD_ACMDIDX13 |MMCSD_R1_RESPONSE |MMCSD_RDDATAXFR) -#define SD_ACMD18 (SD_ACMDIDX18 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define SD_ACMD22 (SD_ACMDIDX22 |MMCSD_R1_RESPONSE |MMCSD_RDDATAXFR) -#define SD_ACMD23 (SD_ACMDIDX23 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define SD_ACMD25 (SD_ACMDIDX25 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define SD_ACMD38 (SD_ACMDIDX38 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define SD_ACMD41 (SD_ACMDIDX41 |MMCSD_R3_RESPONSE |MMCSD_NODATAXFR) -#define SD_ACMD42 (SD_ACMDIDX42 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define SD_ACMD43 (SD_ACMDIDX43 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define SD_ACMD44 (SD_ACMDIDX44 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define SD_ACMD45 (SD_ACMDIDX45 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define SD_ACMD46 (SD_ACMDIDX46 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define SD_ACMD47 (SD_ACMDIDX47 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define SD_ACMD48 (SD_ACMDIDX48 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define SD_ACMD49 (SD_ACMDIDX49 |MMCSD_R1_RESPONSE |MMCSD_NODATAXFR) -#define SD_ACMD51 (SD_ACMDIDX51 |MMCSD_R1_RESPONSE |MMCSD_RDDATAXFR) -#define SDIO_ACMD52 (SDIO_ACMDIDX52|MMCSD_R5_RESPONSE |MMCSD_NODATAXFR) -#define SDIO_ACMD53 (SDIO_ACMDIDX53|MMCSD_R5_RESPONSE |MMCSD_NODATAXFR) - -/**************************************************************************** - * Name: SDIO_LOCK - * - * Description: - * Lock/unlock the SDIO bus, preventing it from any other transaction - * while locked. - * - * Input Parameters: - * dev - An instance of the SDIO device interface - * state - TRUE/FALSE - * - * Returned Value: - * OK on success. - * - ****************************************************************************/ - -#define SDIO_LOCK(dev,state) ((dev)->lock(dev,state)) - -/**************************************************************************** - * Name: SDIO_RESET - * - * Description: - * Reset the SDIO controller. Undo all setup and initialization. - * - * Input Parameters: - * dev - An instance of the SDIO device interface - * - * Returned Value: - * None - * - ****************************************************************************/ - -#define SDIO_RESET(dev) ((dev)->reset(dev)) - -/**************************************************************************** - * Name: SDIO_STATUS - * - * Description: - * Get SDIO status. - * - * Input Parameters: - * dev - Device-specific state data - * - * Returned Value: - * Returns a bitset of status values (see SDIO_STATUS_* defines) - * - ****************************************************************************/ - -#define SDIO_STATUS(dev) ((dev)->status(dev)) - -/* SDIO status bits */ - -#define SDIO_STATUS_PRESENT 0x01 /* Bit 0=1: SDIO card present */ -#define SDIO_STATUS_WRPROTECTED 0x02 /* Bit 1=1: SDIO card write protected */ - -#define SDIO_PRESENT(dev) ((SDIO_STATUS(dev) & SDIO_STATUS_PRESENT) != 0) -#define SDIO_WRPROTECTED(dev) ((SDIO_STATUS(dev) & SDIO_STATUS_WRPROTECTED) != 0) - -/**************************************************************************** - * Name: SDIO_WIDEBUS - * - * Description: - * Called after change in Bus width has been selected (via ACMD6). Most - * controllers will need to perform some special operations to work - * correctly in the new bus mode. - * - * Input Parameters: - * dev - An instance of the SDIO device interface - * wide - true: wide bus (4-bit) bus mode enabled - * - * Returned Value: - * None - * - ****************************************************************************/ - -#define SDIO_WIDEBUS(dev,wide) ((dev)->widebus(dev,wide)) - -/**************************************************************************** - * Name: SDIO_CLOCK - * - * Description: - * Enable/disable SDIO clocking - * - * Input Parameters: - * dev - An instance of the SDIO device interface - * rate - Specifies the clocking to use (see enum sdio_clock_e) - * - * Returned Value: - * None - * - ****************************************************************************/ - -#define SDIO_CLOCK(dev,rate) ((dev)->clock(dev,rate)) - -/**************************************************************************** - * Name: SDIO_ATTACH - * - * Description: - * Attach and prepare interrupts - * - * Input Parameters: - * dev - An instance of the SDIO device interface - * - * Returned Value: - * OK on success; A negated errno on failure. - * - ****************************************************************************/ - -#define SDIO_ATTACH(dev) ((dev)->attach(dev)) - -/**************************************************************************** - * Name: SDIO_SENDCMD - * - * Description: - * Send the SDIO command - * - * Input Parameters: - * dev - An instance of the SDIO device interface - * cmd - The command to send. See 32-bit command definitions above. - * arg - 32-bit argument required with some commands - * data - A reference to data required with some commands - * - * Returned Value: - * None - * - ****************************************************************************/ - -#define SDIO_SENDCMD(dev,cmd,arg) ((dev)->sendcmd(dev,cmd,arg)) - -/**************************************************************************** - * Name: SDIO_BLOCKLEN - * - * Description: - * Some hardward needs to be informed of the selected blocksize and the - * number of blocks. Others just work on the byte stream. - * - * Input Parameters: - * dev - An instance of the SDIO device interface - * blocklen - The selected block size. - * nblocks - The number of blocks to be transferred. - * - * Returned Value: - * None - * - ****************************************************************************/ - -#ifdef CONFIG_SDIO_BLOCKSETUP -# define SDIO_BLOCKSETUP(dev,blocklen,nblocks) ((dev)->blocksetup(dev,blocklen,nblocks)) -#else -# define SDIO_BLOCKSETUP(dev,blocklen,nblocks) -#endif - -/**************************************************************************** - * Name: SDIO_RECVSETUP - * - * Description: - * Setup hardware in preparation for data transfer from the card in non-DMA - * (interrupt driven mode). This method will do whatever controller setup - * is necessary. This would be called for SD memory just BEFORE sending - * CMD13 (SEND_STATUS), CMD17 (READ_SINGLE_BLOCK), CMD18 - * (READ_MULTIPLE_BLOCKS), ACMD51 (SEND_SCR), etc. Normally, SDIO_WAITEVENT - * will be called to receive the indication that the transfer is complete. - * - * Input Parameters: - * dev - An instance of the SDIO device interface - * buffer - Address of the buffer in which to receive the data - * nbytes - The number of bytes in the transfer - * - * Returned Value: - * Number of bytes sent on success; a negated errno on failure - * - ****************************************************************************/ - -#define SDIO_RECVSETUP(dev,buffer,nbytes) ((dev)->recvsetup(dev,buffer,nbytes)) - -/**************************************************************************** - * Name: SDIO_SENDSETUP - * - * Description: - * Setup hardware in preparation for data transfer from the card. This method - * will do whatever controller setup is necessary. This would be called - * for SD memory just AFTER sending CMD24 (WRITE_BLOCK), CMD25 - * (WRITE_MULTIPLE_BLOCK), ... and before SDIO_SENDDATA is called. - * - * Input Parameters: - * dev - An instance of the SDIO device interface - * buffer - Address of the buffer containing the data to send - * nbytes - The number of bytes in the transfer - * - * Returned Value: - * Number of bytes sent on success; a negated errno on failure - * - ****************************************************************************/ - -#define SDIO_SENDSETUP(dev,buffer,nbytes) ((dev)->sendsetup(dev,buffer,nbytes)) - -/**************************************************************************** - * Name: SDIO_CANCEL - * - * Description: - * Cancel the data transfer setup of SDIO_RECVSETUP, SDIO_SENDSETUP, - * SDIO_DMARECVSETUP or SDIO_DMASENDSETUP. This must be called to cancel - * the data transfer setup if, for some reason, you cannot perform the - * transfer. - * - * Input Parameters: - * dev - An instance of the SDIO device interface - * - * Returned Value: - * OK is success; a negated errno on failure - * - ****************************************************************************/ - -#define SDIO_CANCEL(dev) ((dev)->cancel(dev)) - -/**************************************************************************** - * Name: SDIO_WAITRESPONSE - * - * Description: - * Poll-wait for the response to the last command to be ready. This - * function should be called even after sending commands that have no - * response (such as CMD0) to make sure that the hardware is ready to - * receive the next command. - * - * Input Parameters: - * dev - An instance of the SDIO device interface - * cmd - The command that was sent. See 32-bit command definitions above. - * - * Returned Value: - * OK is success; a negated errno on failure - * - ****************************************************************************/ - -#define SDIO_WAITRESPONSE(dev,cmd) ((dev)->waitresponse(dev,cmd)) - -/**************************************************************************** - * Name: SDIO_RECVRx - * - * Description: - * Receive response to SDIO command. Only the critical payload is - * returned -- that is 32 bits for 48 bit status and 128 bits for 136 bit - * status. The driver implementation should verify the correctness of - * the remaining, non-returned bits (CRCs, CMD index, etc.). - * - * Input Parameters: - * dev - An instance of the SDIO device interface - * Rx - Buffer in which to receive the response - * - * Returned Value: - * Number of bytes sent on success; a negated errno on failure. Here a - * failure means only a faiure to obtain the requested reponse (due to - * transport problem -- timeout, CRC, etc.). The implementation only - * assures that the response is returned intacta and does not check errors - * within the response itself. - * - ****************************************************************************/ - -#define SDIO_RECVR1(dev,cmd,R1) ((dev)->recvR1(dev,cmd,R1)) /* 48-bit */ -#define SDIO_RECVR2(dev,cmd,R2) ((dev)->recvR2(dev,cmd,R2)) /* 136-bit */ -#define SDIO_RECVR3(dev,cmd,R3) ((dev)->recvR3(dev,cmd,R3)) /* 48-bit */ -#define SDIO_RECVR4(dev,cmd,R4) ((dev)->recvR4(dev,cmd,R4)) /* 48-bit */ -#define SDIO_RECVR5(dev,cmd,R5) ((dev)->recvR5(dev,cmd,R5)) /* 48-bit */ -#define SDIO_RECVR6(dev,cmd,R6) ((dev)->recvR6(dev,cmd,R6)) /* 48-bit */ -#define SDIO_RECVR7(dev,cmd,R7) ((dev)->recvR7(dev,cmd,R7)) /* 48-bit */ - -/**************************************************************************** - * Name: SDIO_WAITENABLE - * - * Description: - * Enable/disable of a set of SDIO wait events. This is part of the - * the SDIO_WAITEVENT sequence. The set of to-be-waited-for events is - * configured before calling SDIO_EVENTWAIT. This is done in this way - * to help the driver to eliminate race conditions between the command - * setup and the subsequent events. - * - * The enabled events persist until either (1) SDIO_WAITENABLE is called - * again specifying a different set of wait events, or (2) SDIO_EVENTWAIT - * returns. - * - * Input Parameters: - * dev - An instance of the SDIO device interface - * eventset - A bitset of events to enable or disable (see SDIOWAIT_* - * definitions). 0=disable; 1=enable. - * - * Returned Value: - * None - * - ****************************************************************************/ - -#define SDIO_WAITENABLE(dev,eventset) ((dev)->waitenable(dev,eventset)) - -/**************************************************************************** - * Name: SDIO_EVENTWAIT - * - * Description: - * Wait for one of the enabled events to occur (or a timeout). Note that - * all events enabled by SDIO_WAITEVENTS are disabled when SDIO_EVENTWAIT - * returns. SDIO_WAITEVENTS must be called again before SDIO_EVENTWAIT - * can be used again. - * - * Input Parameters: - * dev - An instance of the SDIO device interface - * timeout - Maximum time in milliseconds to wait. Zero means immediate - * timeout with no wait. The timeout value is ignored if - * SDIOWAIT_TIMEOUT is not included in the waited-for eventset. - * - * Returned Value: - * Event set containing the event(s) that ended the wait. Should always - * be non-zero. All events are disabled after the wait concludes. - * - ****************************************************************************/ - -#define SDIO_EVENTWAIT(dev,timeout) ((dev)->eventwait(dev,timeout)) - -/**************************************************************************** - * Name: SDIO_CALLBACKENABLE - * - * Description: - * Enable/disable of a set of SDIO callback events. This is part of the - * the SDIO callback sequence. The set of events is configured to enabled - * callbacks to the function provided in SDIO_REGISTERCALLBACK. - * - * Events are automatically disabled once the callback is performed and no - * further callback events will occur until they are again enabled by - * calling this methos. - * - * Input Parameters: - * dev - An instance of the SDIO device interface - * eventset - A bitset of events to enable or disable (see SDIOMEDIA_* - * definitions). 0=disable; 1=enable. - * - * Returned Value: - * None - * - ****************************************************************************/ - -#define SDIO_CALLBACKENABLE(dev,eventset) ((dev)->callbackenable(dev,eventset)) - -/**************************************************************************** - * Name: SDIO_REGISTERCALLBACK - * - * Description: - * Register a callback that that will be invoked on any media status - * change. Callbacks should not be made from interrupt handlers, rather - * interrupt level events should be handled by calling back on the work - * thread. - * - * When this method is called, all callbacks should be disabled until they - * are enabled via a call to SDIO_CALLBACKENABLE - * - * Input Parameters: - * dev - Device-specific state data - * callback - The funtion to call on the media change - * arg - A caller provided value to return with the callback - * - * Returned Value: - * 0 on success; negated errno on failure. - * - ****************************************************************************/ - -#define SDIO_REGISTERCALLBACK(d,c,a) ((d)->registercallback(d,c,a)) - -/**************************************************************************** - * Name: SDIO_DMASUPPORTED - * - * Description: - * Return true if the hardware can support DMA - * - * Input Parameters: - * dev - An instance of the SDIO device interface - * - * Returned Value: - * true if DMA is supported. - * - ****************************************************************************/ - -#ifdef CONFIG_SDIO_DMA -# define SDIO_DMASUPPORTED(dev) ((dev)->dmasupported(dev)) -#else -# define SDIO_DMASUPPORTED(dev) (false) -#endif - -/**************************************************************************** - * Name: SDIO_DMARECVSETUP - * - * Description: - * Setup to perform a read DMA. If the processor supports a data cache, - * then this method will also make sure that the contents of the DMA memory - * and the data cache are coherent. For read transfers this may mean - * invalidating the data cache. Upon return, DMA is enable and waiting. - * - * Input Parameters: - * dev - An instance of the SDIO device interface - * buffer - The memory to DMA from - * buflen - The size of the DMA transfer in bytes - * - * Returned Value: - * OK on success; a negated errno on failure - * - ****************************************************************************/ - -#ifdef CONFIG_SDIO_DMA -# define SDIO_DMARECVSETUP(dev,buffer,len) ((dev)->dmarecvsetup(dev,buffer,len)) -#else -# define SDIO_DMARECVSETUP(dev,buffer,len) (-ENOSYS) -#endif - -/**************************************************************************** - * Name: SDIO_DMASENDSETUP - * - * Description: - * Setup to perform a write DMA. If the processor supports a data cache, - * then this method will also make sure that the contents of the DMA memory - * and the data cache are coherent. For write transfers, this may mean - * flushing the data cache. Upon return, DMA is enable and waiting. - * - * Input Parameters: - * dev - An instance of the SDIO device interface - * buffer - The memory to DMA into - * buflen - The size of the DMA transfer in bytes - * - * Returned Value: - * OK on success; a negated errno on failure - * - ****************************************************************************/ - -#ifdef CONFIG_SDIO_DMA -# define SDIO_DMASENDSETUP(dev,buffer,len) ((dev)->dmasendsetup(dev,buffer,len)) -#else -# define SDIO_DMASENDSETUP(dev,buffer,len) (-ENOSYS) -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* Various clocking used by the SDIO driver */ - -enum sdio_clock_e -{ - CLOCK_SDIO_DISABLED = 0, /* Clock is disabled */ - CLOCK_IDMODE, /* Initial ID mode clocking (<400KHz) */ - CLOCK_MMC_TRANSFER, /* MMC normal operation clocking */ - CLOCK_SD_TRANSFER_1BIT, /* SD normal operation clocking (narrow 1-bit mode) */ - CLOCK_SD_TRANSFER_4BIT /* SD normal operation clocking (wide 4-bit mode) */ -}; - -/* Event set. A uint8_t is big enough to hold a set of 8-events. If more are - * needed, change this to a uint16_t. - */ - -typedef uint8_t sdio_eventset_t; - -/* This structure defines the interface between the NuttX SDIO - * driver and the chip- or board-specific SDIO interface. This - * interface is only used in architectures that support SDIO - * 1- or 4-bit data busses. For SDIO support this interface is - * registered with the NuttX SDIO driver by calling - * sdio_slotinitialize(). - */ - -struct sdio_dev_s -{ - /* See descriptions of each method in the access macros provided - * above. - */ - - /* Mutual exclusion */ - -#ifdef CONFIG_SDIO_MUXBUS - int (*lock)(FAR struct sdio_dev_s *dev, bool lock); -#endif - - /* Initialization/setup */ - - void (*reset)(FAR struct sdio_dev_s *dev); - uint8_t (*status)(FAR struct sdio_dev_s *dev); - void (*widebus)(FAR struct sdio_dev_s *dev, bool enable); - void (*clock)(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate); - int (*attach)(FAR struct sdio_dev_s *dev); - - /* Command/Status/Data Transfer */ - - int (*sendcmd)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t arg); -#ifdef CONFIG_SDIO_BLOCKSETUP - void (*blocksetup)(FAR struct sdio_dev_s *dev, unsigned int blocklen, - unsigned int nblocks); -#endif - int (*recvsetup)(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer, - size_t nbytes); - int (*sendsetup)(FAR struct sdio_dev_s *dev, FAR const uint8_t *buffer, - size_t nbytes); - int (*cancel)(FAR struct sdio_dev_s *dev); - - int (*waitresponse)(FAR struct sdio_dev_s *dev, uint32_t cmd); - int (*recvR1)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R1); - int (*recvR2)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t R2[4]); - int (*recvR3)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R3); - int (*recvR4)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R4); - int (*recvR5)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R5); - int (*recvR6)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R6); - int (*recvR7)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R7); - - /* Event/Callback support */ - - void (*waitenable)(FAR struct sdio_dev_s *dev, sdio_eventset_t eventset); - sdio_eventset_t (*eventwait)(FAR struct sdio_dev_s *dev, uint32_t timeout); - void (*callbackenable)(FAR struct sdio_dev_s *dev, - sdio_eventset_t eventset); - int (*registercallback)(FAR struct sdio_dev_s *dev, - worker_t callback, void *arg); - - /* DMA. CONFIG_SDIO_DMA should be set if the driver supports BOTH DMA - * and non-DMA transfer modes. If the driver supports only one mode - * CONFIG_SDIO_DMA is not required. - */ - -#ifdef CONFIG_SDIO_DMA - bool (*dmasupported)(FAR struct sdio_dev_s *dev); - int (*dmarecvsetup)(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer, - size_t buflen); - int (*dmasendsetup)(FAR struct sdio_dev_s *dev, FAR const uint8_t *buffer, - size_t buflen); -#endif -}; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif -#endif /* __INCLUDE_NUTTX_SDIO_H */ diff --git a/nuttx/include/nuttx/sensors/lis331dl.h b/nuttx/include/nuttx/sensors/lis331dl.h deleted file mode 100644 index 2e83dbe1f..000000000 --- a/nuttx/include/nuttx/sensors/lis331dl.h +++ /dev/null @@ -1,142 +0,0 @@ -/**************************************************************************** - * include/nuttx/sensors/lis331dl.h - * - * Copyright (C) 2011 Uros Platise. All rights reserved. - * - * Authors: 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. - * - ****************************************************************************/ - -/** \file - * \author Uros Platise - * \brief ST LIS331DL I2C Device Driver - **/ - -#ifndef __INCLUDE_NUTTX_SENSORS_LIS331DL_H -#define __INCLUDE_NUTTX_SENSORS_LIS331DL_H - -#include -#include - -/************************************************************************************ - * Pre-Processor Declarations - ************************************************************************************/ - -#ifndef __ASSEMBLY__ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - - -/************************************************************************************ - * Public Data Types - ************************************************************************************/ - -struct lis331dl_dev_s; - -struct lis331dl_vector_s { - int8_t x, y, z; -}; - - -/************************************************************************************ - * Public Function Prototypes - ************************************************************************************/ - -/** Initialize ST LIS331DL Chip - * - * \param i2c I2C Device Structure - * \param address I2C Address of the proposed device - * \return Pointer to newly allocated ST LIS331DL structure or NULL on error with errno set. - * - * Possible errno as set by this function on error: - * - ENODEV: When device addressed on given address is not compatible or it is not a LIS331DL - * - EFAULT: When there is no device at given address. - * - EBUSY: When device is already addressed by other device driver (not yet supported by low-level driver) - **/ -EXTERN struct lis331dl_dev_s * lis331dl_init(struct i2c_dev_s * i2c, uint16_t address); - -/** Deinitialize ST LIS331DL Chip - * - * \param dev Device to LIS331DL device structure, as returned by the lis331dl_init() - * \return OK On success - * - **/ -EXTERN int lis331dl_deinit(struct lis331dl_dev_s * dev); - -/** Power up device, start conversion */ -EXTERN int lis331dl_powerup(struct lis331dl_dev_s * dev); - -/** Power down device, stop conversion */ -EXTERN int lis331dl_powerdown(struct lis331dl_dev_s * dev); - -/** Configure conversion - * - * \param dev Device to LIS331DL device structure - * \param full When set, range of [-9g, 9g] is selected, otherwise [-2g, +2g] - * \param fast When set, conversion operates at 400 Hz, otherwise at 100 Hz - * \return OK on success or errno is set - **/ -EXTERN int lis331dl_setconversion(struct lis331dl_dev_s * dev, bool full, bool fast); - -/** Get precision - * - * \return Precision of 1 LSB in terms of unit [mg] - **/ -EXTERN int lis331dl_getprecision(struct lis331dl_dev_s * dev); - -/** Get sample rate - * - * \return Sample rate in unit of [Hz] - **/ -EXTERN int lis331dl_getsamplerate(struct lis331dl_dev_s * dev); - -/** Get readings, updates internal data structure - * - * \param dev Device to LIS331DL device structure - * \return Ptr to vector acceleration [x,y,z] on success, or NULL on error with errno set. - * If data is not yet ready to be read from the LIS331 then errno is set to EAGAIN otherwise - * errno is set by I2C_TRANSFER(). - */ -EXTERN const struct lis331dl_vector_s * lis331dl_getreadings(struct lis331dl_dev_s * dev); - - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __ASSEMBLY__ */ -#endif /* __INCLUDE_NUTTX_SENSORS_LIS331DL_H */ diff --git a/nuttx/include/nuttx/sensors/lm75.h b/nuttx/include/nuttx/sensors/lm75.h deleted file mode 100644 index d34509ada..000000000 --- a/nuttx/include/nuttx/sensors/lm75.h +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** - * include/nuttx/lm75.h - * - * Copyright (C) 2011-2012 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 __NUTTX_SENSORS_LM75_H -#define __NUTTX_SENSORS_LM75_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************ - * CONFIG_I2C - Enables support for I2C drivers - * CONFIG_I2C_LM75 - Enables support for the LM-75 driver - */ - -#define CONFIG_LM75_BASEADDR 0x48 - -/* IOCTL Commands ***********************************************************/ - -#define SNIOC_READCONF _SNIOC(0x0001) /* Arg: uint8_t* pointer */ -#define SNIOC_WRITECONF _SNIOC(0x0002) /* Arg: uint8_t value */ -#define SNIOC_SHUTDOWN _SNIOC(0x0003) /* Arg: None */ -#define SNIOC_POWERUP _SNIOC(0x0004) /* Arg: None */ -#define SNIOC_FAHRENHEIT _SNIOC(0x0005) /* Arg: None */ -#define SNIOC_CENTIGRADE _SNIOC(0x0006) /* Arg: None */ -#define SNIOC_READTHYS _SNIOC(0x0007) /* Arg: b16_t* pointer */ -#define SNIOC_WRITETHYS _SNIOC(0x0008) /* Arg: b16_t value */ -#define SNIOC_READTOS _SNIOC(0x0009) /* Arg: b16_t* pointer */ -#define SNIOC_WRITRETOS _SNIOC(0x000a) /* Arg: b16_t value */ - -/* LM-75 Register Definitions ***********************************************/ -/* LM-75 Registers addresses */ - -#define LM75_TEMP_REG 0x00 /* Temperature Register */ -#define LM75_CONF_REG 0x01 /* Configuration Register */ -#define LM75_THYS_REG 0x02 /* Temperature Register */ -#define LM75_TOS_REG 0x03 /* Over-temp Shutdown Threshold Register */ - -/* Configuration Register Bit Definitions */ - -#define LM75_CONF_SHUTDOWN (1 << 0) /* Bit 0: Put LM75 goes in low power shutdown mode */ -#define LM75_CONF_INTMODE (1 << 1) /* Bit 1: 0=Comparator 1=Interrupt mode */ -#define LM75_CONF_POLARITY (1 << 2) /* Bit 2: 0=O.S. Active low 1=active high */ -#define LM75_CONF_FAULTQ (3) /* Bits 3-4: # faults before setting O.S. */ - -/* NOTE: When temperature values are read, they are return as b16_t, fixed - * precision integer values (see include/fixedmath.h). - */ - -/**************************************************************************** - * Global Data - ****************************************************************************/ - -/**************************************************************************** - * Global Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Global Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: lm75_register - * - * Description: - * Register the LM-75 character device as 'devpath' - * - * Input Parameters: - * devpath - The full path to the driver to register. E.g., "/dev/temp0" - * i2c - An instance of the I2C interface to use to communicate with LM75 - * addr - The I2C address of the LM-75. The base I2C address of the LM75 - * is 0x48. Bits 0-3 can be controlled to get 8 unique addresses from 0x48 - * through 0x4f. - * - * Returned Value: - * Zero (OK) on success; a negated errno value on failure. - * - ****************************************************************************/ - -EXTERN int lm75_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c, - uint8_t addr); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __NUTTX_SENSORS_LM75_H */ diff --git a/nuttx/include/nuttx/sensors/qencoder.h b/nuttx/include/nuttx/sensors/qencoder.h deleted file mode 100644 index d21fa1248..000000000 --- a/nuttx/include/nuttx/sensors/qencoder.h +++ /dev/null @@ -1,180 +0,0 @@ -/**************************************************************************** - * include/nuttx/qencoder.h - * - * Copyright (C) 2012 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 __NUTTX_SENSORS_QENCODER_H -#define __NUTTX_SENSORS_QENCODER_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#ifdef CONFIG_QENCODER - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************ - * CONFIG_QENCODER - Enables support for the quadrature encoder upper half - */ - -/* IOCTL Commands ***********************************************************/ -/* The Quadrature Encode module uses a standard character driver framework. - * However, since the driver is a devices control interface and not a data - * transfer interface, the majority of the functionality is implemented in - * driver ioctl calls. The PWM ioctal commands are lised below: - * - * QEIOC_POSITION - Get the current position from the encoder. - * Argument: int32_t pointer to the location to return the position. - * QEIOC_RESET - Reset the position to zero. - * Argument: None - */ - -#define QEIOC_POSITION _QEIOC(0x0001) /* Arg: int32_t* pointer */ -#define QEIOC_RESET _QEIOC(0x0002) /* Arg: None */ - -/* User defined ioctl cms should use QEIOC_USER like this: - * - * #define QEIOC_MYCMD1 _QEIOC(QEIOC_USER) - * #define QEIOC_MYCMD2 _QEIOC(QEIOC_USER+1) - * ... - */ - -#define QEIOC_USER 0x0003 - -/**************************************************************************** - * Public Types - ****************************************************************************/ -/* This is the vtable that is used to by the upper half quadrature encoder - * to call back into the lower half quadrature encoder. - */ - -struct qe_lowerhalf_s; -struct qe_ops_s -{ - /* This method is called when the driver is opened. The lower half driver - * should configure and initialize the device so that it is ready for use. - * The initial position value should be zero. - */ - - CODE int (*setup)(FAR struct qe_lowerhalf_s *lower); - - /* This method is called when the driver is closed. The lower half driver - * should stop data collection, free any resources, disable timer hardware, and - * put the system into the lowest possible power usage state - */ - - CODE int (*shutdown)(FAR struct qe_lowerhalf_s *lower); - - /* Return the current position measurement. */ - - CODE int (*position)(FAR struct qe_lowerhalf_s *lower, int32_t *pos); - - /* Reset the position measurement to zero. */ - - CODE int (*reset)(FAR struct qe_lowerhalf_s *lower); - - /* Lower-half logic may support platform-specific ioctl commands */ - - CODE int (*ioctl)(FAR struct qe_lowerhalf_s *lower, - int cmd, unsigned long arg); -}; - -/* This is the interface between the lower half quadrature encoder driver - * and the upper half quadrature encoder driver. A (device-specific) - * instance of this structure is passed to the upper-half driver when the - * quadrature encoder driver is registered. - * - * Normally that lower half logic will have its own, custom state structure - * that is simply cast to struct qe_lowerhalf_s. In order to perform such casts, - * the initial fields of the custom state structure match the initial fields - * of the following generic lower half state structure. - */ - -struct qe_lowerhalf_s -{ - /* The first field of this state structure must be a pointer to the lower- - * half callback structure: - */ - - FAR const struct qe_ops_s *ops; - - /* The custom timer state structure may include additional fields after - * the pointer to the callback structure. - */ - -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Name: qe_register - * - * Description: - * Register the Quadrature Encoder lower half device as 'devpath' - * - * Input Parameters: - * devpath - The full path to the driver to register. E.g., "/dev/qe0" - * lower - An instance of the lower half interface - * - * Returned Value: - * Zero (OK) on success; a negated errno value on failure. - * - ****************************************************************************/ - -EXTERN int qe_register(FAR const char *devpath, FAR struct qe_lowerhalf_s *lower); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_QENCODER */ -#endif /* __NUTTX_SENSORS_QENCODER_H */ diff --git a/nuttx/include/nuttx/sercomm/msgb.h b/nuttx/include/nuttx/sercomm/msgb.h deleted file mode 100644 index 64825c1ea..000000000 --- a/nuttx/include/nuttx/sercomm/msgb.h +++ /dev/null @@ -1,176 +0,0 @@ -#ifndef _MSGB_H -#define _MSGB_H - -/* (C) 2008-2010 by Harald Welte - * - * This source code is derivated from Osmocom-BB project and was - * relicensed as BSD with permission from original authors. - * - * 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 - -struct msgb { - struct llist_head list; - - /* the layer 1 header, if any */ - unsigned char *l1h; - /* the A-bis layer 2 header: OML, RSL(RLL), NS */ - unsigned char *l2h; - /* the layer 3 header. For OML: FOM; RSL: 04.08; GPRS: BSSGP */ - unsigned char *l3h; - - uint16_t data_len; - uint16_t len; - - unsigned char *head; /* start of buffer */ - unsigned char *tail; /* end of message */ - unsigned char *data; /* start of message */ - unsigned char _data[0]; -}; - -extern struct msgb *msgb_alloc(uint16_t size, const char *name); -extern void msgb_free(struct msgb *m); -extern void msgb_enqueue(struct llist_head *queue, struct msgb *msg); -extern struct msgb *msgb_dequeue(struct llist_head *queue); -extern void msgb_reset(struct msgb *m); - -#define msgb_l1(m) ((void *)(m->l1h)) -#define msgb_l2(m) ((void *)(m->l2h)) -#define msgb_l3(m) ((void *)(m->l3h)) - -static inline unsigned int msgb_l1len(const struct msgb *msgb) -{ - return msgb->tail - (uint8_t *)msgb_l1(msgb); -} - -static inline unsigned int msgb_l2len(const struct msgb *msgb) -{ - return msgb->tail - (uint8_t *)msgb_l2(msgb); -} - -static inline unsigned int msgb_l3len(const struct msgb *msgb) -{ - return msgb->tail - (uint8_t *)msgb_l3(msgb); -} - -static inline unsigned int msgb_headlen(const struct msgb *msgb) -{ - return msgb->len - msgb->data_len; -} -static inline int msgb_tailroom(const struct msgb *msgb) -{ - return (msgb->head + msgb->data_len) - msgb->tail; -} -static inline unsigned char *msgb_put(struct msgb *msgb, unsigned int len) -{ - unsigned char *tmp = msgb->tail; - - /* we intentionally call cons_puts() here to display an allocation - * failure on the _other_ serial port (i.e. the one that doesn't - * have the HDLC layer on it */ - if (msgb_tailroom(msgb) < len) - cons_puts("msgb_tailroom insufficient!\n"); - - msgb->tail += len; - msgb->len += len; - return tmp; -} -static inline void msgb_put_u8(struct msgb *msgb, uint8_t word) -{ - uint8_t *space = msgb_put(msgb, 1); - space[0] = word & 0xFF; -} -static inline void msgb_put_u16(struct msgb *msgb, uint16_t word) -{ - uint8_t *space = msgb_put(msgb, 2); - space[0] = word >> 8 & 0xFF; - space[1] = word & 0xFF; -} -static inline void msgb_put_u32(struct msgb *msgb, uint32_t word) -{ - uint8_t *space = msgb_put(msgb, 4); - space[0] = word >> 24 & 0xFF; - space[1] = word >> 16 & 0xFF; - space[2] = word >> 8 & 0xFF; - space[3] = word & 0xFF; -} -static inline unsigned char *msgb_get(struct msgb *msgb, unsigned int len) -{ - unsigned char *tmp = msgb->data; - msgb->data += len; - msgb->len -= len; - return tmp; -} -static inline uint8_t msgb_get_u8(struct msgb *msgb) -{ - uint8_t *space = msgb_get(msgb, 1); - return space[0]; -} -static inline uint16_t msgb_get_u16(struct msgb *msgb) -{ - uint8_t *space = msgb_get(msgb, 2); - return space[0] << 8 | space[1]; -} -static inline uint32_t msgb_get_u32(struct msgb *msgb) -{ - uint8_t *space = msgb_get(msgb, 4); - return space[0] << 24 | space[1] << 16 | space[2] << 8 | space[3]; -} -static inline unsigned char *msgb_push(struct msgb *msgb, unsigned int len) -{ - msgb->data -= len; - msgb->len += len; - return msgb->data; -} -static inline unsigned char *msgb_pull(struct msgb *msgb, unsigned int len) -{ - msgb->len -= len; - return msgb->data += len; -} - -/* increase the headroom of an empty msgb, reducing the tailroom */ -static inline void msgb_reserve(struct msgb *msg, int len) -{ - msg->data += len; - msg->tail += len; -} - -static inline struct msgb *msgb_alloc_headroom(int size, int headroom, - const char *name) -{ - struct msgb *msg = msgb_alloc(size, name); - if (msg) - msgb_reserve(msg, headroom); - return msg; -} - -#endif /* _MSGB_H */ diff --git a/nuttx/include/nuttx/sercomm/sercomm.h b/nuttx/include/nuttx/sercomm/sercomm.h deleted file mode 100644 index 54256b5a7..000000000 --- a/nuttx/include/nuttx/sercomm/sercomm.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef _SERCOMM_H -#define _SERCOMM_H - -/* SERCOMM layer on UART1 (modem UART) */ - -#include - -#define SERCOMM_UART_NR 1 - -#define HDLC_FLAG 0x7E -#define HDLC_ESCAPE 0x7D - -#define HDLC_C_UI 0x03 -#define HDLC_C_P_BIT (1 << 4) -#define HDLC_C_F_BIT (1 << 4) - -/* a low sercomm_dlci means high priority. A high DLCI means low priority */ -enum sercomm_dlci { - SC_DLCI_HIGHEST = 0, - SC_DLCI_DEBUG = 4, - SC_DLCI_L1A_L23 = 5, - SC_DLCI_LOADER = 9, - SC_DLCI_CONSOLE = 10, - SC_DLCI_ECHO = 128, - _SC_DLCI_MAX -}; - -void sercomm_init(void); -int sercomm_initialized(void); - -/* User Interface: Tx */ - -/* user interface for transmitting messages for a given DLCI */ -void sercomm_sendmsg(uint8_t dlci, struct msgb *msg); -/* how deep is the Tx queue for a given DLCI */ -unsigned int sercomm_tx_queue_depth(uint8_t dlci); - -/* User Interface: Rx */ - -/* receiving messages for a given DLCI */ -typedef void (*dlci_cb_t)(uint8_t dlci, struct msgb *msg); -int sercomm_register_rx_cb(uint8_t dlci, dlci_cb_t cb); - -/* Driver Interface */ - -/* fetch one octet of to-be-transmitted serial data. returns 0 if no more data */ -int sercomm_drv_pull(uint8_t *ch); -/* the driver has received one byte, pass it into sercomm layer. - returns 1 in case of success, 0 in case of unrecognized char */ -int sercomm_drv_rx_char(uint8_t ch); - -static inline struct msgb *sercomm_alloc_msgb(unsigned int len) -{ - return msgb_alloc_headroom(len+4, 4, "sercomm_tx"); -} - -#endif /* _SERCOMM_H */ diff --git a/nuttx/include/nuttx/sercomm/sercomm_cons.h b/nuttx/include/nuttx/sercomm/sercomm_cons.h deleted file mode 100644 index 11f66545c..000000000 --- a/nuttx/include/nuttx/sercomm/sercomm_cons.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _SERCOMM_CONS_H -#define _SERCOMM_CONS_H - -/* how large buffers do we allocate? */ -#define SERCOMM_CONS_ALLOC 256 - -int sercomm_puts(const char *s); -int sercomm_putchar(int c); - -#endif /* _SERCOMM_CONS_H */ diff --git a/nuttx/include/nuttx/serial/serial.h b/nuttx/include/nuttx/serial/serial.h deleted file mode 100644 index 4ee2005ef..000000000 --- a/nuttx/include/nuttx/serial/serial.h +++ /dev/null @@ -1,343 +0,0 @@ -/************************************************************************************ - * include/nuttx/serial/serial.h - * - * Copyright (C) 2007-2008, 2012-2013 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_NUTTX_SERIAL_SERIAL_H -#define __INCLUDE_NUTTX_SERIAL_SERIAL_H - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include - -#include -#include -#include -#include -#ifdef CONFIG_SERIAL_TERMIOS -# include -#endif - -#include - -/************************************************************************************ - * Definitions - ************************************************************************************/ - -/* Maximum number of threads than can be waiting for POLL events */ - -#ifndef CONFIG_SERIAL_NPOLLWAITERS -# define CONFIG_SERIAL_NPOLLWAITERS 2 -#endif - -/* vtable access helpers */ - -#define uart_setup(dev) dev->ops->setup(dev) -#define uart_shutdown(dev) dev->ops->shutdown(dev) -#define uart_attach(dev) dev->ops->attach(dev) -#define uart_detach(dev) dev->ops->detach(dev) -#define uart_enabletxint(dev) dev->ops->txint(dev, true) -#define uart_disabletxint(dev) dev->ops->txint(dev, false) -#define uart_enablerxint(dev) dev->ops->rxint(dev, true) -#define uart_disablerxint(dev) dev->ops->rxint(dev, false) -#define uart_rxavailable(dev) dev->ops->rxavailable(dev) -#define uart_txready(dev) dev->ops->txready(dev) -#define uart_txempty(dev) dev->ops->txempty(dev) -#define uart_send(dev,ch) dev->ops->send(dev,ch) -#define uart_receive(dev,s) dev->ops->receive(dev,s) - -/************************************************************************************ - * Public Types - ************************************************************************************/ - -/* This structure defines one serial I/O buffer. The serial infrastructure will - * initialize the 'sem' field but all other fields must be initialized by the - * caller of uart_register(). - */ - -struct uart_buffer_s -{ - sem_t sem; /* Used to control exclusive access to the buffer */ - volatile int16_t head; /* Index to the head [IN] index in the buffer */ - volatile int16_t tail; /* Index to the tail [OUT] index in the buffer */ - int16_t size; /* The allocated size of the buffer */ - FAR char *buffer; /* Pointer to the allocated buffer memory */ -}; - -/* This structure defines all of the operations providd by the architecture specific - * logic. All fields must be provided with non-NULL function pointers by the - * caller of uart_register(). - */ - -struct uart_dev_s; -struct uart_ops_s -{ - /* Configure the UART baud, bits, parity, fifos, etc. This method is called - * the first time that the serial port is opened. For the serial console, - * this will occur very early in initialization; for other serial ports this - * will occur when the port is first opened. This setup does not include - * attaching or enabling interrupts. That portion of the UART setup is - * performed when the attach() method is called. - */ - - CODE int (*setup)(FAR struct uart_dev_s *dev); - - /* Disable the UART. This method is called when the serial port is closed. - * This method reverses the operation the setup method. NOTE that the serial - * console is never shutdown. - */ - - CODE void (*shutdown)(FAR struct uart_dev_s *dev); - - /* Configure the UART to operation in interrupt driven mode. This method is - * called when the serial port is opened. Normally, this is just after the - * the setup() method is called, however, the serial console may operate in - * a non-interrupt driven mode during the boot phase. - * - * RX and TX interrupts are not enabled when by the attach method (unless the - * hardware supports multiple levels of interrupt enabling). The RX and TX - * interrupts are not enabled until the txint() and rxint() methods are called. - */ - - CODE int (*attach)(FAR struct uart_dev_s *dev); - - /* Detach UART interrupts. This method is called when the serial port is - * closed normally just before the shutdown method is called. The exception is - * the serial console which is never shutdown. - */ - - CODE void (*detach)(FAR struct uart_dev_s *dev); - - /* All ioctl calls will be routed through this method */ - - CODE int (*ioctl)(FAR struct file *filep, int cmd, unsigned long arg); - - /* Called (usually) from the interrupt level to receive one character from - * the UART. Error bits associated with the receipt are provided in the - * the return 'status'. - */ - - CODE int (*receive)(FAR struct uart_dev_s *dev, FAR unsigned int *status); - - /* Call to enable or disable RX interrupts */ - - CODE void (*rxint)(FAR struct uart_dev_s *dev, bool enable); - - /* Return true if the receive data is available */ - - CODE bool (*rxavailable)(FAR struct uart_dev_s *dev); - - /* This method will send one byte on the UART */ - - CODE void (*send)(FAR struct uart_dev_s *dev, int ch); - - /* Call to enable or disable TX interrupts */ - - CODE void (*txint)(FAR struct uart_dev_s *dev, bool enable); - - /* Return true if the tranmsit hardware is ready to send another byte. This - * is used to determine if send() method can be called. - */ - - CODE bool (*txready)(FAR struct uart_dev_s *dev); - - /* Return true if all characters have been sent. If for example, the UART - * hardware implements FIFOs, then this would mean the transmit FIFO is - * empty. This method is called when the driver needs to make sure that - * all characters are "drained" from the TX hardware. - */ - - CODE bool (*txempty)(FAR struct uart_dev_s *dev); -}; - -/* This is the device structure used by the driver. The caller of - * uart_register() must allocate and initialize this structure. The - * calling logic need only set all fields to zero except: - * - * 'isconsole', 'xmit.buffer', 'rcv.buffer', the elements - * of 'ops', and 'private' - * - * The common logic will initialize all semaphores. - */ - -struct uart_dev_s -{ - uint8_t open_count; /* Number of times the device has been opened */ - volatile bool xmitwaiting; /* true: User waiting for space in xmit.buffer */ - volatile bool recvwaiting; /* true: User waiting for data in recv.buffer */ -#ifdef CONFIG_SERIAL_REMOVABLE - volatile bool disconnected; /* true: Removable device is not connected */ -#endif - bool isconsole; /* true: This is the serial console */ - sem_t closesem; /* Locks out new open while close is in progress */ - sem_t xmitsem; /* Wakeup user waiting for space in xmit.buffer */ - sem_t recvsem; /* Wakeup user waiting for data in recv.buffer */ -#ifndef CONFIG_DISABLE_POLL - sem_t pollsem; /* Manages exclusive access to fds[] */ -#endif - struct uart_buffer_s xmit; /* Describes transmit buffer */ - struct uart_buffer_s recv; /* Describes receive buffer */ - FAR const struct uart_ops_s *ops; /* Arch-specific operations */ - FAR void *priv; /* Used by the arch-specific logic */ - - /* The following is a list if poll structures of threads waiting for - * driver events. The 'struct pollfd' reference for each open is also - * retained in the f_priv field of the 'struct file'. - */ - -#ifndef CONFIG_DISABLE_POLL - struct pollfd *fds[CONFIG_SERIAL_NPOLLWAITERS]; -#endif - - /* Terminal control flags */ - -#ifdef CONFIG_SERIAL_TERMIOS - tcflag_t tc_iflag; /* Input modes */ - tcflag_t tc_oflag; /* Output modes */ - tcflag_t tc_lflag; /* Local modes */ -#endif - -}; - -typedef struct uart_dev_s uart_dev_t; - -/************************************************************************************ - * Public Data - ************************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" -{ -#else -#define EXTERN extern -#endif - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -/************************************************************************************ - * Name: uart_register - * - * Description: - * Register serial console and serial ports. - * - ************************************************************************************/ - -int uart_register(FAR const char *path, FAR uart_dev_t *dev); - -/************************************************************************************ - * Name: uart_xmitchars - * - * Description: - * This function is called from the UART interrupt handler when an interrupt - * is received indicating that there is more space in the transmit FIFO. This - * function will send characters from the tail of the xmit buffer while the driver - * write() logic adds data to the head of the xmit buffer. - * - ************************************************************************************/ - -void uart_xmitchars(FAR uart_dev_t *dev); - -/************************************************************************************ - * Name: uart_receivechars - * - * Description: - * This function is called from the UART interrupt handler when an interrupt - * is received indicating that are bytes available to be received. This - * function will add chars to head of receive buffer. Driver read() logic will take - * characters from the tail of the buffer. - * - ************************************************************************************/ - -void uart_recvchars(FAR uart_dev_t *dev); - -/************************************************************************************ - * Name: uart_datareceived - * - * Description: - * This function is called from uart_recvchars when new serial data is place in - * the driver's circular buffer. This function will wake-up any stalled read() - * operations that are waiting for incoming data. - * - ************************************************************************************/ - -void uart_datareceived(FAR uart_dev_t *dev); - -/************************************************************************************ - * Name: uart_datasent - * - * Description: - * This function is called from uart_xmitchars after serial data has been sent, - * freeing up some space in the driver's circular buffer. This function will - * wake-up any stalled write() operations that was waiting for space to buffer - * outgoing data. - * - ************************************************************************************/ - -void uart_datasent(FAR uart_dev_t *dev); - -/************************************************************************************ - * Name: uart_connected - * - * Description: - * Serial devices (like USB serial) can be removed. In that case, the "upper - * half" serial driver must be informed that there is no longer a valid serial - * channel associated with the driver. - * - * In this case, the driver will terminate all pending transfers wint ENOTCONN and - * will refuse all further transactions while the "lower half" is disconnected. - * The driver will continue to be registered, but will be in an unusable state. - * - * Conversely, the "upper half" serial driver needs to know when the serial - * device is reconnected so that it can resume normal operations. - * - * Assumptions/Limitations: - * This function may be called from an interrupt handler. - * - ************************************************************************************/ - -#ifdef CONFIG_SERIAL_REMOVABLE -void uart_connected(FAR uart_dev_t *dev, bool connected); -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_SERIAL_SERIAL_H */ diff --git a/nuttx/include/nuttx/serial/tioctl.h b/nuttx/include/nuttx/serial/tioctl.h deleted file mode 100644 index a98b487a6..000000000 --- a/nuttx/include/nuttx/serial/tioctl.h +++ /dev/null @@ -1,225 +0,0 @@ -/******************************************************************************************** - * include/nuttx/serial/tioctl.h - * - * Copyright (C) 2011-2013 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 function should not be included directly. Rather, it should be included indirectly - * via include/nuttx/fs/ioctl.h. - */ - -#ifndef __INCLUDE_NUTTX_SERIAL_TIOCTL_H -#define __INCLUDE_NUTTX_SERIAL_TIOCTL_H - -/******************************************************************************************** - * Included Files - ********************************************************************************************/ - -#include - -/******************************************************************************************** - * Pre-Processor Definitions - ********************************************************************************************/ - -/* Get and Set Terminal Attributes (see termios.h) */ - -#define TCGETS _TIOC(0x0001) /* Get serial port settings: FAR struct termios* */ -#define TCSETS _TIOC(0x0002) /* Set serial port settings: FAR const struct termios* */ -#define TCSETSW _TIOC(0x0003) /* Drain output and set serial port settings: FAR const struct termios* */ -#define TCSETSF _TIOC(0x0004) /* Drain output, discard intput, and set serial port settings: FAR const struct termios* */ -#define TCGETA _TIOC(0x0005) /* See TCGETS: FAR struct termio* */ -#define TCSETA _TIOC(0x0006) /* See TCSETS: FAR const struct termio* */ -#define TCSETAW _TIOC(0x0007) /* See TCSETSF: FAR const struct termio* */ -#define TCSETAF _TIOC(0x0008) /* See TCSETSF: FAR const struct termio* */ - -/* Locking the termios structure */ - -#define TIOCGLCKTRMIOS _TIOC(0x0009) /* Get termios lock status: FAR struct termios* */ -#define TIOCSLCKTRMIOS _TIOC(0x000a) /* Set termios lock status: FAR const struct termios* */ - -/* Get and Set Window Size */ - -#define TIOCGWINSZ _TIOC(0x000b) /* Get window size: FAR struct winsize */ -#define TIOCSWINSZ _TIOC(0x000c) /* Set window size: FAR const struct winsize */ - -/* Send a break */ - -#define TCSBRK _TIOC(0x000d) /* Send a break: int */ -#define TCSBRKP _TIOC(0x000e) /* Send a POSIX break: int */ -#define TIOCSBRK _TIOC(0x000f) /* Turn break on: void */ -#define TIOCCBRK _TIOC(0x0010) /* Turn break off: void */ - -/* Software flow control */ - -#define TCXONC _TIOC(0x0011) /* Control flow control: int */ - -/* Buffer count and flushing */ - -#define TIOCINQ _TIOC(0x0012) /* Bytes in input buffer: int */ -#define TIOCOUTQ _TIOC(0x0013) /* Bytes in output buffer: int */ -#define TCFLSH _TIOC(0x0014) /* Flush: int */ - -/* Faking input */ - -#define TIOCSTI _TIOC(0x0015) /* Insert into input: const char */ - -/* Re-directing console output */ - -#define TIOCCONS _TIOC(0x0016) /* Re-direct console output to device: void */ - -/* Controlling TTY */ - -#define TIOCSCTTY _TIOC(0x0017) /* Make controlling TTY: int */ -#define TIOCNOTTY _TIOC(0x0018) /* Give up controllinog TTY: void */ - -/* Exclusive mode */ - -#define TIOCEXCL _TIOC(0x0019) /* Put TTY in exclusive mode: void */ -#define TIOCNXCL _TIOC(0x001a) /* Disable exclusive mode: void */ - -/* Line discipline */ - -#define TIOCGETD _TIOC(0x001b) /* Get line discipline: FAR int */ -#define TIOCSETD _TIOC(0x001c) /* Set line discipline: FAR const int */ - -/* Packet mode */ - -#define TIOCPKT _TIOC(0x001d) /* Control packet mode: FAR const int */ - -# define TIOCPKT_FLUSHREAD (1 << 0) /* The read queue for the terminal is flushed */ -# define TIOCPKT_FLUSHWRITE (1 << 1) /* The write queue for the terminal is flushed */ -# define TIOCPKT_STOP (1 << 2) /* Output to the terminal is stopped */ -# define TIOCPKT_START (1 << 3) /* Output to the terminal is restarted */ -# define TIOCPKT_DOSTOP (1 << 4) /* t_stopc is '^S' and t_startc is '^Q' */ -# define TIOCPKT_NOSTOP (1 << 5) /* The start and stop characters are not '^S/^Q' */ - -/* Modem control */ - -#define TIOCMGET _TIOC(0x001e) /* Get modem status bits: FAR int */ -#define TIOCMSET _TIOC(0x001f) /* Set modem status bits: FAR const int */ -#define TIOCMBIC _TIOC(0x0020) /* Clear modem bits: FAR const int */ -#define TIOCMBIS _TIOC(0x0021) /* Set modem bits: FAR const int */ - -# define TIOCM_LE (1 << 0) /* DSR (data set ready/line enable) */ -# define TIOCM_DTR (1 << 1) /* DTR (data terminal ready) */ -# define TIOCM_RTS (1 << 2) /* RTS (request to send) */ -# define TIOCM_ST (1 << 3) /* Secondary TXD (transmit) */ -# define TIOCM_SR (1 << 4) /* Secondary RXD (receive) */ -# define TIOCM_CTS (1 << 5) /* CTS (clear to send) */ -# define TIOCM_CAR (1 << 6) /* DCD (data carrier detect) */ -# define TIOCM_CD TIOCM_CAR -# define TIOCM_RNG (1 << 7) /* RNG (ring) */ -# define TIOCM_RI TIOCM_RNG -# define TIOCM_DSR (1 << 8) /* DSR (data set ready) */ - -/* TTY shutdown */ - -#define TIOCVHANGUP _TIOC(0x0022) /* Shutdown TTY: void */ - -/* Marking a line as local */ - -#define TIOCGSOFTCAR _TIOC(0x0023) /* Get software carrier flag: FAR int */ -#define TIOCSSOFTCAR _TIOC(0x0024) /* Set software carrier flag: FAR const int */ - -/* Get/set serial line info */ - -#define TIOCGSERIAL _TIOC(0x0025) /* Get serial line info: FAR struct serial_struct */ -#define TIOCSSERIAL _TIOC(0x0026) /* Set serial line info: FAR const struct serial_struct */ -#define TIOCSERGETLSR _TIOC(0x0027) /* Get line status register: FAR int */ - -/* Serial events */ - -#define TIOCMIWAIT _TIOC(0x0028) /* Wait for a change on serial input line(s): void */ -#define TIOCGICOUNT _TIOC(0x0029) /* Read serial port interrupt count: FAR struct serial_icounter_struct */ - -/* RS-485 Support */ - -#define TIOCSRS485 _TIOC(0x002a) /* Set RS485 mode, arg: pointer to struct serial_rs485 */ -#define TIOCGRS485 _TIOC(0x002b) /* Get RS485 mode, arg: pointer to struct serial_rs485 */ - -/* Definitions for flags used in struct serial_rs485 (Linux compatible) */ - -# define SER_RS485_ENABLED (1 << 0) /* Enable/disble RS-485 support */ -# define SER_RS485_RTS_ON_SEND (1 << 1) /* Logic level for RTS pin when sending */ -# define SER_RS485_RTS_AFTER_SEND (1 << 2) /* Logic level for RTS pin after sent */ -# define SER_RS485_RX_DURING_TX (1 << 4) - -/* Single-wire UART support */ - -#define TIOCSSINGLEWIRE _TIOC(0x002c) /* Set single-wire mode */ -#define TIOCGSINGLEWIRE _TIOC(0x002d) /* Get single-wire mode */ - -# define SER_SINGLEWIRE_ENABLED (1 << 0) /* Enable/disable single-wire support */ - -/* Debugging */ - -#define TIOCSERGSTRUCT _TIOC(0x002e) /* Get device TTY structure */ - -/******************************************************************************************** - * Public Type Definitions - ********************************************************************************************/ - -/* Used with TTY ioctls */ - -struct winsize -{ - uint16_t ws_row; - uint16_t ws_col; -/* uint16_t ws_xpixel; unused */ -/* uint16_t ws_ypixel; unused */ -}; - -/* Structure used with TIOCSRS485 and TIOCGRS485 (Linux compatible) */ - -struct serial_rs485 -{ - uint32_t flags; /* See SER_RS485_* definitions */ - uint32_t delay_rts_before_send; /* Delay before send (milliseconds) */ - uint32_t delay_rts_after_send; /* Delay after send (milliseconds) */ -}; - -/******************************************************************************************** - * Public Function Prototypes - ********************************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_SERIAL_TIOCTL_H */ diff --git a/nuttx/include/nuttx/serial/uart_16550.h b/nuttx/include/nuttx/serial/uart_16550.h deleted file mode 100644 index bc7ab8f95..000000000 --- a/nuttx/include/nuttx/serial/uart_16550.h +++ /dev/null @@ -1,351 +0,0 @@ -/************************************************************************************ - * include/nuttx/serial/uart_16550.h - * Serial driver for 16550 UART - * - * Copyright (C) 2011-2012 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_NUTTX_SERIAL_UART_16550_H -#define __INCLUDE_NUTTX_SERIAL_UART_16550_H - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include - -#ifdef CONFIG_16550_UART - -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - -/* CONFIGURATION ********************************************************************/ - -/* Are any UARTs enabled? */ - -#undef HAVE_UART -#if defined(CONFIG_16550_UART0) || defined(CONFIG_16550_UART1) || \ - defined(CONFIG_16550_UART2) || defined(CONFIG_16550_UART3) -# define HAVE_UART 1 -#endif - -/* We need to be told the address increment between registers and the register bit - * width. - */ - -#ifndef CONFIG_16550_REGINCR -# error "CONFIG_16550_REGINCR not defined" -#endif - -#if CONFIG_16550_REGINCR != 1 && CONFIG_16550_REGINCR != 2 && CONFIG_16550_REGINCR != 4 -# error "CONFIG_16550_REGINCR not supported" -#endif - -#ifndef CONFIG_16550_REGWIDTH -# error "CONFIG_16550_REGWIDTH not defined" -#endif - -#if CONFIG_16550_REGWIDTH != 8 && CONFIG_16550_REGWIDTH != 16 && CONFIG_16550_REGWIDTH != 32 -# error "CONFIG_16550_REGWIDTH not supported" -#endif - -#ifndef CONFIG_16550_ADDRWIDTH -# error "CONFIG_16550_ADDRWIDTH not defined" -#endif - -#if CONFIG_16550_ADDRWIDTH != 8 && CONFIG_16550_ADDRWIDTH != 16 && CONFIG_16550_ADDRWIDTH != 32 -# error "CONFIG_16550_ADDRWIDTH not supported" -#endif - -/* If a UART is enabled, then its base address, clock, and IRQ must also be provided */ - -#ifdef CONFIG_16550_UART0 -# ifndef CONFIG_16550_UART0_BASE -# error "CONFIG_16550_UART0_BASE not provided" -# undef CONFIG_16550_UART0 -# endif -# ifndef CONFIG_16550_UART0_CLOCK -# error "CONFIG_16550_UART0_CLOCK not provided" -# undef CONFIG_16550_UART0 -# endif -# ifndef CONFIG_16550_UART0_IRQ -# error "CONFIG_16550_UART0_IRQ not provided" -# undef CONFIG_16550_UART0 -# endif -#endif - -#ifdef CONFIG_16550_UART1 -# ifndef CONFIG_16550_UART1_BASE -# error "CONFIG_16550_UART1_BASE not provided" -# undef CONFIG_16550_UART1 -# endif -# ifndef CONFIG_16550_UART1_CLOCK -# error "CONFIG_16550_UART1_CLOCK not provided" -# undef CONFIG_16550_UART1 -# endif -# ifndef CONFIG_16550_UART1_IRQ -# error "CONFIG_16550_UART1_IRQ not provided" -# undef CONFIG_16550_UART1 -# endif -#endif - -#ifdef CONFIG_16550_UART2 -# ifndef CONFIG_16550_UART2_BASE -# error "CONFIG_16550_UART2_BASE not provided" -# undef CONFIG_16550_UART2 -# endif -# ifndef CONFIG_16550_UART2_CLOCK -# error "CONFIG_16550_UART2_CLOCK not provided" -# undef CONFIG_16550_UART2 -# endif -# ifndef CONFIG_16550_UART2_IRQ -# error "CONFIG_16550_UART2_IRQ not provided" -# undef CONFIG_16550_UART2 -# endif -#endif - -#ifdef CONFIG_16550_UART3 -# ifndef CONFIG_16550_UART3_BASE -# error "CONFIG_16550_UART3_BASE not provided" -# undef CONFIG_16550_UART3 -# endif -# ifndef CONFIG_16550_UART3_CLOCK -# error "CONFIG_16550_UART3_CLOCK not provided" -# undef CONFIG_16550_UART3 -# endif -# ifndef CONFIG_16550_UART3_IRQ -# error "CONFIG_16550_UART3_IRQ not provided" -# undef CONFIG_16550_UART3 -# endif -#endif - -/* Is there a serial console? There should be at most one defined. It could be on - * any UARTn, n=0,1,2,3 - */ - -#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_16550_UART0) -# undef CONFIG_UART1_SERIAL_CONSOLE -# undef CONFIG_UART2_SERIAL_CONSOLE -# undef CONFIG_UART3_SERIAL_CONSOLE -# define HAVE_16550_CONSOLE 1 -#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_16550_UART1) -# undef CONFIG_UART0_SERIAL_CONSOLE -# undef CONFIG_UART2_SERIAL_CONSOLE -# undef CONFIG_UART3_SERIAL_CONSOLE -# define HAVE_16550_CONSOLE 1 -#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_16550_UART2) -# undef CONFIG_UART0_SERIAL_CONSOLE -# undef CONFIG_UART1_SERIAL_CONSOLE -# undef CONFIG_UART3_SERIAL_CONSOLE -# define HAVE_16550_CONSOLE 1 -#elif defined(CONFIG_UART3_SERIAL_CONSOLE) && defined(CONFIG_16550_UART3) -# undef CONFIG_UART0_SERIAL_CONSOLE -# undef CONFIG_UART1_SERIAL_CONSOLE -# undef CONFIG_UART2_SERIAL_CONSOLE -# define HAVE_16550_CONSOLE 1 -#else -# undef CONFIG_UART0_SERIAL_CONSOLE -# undef CONFIG_UART1_SERIAL_CONSOLE -# undef CONFIG_UART2_SERIAL_CONSOLE -# undef CONFIG_UART3_SERIAL_CONSOLE -# undef HAVE_16550_CONSOLE -#endif - -/* Register offsets *****************************************************************/ - -#define UART_RBR_INCR 0 /* (DLAB =0) Receiver Buffer Register */ -#define UART_THR_INCR 0 /* (DLAB =0) Transmit Holding Register */ -#define UART_DLL_INCR 0 /* (DLAB =1) Divisor Latch LSB */ -#define UART_DLM_INCR 1 /* (DLAB =1) Divisor Latch MSB */ -#define UART_IER_INCR 1 /* (DLAB =0) Interrupt Enable Register */ -#define UART_IIR_INCR 2 /* Interrupt ID Register */ -#define UART_FCR_INCR 2 /* FIFO Control Register */ -#define UART_LCR_INCR 3 /* Line Control Register */ -#define UART_MCR_INCR 4 /* Modem Control Register */ -#define UART_LSR_INCR 5 /* Line Status Register */ -#define UART_MSR_INCR 6 /* Modem Status Register */ -#define UART_SCR_INCR 7 /* Scratch Pad Register */ - -#define UART_RBR_OFFSET (CONFIG_16550_REGINCR*UART_RBR_INCR) -#define UART_THR_OFFSET (CONFIG_16550_REGINCR*UART_THR_INCR) -#define UART_DLL_OFFSET (CONFIG_16550_REGINCR*UART_DLL_INCR) -#define UART_DLM_OFFSET (CONFIG_16550_REGINCR*UART_DLM_INCR) -#define UART_IER_OFFSET (CONFIG_16550_REGINCR*UART_IER_INCR) -#define UART_IIR_OFFSET (CONFIG_16550_REGINCR*UART_IIR_INCR) -#define UART_FCR_OFFSET (CONFIG_16550_REGINCR*UART_FCR_INCR) -#define UART_LCR_OFFSET (CONFIG_16550_REGINCR*UART_LCR_INCR) -#define UART_MCR_OFFSET (CONFIG_16550_REGINCR*UART_MCR_INCR) -#define UART_LSR_OFFSET (CONFIG_16550_REGINCR*UART_LSR_INCR) -#define UART_MSR_OFFSET (CONFIG_16550_REGINCR*UART_MSR_INCR) -#define UART_SCR_OFFSET (CONFIG_16550_REGINCR*UART_SCR_INCR) - -/* Register bit definitions *********************************************************/ - -/* RBR (DLAB =0) Receiver Buffer Register */ - -#define UART_RBR_MASK (0xff) /* Bits 0-7: Oldest received byte in RX FIFO */ - /* Bits 8-31: Reserved */ - -/* THR (DLAB =0) Transmit Holding Register */ - -#define UART_THR_MASK (0xff) /* Bits 0-7: Adds byte to TX FIFO */ - /* Bits 8-31: Reserved */ - -/* DLL (DLAB =1) Divisor Latch LSB */ - -#define UART_DLL_MASK (0xff) /* Bits 0-7: DLL */ - /* Bits 8-31: Reserved */ - -/* DLM (DLAB =1) Divisor Latch MSB */ - -#define UART_DLM_MASK (0xff) /* Bits 0-7: DLM */ - /* Bits 8-31: Reserved */ - -/* IER (DLAB =0) Interrupt Enable Register */ - -#define UART_IER_ERBFI (1 << 0) /* Bit 0: Enable received data available interrupt */ -#define UART_IER_ETBEI (1 << 1) /* Bit 1: Enable THR empty interrupt */ -#define UART_IER_ELSI (1 << 2) /* Bit 2: Enable receiver line status interrupt */ -#define UART_IER_EDSSI (1 << 3) /* Bit 3: Enable MODEM status interrupt */ - /* Bits 4-7: Reserved */ -#define UART_IER_ALLIE (0x0f) - -/* IIR Interrupt ID Register */ - -#define UART_IIR_INTSTATUS (1 << 0) /* Bit 0: Interrupt status (active low) */ -#define UART_IIR_INTID_SHIFT (1) /* Bits 1-3: Interrupt identification */ -#define UART_IIR_INTID_MASK (7 << UART_IIR_INTID_SHIFT) -# define UART_IIR_INTID_MSI (0 << UART_IIR_INTID_SHIFT) /* Modem Status */ -# define UART_IIR_INTID_THRE (1 << UART_IIR_INTID_SHIFT) /* THR Empty Interrupt */ -# define UART_IIR_INTID_RDA (2 << UART_IIR_INTID_SHIFT) /* Receive Data Available (RDA) */ -# define UART_IIR_INTID_RLS (3 << UART_IIR_INTID_SHIFT) /* Receiver Line Status (RLS) */ -# define UART_IIR_INTID_CTI (6 << UART_IIR_INTID_SHIFT) /* Character Time-out Indicator (CTI) */ - /* Bits 4-5: Reserved */ -#define UART_IIR_FIFOEN_SHIFT (6) /* Bits 6-7: RCVR FIFO interrupt */ -#define UART_IIR_FIFOEN_MASK (3 << UART_IIR_FIFOEN_SHIFT) - -/* FCR FIFO Control Register */ - -#define UART_FCR_FIFOEN (1 << 0) /* Bit 0: Enable FIFOs */ -#define UART_FCR_RXRST (1 << 1) /* Bit 1: RX FIFO Reset */ -#define UART_FCR_TXRST (1 << 2) /* Bit 2: TX FIFO Reset */ -#define UART_FCR_DMAMODE (1 << 3) /* Bit 3: DMA Mode Select */ - /* Bits 4-5: Reserved */ -#define UART_FCR_RXTRIGGER_SHIFT (6) /* Bits 6-7: RX Trigger Level */ -#define UART_FCR_RXTRIGGER_MASK (3 << UART_FCR_RXTRIGGER_SHIFT) -# define UART_FCR_RXTRIGGER_1 (0 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 0 (1 character) */ -# define UART_FCR_RXTRIGGER_4 (1 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 1 (4 characters) */ -# define UART_FCR_RXTRIGGER_8 (2 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 2 (8 characters) */ -# define UART_FCR_RXTRIGGER_14 (3 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 3 (14 characters) */ - -/* LCR Line Control Register */ - -#define UART_LCR_WLS_SHIFT (0) /* Bit 0-1: Word Length Select */ -#define UART_LCR_WLS_MASK (3 << UART_LCR_WLS_SHIFT) -# define UART_LCR_WLS_5BIT (0 << UART_LCR_WLS_SHIFT) -# define UART_LCR_WLS_6BIT (1 << UART_LCR_WLS_SHIFT) -# define UART_LCR_WLS_7BIT (2 << UART_LCR_WLS_SHIFT) -# define UART_LCR_WLS_8BIT (3 << UART_LCR_WLS_SHIFT) -#define UART_LCR_STB (1 << 2) /* Bit 2: Number of Stop Bits */ -#define UART_LCR_PEN (1 << 3) /* Bit 3: Parity Enable */ -#define UART_LCR_EPS (1 << 4) /* Bit 4: Even Parity Select */ -#define UART_LCR_STICKY (1 << 5) /* Bit 5: Stick Parity */ -#define UART_LCR_BRK (1 << 6) /* Bit 6: Break Control */ -#define UART_LCR_DLAB (1 << 7) /* Bit 7: Divisor Latch Access Bit (DLAB) */ - -/* MCR Modem Control Register */ - -#define UART_MCR_DTR (1 << 0) /* Bit 0: DTR Control Source for DTR output */ -#define UART_MCR_RTS (1 << 1) /* Bit 1: Control Source for RTS output */ -#define UART_MCR_OUT1 (1 << 2) /* Bit 2: Auxiliary user-defined output 1 */ -#define UART_MCR_OUT2 (1 << 3) /* Bit 3: Auxiliary user-defined output 2 */ -#define UART_MCR_LPBK (1 << 4) /* Bit 4: Loopback Mode Select */ - /* Bit 5-7: Reserved */ - -/* LSR Line Status Register */ - -#define UART_LSR_DR (1 << 0) /* Bit 0: Data Ready */ -#define UART_LSR_OE (1 << 1) /* Bit 1: Overrun Error */ -#define UART_LSR_PE (1 << 2) /* Bit 2: Parity Error */ -#define UART_LSR_FE (1 << 3) /* Bit 3: Framing Error */ -#define UART_LSR_BI (1 << 4) /* Bit 4: Break Interrupt */ -#define UART_LSR_THRE (1 << 5) /* Bit 5: Transmitter Holding Register Empty */ -#define UART_LSR_TEMT (1 << 6) /* Bit 6: Transmitter Empty */ -#define UART_LSR_RXFE (1 << 7) /* Bit 7: Error in RX FIFO (RXFE) */ - -/* SCR Scratch Pad Register */ - -#define UART_SCR_MASK (0xff) /* Bits 0-7: SCR data */ - -/************************************************************************************ - * Public Types - ************************************************************************************/ - -#if CONFIG_16550_REGWIDTH == 8 -typedef uint8_t uart_datawidth_t; -#elif CONFIG_16550_REGWIDTH == 16 -typedef uint16_t uart_datawidth_t; -#elif CONFIG_16550_REGWIDTH == 32 -typedef uint32_t uart_datawidth_t; -#endif - -#if CONFIG_16550_ADDRWIDTH == 8 -typedef uint8_t uart_addrwidth_t; -#elif CONFIG_16550_ADDRWIDTH == 16 -typedef uint16_t uart_addrwidth_t; -#elif CONFIG_16550_ADDRWIDTH == 32 -typedef uint32_t uart_addrwidth_t; -#endif - -/************************************************************************************ - * Public Data - ************************************************************************************/ - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -/************************************************************************************ - * Name: uart_getreg(), uart_putreg() - * - * Description: - * These functions must be provided by the processor-specific code in order to - * correctly access 16550 registers - * - ************************************************************************************/ - -extern uart_datawidth_t uart_getreg(uart_addrwidth_t base, unsigned int offset); -extern void uart_putreg(uart_addrwidth_t base, unsigned int offset, uart_datawidth_t value); - -#endif /* CONFIG_UART_16550 */ -#endif /* __INCLUDE_NUTTX_SERIAL_UART_16550_H */ diff --git a/nuttx/include/nuttx/spawn.h b/nuttx/include/nuttx/spawn.h deleted file mode 100644 index f84ae8355..000000000 --- a/nuttx/include/nuttx/spawn.h +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** - * include/nuttx/spawn.h - * - * Copyright (C) 2013 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_NUTTX_SPAWN_H -#define __INCLUDE_NUTTX_SPAWN_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ -/* This enumerator identifies a file action */ - -enum spawn_file_actions_e -{ - SPAWN_FILE_ACTION_NONE = 0, - SPAWN_FILE_ACTION_CLOSE, - SPAWN_FILE_ACTION_DUP2, - SPAWN_FILE_ACTION_OPEN -}; - -/* posix_spawn_file_actions_addclose(), posix_spawn_file_actions_adddup2(), - * and posix_spawn_file_actions_addopen() will allocate memory and append - * a new file action to an instance of posix_spawn_file_actions_t. The - * internal representation of these structures are defined below: - */ - -struct spawn_general_file_action_s -{ - FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */ - enum spawn_file_actions_e action; /* A member of enum spawn_file_actions_e */ -}; - -struct spawn_close_file_action_s -{ - FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */ - enum spawn_file_actions_e action; /* SPAWN_FILE_ACTION_CLOSE */ - int fd; /* The file descriptor to close */ -}; - -struct spawn_dup2_file_action_s -{ - FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */ - enum spawn_file_actions_e action; /* SPAWN_FILE_ACTION_DUP2 */ - int fd1; /* The first file descriptor for dup2() */ - int fd2; /* The second file descriptor for dup2() */ -}; - -struct spawn_open_file_action_s -{ - FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */ - enum spawn_file_actions_e action; /* SPAWN_FILE_ACTION_OPEN */ - int fd; /* The file descriptor after opening */ - int oflags; /* Open flags */ - mode_t mode; /* File creation mode */ - char path[1]; /* Start of the path to be - * opened */ -}; - -#define SIZEOF_OPEN_FILE_ACTION_S(n) \ - (sizeof(struct spawn_open_file_action_s) + (n)) - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -extern "C" -{ -#endif - -void add_file_action(FAR posix_spawn_file_actions_t *file_action, - FAR struct spawn_general_file_action_s *entry); - -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_SPAWN_H */ diff --git a/nuttx/include/nuttx/spi.h b/nuttx/include/nuttx/spi.h deleted file mode 100644 index 6448dc7c5..000000000 --- a/nuttx/include/nuttx/spi.h +++ /dev/null @@ -1,446 +0,0 @@ -/**************************************************************************** - * include/nuttx/spi.h - * - * Copyright(C) 2008-2012 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_NUTTX_SPI_H -#define __INCLUDE_NUTTX_SPI_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* CONFIG_SPI_OWNBUS - Set if there is only one active device on the SPI bus. - * No locking or SPI configuration will be performed. It is not necessary - * for clients to lock, re-configure, etc.. - * CONFIG_SPI_EXCHANGE - Driver supports a single exchange method - * (vs a recvblock() and sndblock ()methods). - * CONFIG_SPI_CMDDATA - Devices on the SPI bus require out-of-band support - * to distinguish command transfers from data transfers. Such devices - * will often support either 9-bit SPI (yech) or 8-bit SPI and a GPIO - * output that selects between command and data. - */ - -/* Access macros ************************************************************/ - -/**************************************************************************** - * Name: SPI_LOCK - * - * Description: - * On SPI busses where there are multiple devices, it will be necessary to - * lock SPI to have exclusive access to the busses for a sequence of - * transfers. The bus should be locked before the chip is selected. After - * locking the SPI bus, the caller should then also call the setfrequency, - * setbits, and setmode methods to make sure that the SPI is properly - * configured for the device. If the SPI buss is being shared, then it - * may have been left in an incompatible state. - * - * Input Parameters: - * dev - Device-specific state data - * lock - true: Lock spi bus, false: unlock SPI bus - * - * Returned Value: - * None - * - ****************************************************************************/ - -#ifndef CONFIG_SPI_OWNBUS -# define SPI_LOCK(d,l) (d)->ops->lock(d,l) -#else -# define SPI_LOCK(d,l) 0 -#endif - -/**************************************************************************** - * Name: SPI_SELECT - * - * Description: - * Enable/disable the SPI chip select. The implementation of this method - * must include handshaking: If a device is selected, it must hold off - * all other attempts to select the device until the device is deselected. - * Required. - * - * Input Parameters: - * dev - Device-specific state data - * devid - Identifies the device to select - * selected - true: slave selected, false: slave de-selected - * - * Returned Value: - * None - * - ****************************************************************************/ - -#define SPI_SELECT(d,id,s) ((d)->ops->select(d,id,s)) - -/**************************************************************************** - * Name: SPI_SETFREQUENCY - * - * Description: - * Set the SPI frequency. Required. - * - * Input Parameters: - * dev - Device-specific state data - * frequency - The SPI frequency requested - * - * Returned Value: - * Returns the actual frequency selected - * - ****************************************************************************/ - -#define SPI_SETFREQUENCY(d,f) ((d)->ops->setfrequency(d,f)) - -/**************************************************************************** - * Name: SPI_SETMODE - * - * Description: - * Set the SPI mode. Optional. See enum spi_mode_e for mode definitions. - * - * Input Parameters: - * dev - Device-specific state data - * mode - The SPI mode requested - * - * Returned Value: - * none - * - ****************************************************************************/ - -#define SPI_SETMODE(d,m) \ - do { if ((d)->ops->setmode) (d)->ops->setmode(d,m); } while (0) - -/**************************************************************************** - * Name: SPI_SETBITS - * - * Description: - * Set the number if bits per word. - * - * Input Parameters: - * dev - Device-specific state data - * nbits - The number of bits requests. - * If value is greater > 0 then it implies MSB first - * If value is below < 0, then it implies LSB first with -nbits - * - * Returned Value: - * none - * - ****************************************************************************/ - -#define SPI_SETBITS(d,b) \ - do { if ((d)->ops->setbits) (d)->ops->setbits(d,b); } while (0) - -/**************************************************************************** - * Name: SPI_STATUS - * - * Description: - * Get SPI/MMC status. Optional. - * - * Input Parameters: - * dev - Device-specific state data - * devid - Identifies the device to report status on - * - * Returned Value: - * Returns a bitset of status values (see SPI_STATUS_* defines) - * - ****************************************************************************/ - -#define SPI_STATUS(d,id) \ - ((d)->ops->status ? (d)->ops->status(d, id) : SPI_STATUS_PRESENT) - -/* SPI status bits -- Some dedicated for SPI MMC/SD support and may have no - * relationship to SPI other than needed by the SPI MMC/SD interface - */ - -#define SPI_STATUS_PRESENT 0x01 /* Bit 0=1: MMC/SD card present */ -#define SPI_STATUS_WRPROTECTED 0x02 /* Bit 1=1: MMC/SD card write protected */ - -/**************************************************************************** - * Name: SPI_CMDDATA - * - * Description: - * Some devices require and additional out-of-band bit to specify if the - * next word sent to the device is a command or data. This is typical, for - * example, in "9-bit" displays where the 9th bit is the CMD/DATA bit. - * This function provides selection of command or data. - * - * This "latches" the CMD/DATA state. It does not have to be called before - * every word is transferred; only when the CMD/DATA state changes. This - * method is required if CONFIG_SPI_CMDDATA is selected in the NuttX - * configuration - * - * Input Parameters: - * dev - Device-specific state data - * cmd - TRUE: The following word is a command; FALSE: the following words - * are data. - * - * Returned Value: - * OK unless an error occurs. Then a negated errno value is returned - * - ****************************************************************************/ - -#ifdef CONFIG_SPI_CMDDATA -# define SPI_CMDDATA(d,id,cmd) ((d)->ops->cmddata(d,id,cmd)) -#endif - -/**************************************************************************** - * Name: SPI_SEND - * - * Description: - * Exchange one word on SPI. Required. - * - * Input Parameters: - * dev - Device-specific state data - * wd - The word to send. the size of the data is determined by the - * number of bits selected for the SPI interface. - * - * Returned Value: - * Received value - * - ****************************************************************************/ - -#define SPI_SEND(d,wd) ((d)->ops->send(d,(uint16_t)wd)) - -/**************************************************************************** - * Name: SPI_SNDBLOCK - * - * Description: - * Send a block of data on SPI. Required. - * - * Input Parameters: - * dev - Device-specific state data - * buffer - A pointer to the buffer of data to be sent - * nwords - the length of data to send from the buffer in number of words. - * The wordsize is determined by the number of bits-per-word - * selected for the SPI interface. If nbits <= 8, the data is - * packed into uint8_t's; if nbits >8, the data is packed into - * uint16_t's - * - * Returned Value: - * None - * - ****************************************************************************/ - -#ifdef CONFIG_SPI_EXCHANGE -# define SPI_SNDBLOCK(d,b,l) ((d)->ops->exchange(d,b,0,l)) -#else -# define SPI_SNDBLOCK(d,b,l) ((d)->ops->sndblock(d,b,l)) -#endif - -/**************************************************************************** - * Name: SPI_RECVBLOCK - * - * Description: - * Receive a block of data from SPI. Required. - * - * Input Parameters: - * dev - Device-specific state data - * buffer - A pointer to the buffer in which to recieve data - * nwords - the length of data that can be received in the buffer in number - * of words. The wordsize is determined by the number of bits- - * per-word selected for the SPI interface. If nbits <= 8, the - * data is packed into uint8_t's; if nbits >8, the data is packed - * into uint16_t's - * - * Returned Value: - * None - * - ****************************************************************************/ - -#ifdef CONFIG_SPI_EXCHANGE -# define SPI_RECVBLOCK(d,b,l) ((d)->ops->exchange(d,0,b,l)) -#else -# define SPI_RECVBLOCK(d,b,l) ((d)->ops->recvblock(d,b,l)) -#endif - -/**************************************************************************** - * Name: SPI_EXCHANGE - * - * Description: - * Exahange a block of data from SPI. Required. - * - * Input Parameters: - * dev - Device-specific state data - * txbuffer - A pointer to the buffer of data to be sent - * rxbuffer - A pointer to the buffer in which to recieve data - * nwords - the length of data that to be exchanged in units of words. - * The wordsize is determined by the number of bits-per-word - * selected for the SPI interface. If nbits <= 8, the data is - * packed into uint8_t's; if nbits >8, the data is packed into - * uint16_t's - * - * Returned Value: - * None - * - ****************************************************************************/ - -#ifdef CONFIG_SPI_EXCHANGE -# define SPI_EXCHANGE(d,t,r,l) ((d)->ops->exchange(d,t,r,l)) -#endif - -/**************************************************************************** - * Name: SPI_REGISTERCALLBACK - * - * Description: - * Register a callback that that will be invoked on any media status - * change (i.e, anything that would be reported differently by SPI_STATUS). - * Optional - * - * Input Parameters: - * dev - Device-specific state data - * callback - The funtion to call on the media change - * arg - A caller provided value to return with the callback - * - * Returned Value: - * 0 on success; negated errno on failure. - * - ****************************************************************************/ - -#define SPI_REGISTERCALLBACK(d,c,a) \ - ((d)->ops->registercallback ? (d)->ops->registercallback(d,c,a) : -ENOSYS) - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* The type of the media change callback function */ - -typedef void (*spi_mediachange_t)(FAR void *arg); - -/* If the board supports multiple SPI devices, this enumeration identifies - * which is selected or de-seleted. - */ - -enum spi_dev_e -{ - SPIDEV_NONE = 0, /* Not a valid value */ - SPIDEV_MMCSD, /* Select SPI MMC/SD device */ - SPIDEV_FLASH, /* Select SPI FLASH device */ - SPIDEV_ETHERNET, /* Select SPI ethernet device */ - SPIDEV_DISPLAY, /* Select SPI LCD/OLED display device */ - SPIDEV_WIRELESS, /* Select SPI Wireless device */ - SPIDEV_TOUCHSCREEN, /* Select SPI touchscreen device */ - SPIDEV_EXPANDER, /* Select SPI I/O expander device */ - SPIDEV_MUX /* Select SPI multiplexer device */ -}; - -/* Certain SPI devices may required differnt clocking modes */ - -enum spi_mode_e -{ - SPIDEV_MODE0 = 0, /* CPOL=0 CHPHA=0 */ - SPIDEV_MODE1, /* CPOL=0 CHPHA=1 */ - SPIDEV_MODE2, /* CPOL=1 CHPHA=0 */ - SPIDEV_MODE3 /* CPOL=1 CHPHA=1 */ -}; - -/* The SPI vtable */ - -struct spi_dev_s; -struct spi_ops_s -{ -#ifndef CONFIG_SPI_OWNBUS - int (*lock)(FAR struct spi_dev_s *dev, bool lock); -#endif - void (*select)(FAR struct spi_dev_s *dev, enum spi_dev_e devid, - bool selected); - uint32_t (*setfrequency)(FAR struct spi_dev_s *dev, uint32_t frequency); - void (*setmode)(FAR struct spi_dev_s *dev, enum spi_mode_e mode); - void (*setbits)(FAR struct spi_dev_s *dev, int nbits); - uint8_t (*status)(FAR struct spi_dev_s *dev, enum spi_dev_e devid); -#ifdef CONFIG_SPI_CMDDATA - int (*cmddata)(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd); -#endif - uint16_t (*send)(FAR struct spi_dev_s *dev, uint16_t wd); -#ifdef CONFIG_SPI_EXCHANGE - void (*exchange)(FAR struct spi_dev_s *dev, FAR const void *txbuffer, - FAR void *rxbuffer, size_t nwords); -#else - void (*sndblock)(FAR struct spi_dev_s *dev, FAR const void *buffer, - size_t nwords); - void (*recvblock)(FAR struct spi_dev_s *dev, FAR void *buffer, - size_t nwords); -#endif - int (*registercallback)(FAR struct spi_dev_s *dev, spi_mediachange_t callback, - void *arg); -}; - -/* SPI private data. This structure only defines the initial fields of the - * structure visible to the SPI client. The specific implementation may - * add additional, device specific fields - */ - -struct spi_dev_s -{ - const struct spi_ops_s *ops; -}; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: up_spiinitialize - * - * Description: - * Initialize the selected SPI port. - * - * Input Parameter: - * Port number (for hardware that has mutiple SPI interfaces) - * - * Returned Value: - * Valid SPI device structre reference on succcess; a NULL on failure - * - ****************************************************************************/ - -EXTERN FAR struct spi_dev_s *up_spiinitialize(int port); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif -#endif /* __INCLUDE_NUTTX_SPI_H */ diff --git a/nuttx/include/nuttx/stdarg.h b/nuttx/include/nuttx/stdarg.h deleted file mode 100644 index 45d16b2d1..000000000 --- a/nuttx/include/nuttx/stdarg.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** - * include/nuttx/stdarg.h - * - * Copyright (C) 2012 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_NUTTX_STDARG_H -#define __INCLUDE_NUTTX_STDARG_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/* If CONFIG_ARCH_STDARG_H is defined, then the top-level Makefile will copy - * this header file to include/stdarg.h where it will become the system - * stdarg.h header file. In this case, the architecture specific code must - * provide an arch//include/math.h file which will be included - * below: - */ - -#ifdef CONFIG_ARCH_STDARG_H -# include -#endif - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#endif /* __INCLUDE_NUTTX_STDARG_H */ diff --git a/nuttx/include/nuttx/streams.h b/nuttx/include/nuttx/streams.h deleted file mode 100644 index 38ceb584c..000000000 --- a/nuttx/include/nuttx/streams.h +++ /dev/null @@ -1,295 +0,0 @@ -/**************************************************************************** - * include/nuttx/streams.h - * - * Copyright (C) 2009, 2011-2012 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_NUTTX_STREAMS_H -#define _INCLUDE_NUTTX_STREAMS_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* These are the generic representations of a streams used by the NuttX */ - -struct lib_instream_s; -struct lib_outstream_s; - -typedef int (*lib_getc_t)(FAR struct lib_instream_s *this); -typedef void (*lib_putc_t)(FAR struct lib_outstream_s *this, int ch); -typedef int (*lib_flush_t)(FAR struct lib_outstream_s *this); - -struct lib_instream_s -{ - lib_getc_t get; /* Pointer to function to get one character */ - int nget; /* Total number of characters gotten. Written - * by get method, readable by user */ -}; - -struct lib_outstream_s -{ - lib_putc_t put; /* Pointer to function to put one character */ -#ifdef CONFIG_STDIO_LINEBUFFER - lib_flush_t flush; /* Pointer to function flush buffered characters */ -#endif - int nput; /* Total number of characters put. Written - * by put method, readable by user */ -}; - -/* These are streams that operate on a fixed-sized block of memory */ - -struct lib_meminstream_s -{ - struct lib_instream_s public; - FAR const char *buffer; /* Address of first byte in the buffer */ - int buflen; /* Size of the buffer in bytes */ -}; - -struct lib_memoutstream_s -{ - struct lib_outstream_s public; - FAR char *buffer; /* Address of first byte in the buffer */ - int buflen; /* Size of the buffer in bytes */ -}; - -/* These are streams that operate on a FILE */ - -struct lib_stdinstream_s -{ - struct lib_instream_s public; - FAR FILE *stream; -}; - -struct lib_stdoutstream_s -{ - struct lib_outstream_s public; - FAR FILE *stream; -}; - -/* These are streams that operate on a file descriptor */ - -struct lib_rawoutstream_s -{ - struct lib_outstream_s public; - int fd; -}; - -struct lib_rawinstream_s -{ - struct lib_instream_s public; - int fd; -}; - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -# define EXTERN extern "C" -extern "C" -{ -#else -# define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Name: lib_meminstream, lib_memoutstream - * - * Description: - * Initializes a stream for use with a fixed-size memory buffer. - * Defined in lib/lib_meminstream.c and lib/lib_memoutstream.c - * - * Input parameters: - * meminstream - User allocated, uninitialized instance of struct - * lib_meminstream_s to be initialized. - * memoutstream - User allocated, uninitialized instance of struct - * lib_memoutstream_s to be initialized. - * bufstart - Address of the beginning of the fixed-size memory buffer - * buflen - Size of the fixed-sized memory buffer in bytes - * - * Returned Value: - * None (User allocated instance initialized). - * - ****************************************************************************/ - -EXTERN void lib_meminstream(FAR struct lib_meminstream_s *meminstream, - FAR const char *bufstart, int buflen); -EXTERN void lib_memoutstream(FAR struct lib_memoutstream_s *memoutstream, - FAR char *bufstart, int buflen); - -/**************************************************************************** - * Name: lib_stdinstream, lib_stdoutstream - * - * Description: - * Initializes a stream for use with a FILE instance. - * Defined in lib/lib_stdinstream.c and lib/lib_stdoutstream.c - * - * Input parameters: - * stdinstream - User allocated, uninitialized instance of struct - * lib_stdinstream_s to be initialized. - * stdoutstream - User allocated, uninitialized instance of struct - * lib_stdoutstream_s to be initialized. - * stream - User provided stream instance (must have been opened for - * the correct access). - * - * Returned Value: - * None (User allocated instance initialized). - * - ****************************************************************************/ - -EXTERN void lib_stdinstream(FAR struct lib_stdinstream_s *stdinstream, - FAR FILE *stream); -EXTERN void lib_stdoutstream(FAR struct lib_stdoutstream_s *stdoutstream, - FAR FILE *stream); - -/**************************************************************************** - * Name: lib_rawinstream, lib_rawoutstream - * - * Description: - * Initializes a stream for use with a file descriptor. - * Defined in lib/lib_rawinstream.c and lib/lib_rawoutstream.c - * - * Input parameters: - * rawinstream - User allocated, uninitialized instance of struct - * lib_rawinstream_s to be initialized. - * rawoutstream - User allocated, uninitialized instance of struct - * lib_rawoutstream_s to be initialized. - * fd - User provided file/socket descriptor (must have been opened - * for the correct access). - * - * Returned Value: - * None (User allocated instance initialized). - * - ****************************************************************************/ - -EXTERN void lib_rawinstream(FAR struct lib_rawinstream_s *rawinstream, - int fd); -EXTERN void lib_rawoutstream(FAR struct lib_rawoutstream_s *rawoutstream, - int fd); - -/**************************************************************************** - * Name: lib_lowinstream, lib_lowoutstream - * - * Description: - * Initializes a stream for use with low-level, architecture-specific I/O. - * Defined in lib/lib_lowinstream.c and lib/lib_lowoutstream.c - * - * Input parameters: - * lowinstream - User allocated, uninitialized instance of struct - * lib_lowinstream_s to be initialized. - * lowoutstream - User allocated, uninitialized instance of struct - * lib_lowoutstream_s to be initialized. - * - * Returned Value: - * None (User allocated instance initialized). - * - ****************************************************************************/ - -#ifdef CONFIG_ARCH_LOWGETC -EXTERN void lib_lowinstream(FAR struct lib_instream_s *lowinstream); -#endif -#ifdef CONFIG_ARCH_LOWPUTC -EXTERN void lib_lowoutstream(FAR struct lib_outstream_s *lowoutstream); -#endif - -/**************************************************************************** - * Name: lib_zeroinstream, lib_nullinstream, lib_nulloutstream - * - * Description: - * Initializes NULL streams: - * - * o The stream created by lib_zeroinstream will return an infinitely long - * stream of zeroes. Defined in lib/lib_zeroinstream.c - * o The stream created by lib_nullinstream will return only EOF. - * Defined in lib/lib_nullinstream.c - * o The stream created by lib_nulloutstream will write all data to the - * bit-bucket. Defined in lib/lib_nulloutstream.c - * - * Input parameters: - * zeroinstream - User allocated, uninitialized instance of struct - * lib_instream_s to be initialized. - * nullinstream - User allocated, uninitialized instance of struct - * lib_instream_s to be initialized. - * nulloutstream - User allocated, uninitialized instance of struct - * lib_outstream_s to be initialized. - * - * Returned Value: - * None (User allocated instance initialized). - * - ****************************************************************************/ - -EXTERN void lib_zeroinstream(FAR struct lib_instream_s *zeroinstream); -EXTERN void lib_nullinstream(FAR struct lib_instream_s *nullinstream); -EXTERN void lib_nulloutstream(FAR struct lib_outstream_s *nulloutstream); - -/**************************************************************************** - * Name: lib_sylogstream - * - * Description: - * Initializes a stream for use with the configured syslog interface. - * - * Input parameters: - * lowoutstream - User allocated, uninitialized instance of struct - * lib_lowoutstream_s to be initialized. - * - * Returned Value: - * None (User allocated instance initialized). - * - ****************************************************************************/ - -#ifdef CONFIG_SYSLOG -EXTERN void lib_syslogstream(FAR struct lib_outstream_s *stream); -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* _INCLUDE_NUTTX_STREAMS_H */ diff --git a/nuttx/include/nuttx/syslog.h b/nuttx/include/nuttx/syslog.h deleted file mode 100644 index bb3c8f493..000000000 --- a/nuttx/include/nuttx/syslog.h +++ /dev/null @@ -1,136 +0,0 @@ -/**************************************************************************** - * include/nuttx/syslog.h - * The NuttX SYSLOGing interface - * - * Copyright (C) 2012 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_NUTTX_SYSLOG_H -#define __INCLUDE_NUTTX_SYSLOG_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* CONFIG_SYSLOG - Enables generic system logging features. - * CONFIG_SYSLOG_DEVPATH - The full path to the system logging device - * - * In addition, some SYSLOG device must also be enabled that will provide - * the syslog_putc() function. As of this writing, there are two SYSLOG - * devices avaiable: - * - * 1. A RAM SYSLOGing device that will log data into a circular buffer - * that can be dumped using the NSH dmesg command. This device is - * described in the include/nuttx/ramlog.h header file. - * - * 2. And a generic character device that may be used as the SYSLOG. The - * generic device interfaces are described in this file. A disadvantage - * of using the generic character device for the SYSLOG is that it - * cannot handle debug output generated from interrupt level handlers. - * - * CONFIG_SYSLOG_CHAR - Enable the generic character device for the SYSLOG. - * The full path to the SYSLOG device is provided by CONFIG_SYSLOG_DEVPATH. - * A valid character device must exist at this path. It will by opened - * by syslog_initialize. - * - * NOTE: No more than one SYSLOG device should be configured. - */ - -#ifndef CONFIG_SYSLOG -# undef CONFIG_SYSLOG_CHAR -#endif - -#if defined(CONFIG_SYSLOG_CHAR) && !defined(CONFIG_SYSLOG_DEVPATH) -# define CONFIG_SYSLOG_DEVPATH "/dev/ttyS1" -#endif - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifndef __ASSEMBLY__ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ -/**************************************************************************** - * Name: syslog_initialize - * - * Description: - * Initialize to use the character device (or file) at - * CONFIG_SYSLOG_DEVPATH as the SYSLOG sink. - * - * NOTE that this implementation excludes using a network connection as - * SYSLOG device. That would be a good extension. - * - ****************************************************************************/ - -#ifdef CONFIG_SYSLOG_CHAR -EXTERN int syslog_initialize(void); -#endif - -/**************************************************************************** - * Name: syslog_putc - * - * Description: - * This is the low-level system logging interface. The debugging/syslogging - * interfaces are syslog() and lowsyslog(). The difference is that - * the syslog() internface writes to fd=1 (stdout) whereas lowsyslog() uses - * a lower level interface that works from interrupt handlers. This - * function is a a low-level interface used to implement lowsyslog(). - * - ****************************************************************************/ - -#ifdef CONFIG_SYSLOG -EXTERN int syslog_putc(int ch); -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __ASSEMBLY__ */ -#endif /* __INCLUDE_NUTTX_SYSLOG_H */ diff --git a/nuttx/include/nuttx/time.h b/nuttx/include/nuttx/time.h deleted file mode 100644 index 58caa3430..000000000 --- a/nuttx/include/nuttx/time.h +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** - * include/nuttx/time.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 __INCLUDE_NUTTX_TIME_H -#define __INCLUDE_NUTTX_TIME_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/* If Gregorian time is not supported, then neither is Julian */ - -#ifndef CONFIG_GREGORIAN_TIME -# undef CONFIG_JULIAN_TIME -#else -# define JD_OF_EPOCH 2440588 /* Julian Date of noon, J1970 */ - -# ifdef CONFIG_JULIAN_TIME -# define GREG_DUTC -141427 /* Default is October 15, 1582 */ -# define GREG_YEAR 1582 -# define GREG_MONTH 10 -# define GREG_DAY 15 -# endif /* CONFIG_JULIAN_TIME */ -#endif /* !CONFIG_GREGORIAN_TIME */ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Function: clock_isleapyear - * - * Description: - * Return true if the specified year is a leap year - * - ****************************************************************************/ - -EXTERN int clock_isleapyear(int year); - -/**************************************************************************** - * Function: clock_daysbeforemonth - * - * Description: - * Get the number of days that occurred before the beginning of the month. - * - ****************************************************************************/ - -EXTERN int clock_daysbeforemonth(int month, bool leapyear); - -/**************************************************************************** - * Function: clock_calendar2utc - * - * Description: - * Calendar/UTC conversion based on algorithms from p. 604 - * of Seidelman, P. K. 1992. Explanatory Supplement to - * the Astronomical Almanac. University Science Books, - * Mill Valley. - * - ****************************************************************************/ - -EXTERN time_t clock_calendar2utc(int year, int month, int day); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_TIME_H */ diff --git a/nuttx/include/nuttx/usb/audio.h b/nuttx/include/nuttx/usb/audio.h deleted file mode 100644 index 97c3ed6cb..000000000 --- a/nuttx/include/nuttx/usb/audio.h +++ /dev/null @@ -1,1618 +0,0 @@ -/******************************************************************************************** - * include/nuttx/usb/audio.h - * Audio Device Class (ADC) definitions - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * References: This header file is based on information provided by the - * documents for the Audio v2.0 package: - * - * 1. Universal Serial Bus Device Class Definition for Audio Devices, Release - * 2.0, May 31, 2006, - * 2. Universal Serial Bus Device Class Definition for Audio Data Formats, - * Release 2.0, May 31, 2006 - * 3. Universal Serial Bus Device Class Definition for Terminal Types,\ - * Release 2.0, May 31, 2006, - * - * 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_NUTTX_USB_AUDIO_H -#define __INCLUDE_NUTTX_USB_AUDIO_H - -/******************************************************************************************** - * Included Files - ********************************************************************************************/ - -#include -#include - -/******************************************************************************************** - * Preprocessor definitions - ********************************************************************************************/ -/* Device Descriptor - * - * Because audio functionality is always considered to reside at the interface level, this - * class specification does not define a specific audio device descriptor. For both composite - * devices and audio-only devices, the device descriptor must indicate that class information - * is to be found at the interface level. Therefore, the bDeviceClass, bDeviceSubClass and - * bDeviceProtocol fields of the device descriptor must contain the values 0xef, 0x02, and - * 0x01 respectively. - */ - -#define ADC_DEVICE_CLASS USB_CLASS_MISC -#define ADC_DEVICE_SUBCLASS 0x02 -#define ADC_DEVICE_PROTOCOL 0x01 - -/* Audio Interface Class Code (defined in usb.h) */ - -#define ADC_CLASS USB_CLASS_AUDIO - -/* Audio Interface Sub-class Codes */ - -#define ADC_SUBCLASS_UNDEF 0x00 /* Undefined */ -#define ADC_SUBCLASS_AUDIOCONTROL 0x01 /* Audio control */ -#define ADC_SUBCLASS_AUDIOSTREAMING 0x02 /* Audio streaming */ -#define ADC_SUBCLASS_MIDISTREAMING 0x03 /* MIDI streaming */ - -/* Audio Protocol Codes */ - -#define ADC_PROTOCOL_UNDEF 0x00 /* Undefined */ -#define ADC_PROTOCOLv20 0x20 /* IP version 2.0 */ -#define ADC_PROTOCOLv20_BCD 0x0200 /* IP version 2.0 (BCD) */ - -/* Interface Association Descriptor (IAD) */ - -#define ADC_IAD_CLASS ADC_CLASS -#define ADC_IAD_SUBCLASS ADC_SUBCLASS_UNDEF -#define ADC_IAD_PROTOCOL ADC_PROTOCOLv20 - -/* Standard AC Interface Descriptor */ - -#define ADC_ACIF_CLASS ADC_CLASS -#define ADC_ACIF_SUBCLASS ADC_SUBCLASS_AUDIOCONTROL -#define ADC_ACIF_PROTOCOL ADC_PROTOCOLv20 - -/* Standard AS Interface Descriptor */ - -#define ADC_ASIF_CLASS ADC_CLASS -#define ADC_ASIF_SUBCLASS ADC_SUBCLASS_AUDIOSTREAMING -#define ADC_ASIF_PROTOCOL ADC_PROTOCOLv20 - -/* Class-specific Descriptor Codes: */ - -#define ADC_CS_UNDEF 0x20 -#define ADC_CS_DEVICE 0x21 -#define ADC_CS_CONFIGURATION 0x22 -#define ADC_CS_STRING 0x23 -#define ADC_CS_INTERFACE 0x24 -#define ADC_CS_ENDPOINT 0x25 - -/* Audio Class-Specific AC Interface Descriptor Subtypes */ - -#define ADC_AC_UNDEF 0x00 -#define ADC_AC_HEADER 0x01 -#define ADC_AC_INPUT_TERMINAL 0x02 -#define ADC_AC_OUTPUT_TERMINAL 0x03 -#define ADC_AC_MIXER_UNIT 0x04 -#define ADC_AC_SELECTOR_UNIT 0x05 -#define ADC_AC_FEATURE_UNIT 0x06 -#define ADC_AC_EFFECT_UNIT 0x07 -#define ADC_AC_PROCESSING_UNIT 0x08 -#define ADC_AC_EXTENSION_UNIT 0x09 -#define ADC_AC_CLOCK_SOURCE 0x0a -#define ADC_AC_CLOCK_SELECTOR 0x0b -#define ADC_AC_CLOCK_MULTIPLIER 0x0c -#define ADC_AC_SAMPLERATE_CONVERTER 0x0d - -/* Audio Class-Specific AS Interface Descriptor Subtypes */ - -#define ADC_AS_UNDEF 0x00 -#define ADC_AS_GENERAL 0x01 -#define ADC_AS_FORMAT_TYPE 0x02 -#define ADC_AS_ENCODER 0x03 -#define ADC_AS_DECODER 0x04 - -/* Clock Source Descriptor Clock Types */ - -#define ADC_CLKSRC_EXTERNAL 0x00 /* External clock */ -#define ADC_CLKSRC_INTERNAL_FIXED 0x01 /* Internal fixed clock */ -#define ADC_CLKSRC_INTERNAL_VAR 0x02 /* Internal variable clock */ -#define ADC_CLKSRC_INTERNAL_PROG 0x03 /* Internal programmable clock */ - -/* Effect Unit Effect Types */ - -#define ADC_EFFECT_UNDEF 0x00 -#define ADC_EFFECT_PARAM_EQ_SECTION 0x01 -#define ADC_EFFECT_REVERBERATION 0x02 -#define ADC_EFFECT_MOD_DELAY 0x03 -#define ADC_EFFECT_DYN_RANGE_COMP 0x04 - -/* Processing Unit Process Types */ - -#define ADC_PROCESS_UNDEF 0x00 -#define ADC_PROCESS_UPDOWNMIX 0x01 -#define ADC_PROCESS_DOLBY_PROLOGIC 0x02 -#define ADC_PROCESS_STEREO_EXTENDER 0x03 - -/* Audio Class-Specific Endpoint Descriptor Subtypes */ - -#define ADC_EPTYPE_UNDEF 0x00 -#define ADC_EPTYPE_GENERAL 0x01 - -/* Audio Class-Specific Request Codes */ - -#define ADC_REQUEST_UNDEF 0x00 -#define ADC_REQUEST_CUR 0x01 -#define ADC_REQUEST_RANGE 0x02 -#define ADC_REQUEST_MEM 0x03 - -/* Encoder Type Codes */ - -#define ADC_ENCODER_UNDEF 0x00 -#define ADC_ENCODER_OTHER 0x01 -#define ADC_ENCODER_MPEG 0x02 -#define ADC_ENCODER_AC3 0x03 -#define ADC_ENCODER_WMA 0x04 -#define ADC_ENCODER_DTS 0x05 - -/* Decoder Type Codes */ - -#define ADC_DECODER_UNDEF 0x00 -#define ADC_DECODER_OTHER 0x01 -#define ADC_DECODER_MPEG 0x02 -#define ADC_DECODER_AC3 0x03 -#define ADC_DECODER_WMA 0x04 -#define ADC_DECODER_DTS 0x05 - -/* bmChannelConfig: a bitmap field that indicates which spatial locations - * are occupied by the channels present in the cluster. The bit allocations - * are as follows: - */ - -#define ADC_LOCATION_FL (1 << 0) /* Front Left */ -#define ADC_LOCATION_FR (1 << 1) /* Front Right */ -#define ADC_LOCATION_FC (1 << 2) /* Front Center */ -#define ADC_LOCATION_LFE (1 << 3) /* Low Frequency Effects */ -#define ADC_LOCATION_BL (1 << 4) /* Back Left */ -#define ADC_LOCATION_BR (1 << 5) /* Back Right */ -#define ADC_LOCATION_FLC (1 << 6) /* Front Left of Center */ -#define ADC_LOCATION_FRC (1 << 7) /* Front Right of Center */ -#define ADC_LOCATION_BC (1 << 8) /* Back Center */ -#define ADC_LOCATION_SL (1 << 9) /* Side Left */ -#define ADC_LOCATION_SR (1 << 10) /* Side Right */ -#define ADC_LOCATION_TC (1 << 11) /* Top Center */ -#define ADC_LOCATION_TFL (1 << 12) /* Top Front Left */ -#define ADC_LOCATION_TFC (1 << 13) /* Top Front Center */ -#define ADC_LOCATION_TFR (1 << 14) /* Top Front Right */ -#define ADC_LOCATION_TBL (1 << 15) /* Top Back Left */ -#define ADC_LOCATION_TBC (1 << 16) /* Top Back Center */ -#define ADC_LOCATION_TBR (1 << 17) /* Top Back Right */ -#define ADC_LOCATION_TFLC (1 << 18) /* Top Front Left of Center */ -#define ADC_LOCATION_TFRC (1 << 19) /* Top Front Right of Center */ -#define ADC_LOCATION_LLFE (1 << 20) /* Left Low Frequency Effects */ -#define ADC_LOCATION_RLFE (1 << 21) /* Right Low Frequency Effects */ -#define ADC_LOCATION_TSL (1 << 22) /* Top Side Left */ -#define ADC_LOCATION_TSR (1 << 23) /* Top Side Right */ -#define ADC_LOCATION BC (1 << 24) /* Bottom Center */ -#define ADC_LOCATION_BLC (1 << 25) /* Back Left of Center */ -#define ADC_LOCATION_BRC (1 << 26) /* Back Right of Center */ - /* Bits 27-30: Reserved */ -#define ADC_LOCATION_RD (1 << 31) /* Raw Data */ - -/* Audio Function Category Codes */ - -#define ADC_CATEGORY_UNDEF 0x00 /* Undefined */ -#define ADC_CATEGORY_SPEAKER 0x01 /* Desktop speaker */ -#define ADC_CATEGORY_THEATER 0x02 /* Home theater */ -#define ADC_CATEGORY_MICROPHONE 0x03 /* Microphone */ -#define ADC_CATEGORY_HEADSET 0x04 /* Headset */ -#define ADC_CATEGORY_TELEPHONE 0x05 /* Telephone */ -#define ADC_CATEGORY_CONVERTER 0x06 /* Converter */ -#define ADC_CATEGORY_RECORDER 0x07 /* Voice/Sound recorder */ -#define ADC_CATEGORY_IO_BOX 0x08 /* I/O box */ -#define ADC_CATEGORY_INSTRUMENT 0x09 /* Musical instrument */ -#define ADC_CATEGORY_PROAUDIO 0x0a /* Pro-audio */ -#define ADC_CATEGORY_AV 0x0b /* Audio/video */ -#define ADC_CATEGORY_CONTROL 0x0c /* Control panel */ -#define ADC_CATEGORY_OTHER 0xff - -/* Clock Source Control Selectors */ - -#define ADC_CS_CONTROL_UNDEF 0x00 -#define ADC_CS_CONTROL_SAM_FREQ 0x01 -#define ADC_CS_CONTROL_CLOCK_VALID 0x02 - -/* Clock Selector Control Selectors */ - -#define ADC_CX_CONTROL_UNDEF 0x00 -#define ADC_CX_CONTROL_CLOCKSEL 0x01 - -/* Clock Multiplier Control Selectors */ - -#define ADC_CM_CONTROL_UNDEF 0x00 -#define ADC_CM_CONTROL_NUMERATOR 0x01 -#define ADC_CM_CONTROL_DENOMINATOR 0x02 - -/* Terminal Control Selectors */ - -#define ADC_TE_CONTROL_UNDEF 0x00 -#define ADC_TE_CONTROL_COPY_PROTECT 0x01 -#define ADC_TE_CONTROL_CONNECTOR 0x02 -#define ADC_TE_CONTROL_OVERLOAD 0x03 -#define ADC_TE_CONTROL_CLUSTER 0x04 -#define ADC_TE_CONTROL_UNDERFLOW 0x05 -#define ADC_TE_CONTROL_OVERFLOW 0x06 -#define ADC_TE_CONTROL_LATENCY 0x07 - -/* Mixer Control Selectors */ - -#define ADC_MU_CONTROL_UNDEF 0x00 -#define ADC_MU_CONTROL_MIXER 0x01 -#define ADC_MU_CONTROL_CLUSTER 0x02 -#define ADC_MU_CONTROL_UNDERFLOW 0x03 -#define ADC_MU_CONTROL_OVERFLOW 0x04 -#define ADC_MU_CONTROL_LATENCY 0x05 - -/* Selector Control Selectors */ - -#define ADC_SU_CONTROL_UNDEF 0x00 -#define ADC_SU_CONTROL_SELECTOR 0x01 -#define ADC_SU_CONTROL_LATENCY 0x02 - -/* Feature Unit Control Selectors */ - -#define ADC_FU_CONTROL_UNDEF 0x00 -#define ADC_FU_CONTROL_MUTE 0x01 -#define ADC_FU_CONTROL_VOLUME 0x02 -#define ADC_FU_CONTROL_BASS 0x03 -#define ADC_FU_CONTROL_MID 0x04 -#define ADC_FU_CONTROL_TREBLE 0x05 -#define ADC_FU_CONTROL_EQUALIZER 0x06 -#define ADC_FU_CONTROL_AGC 0x07 -#define ADC_FU_CONTROL_DELAY 0x08 -#define ADC_FU_CONTROL_BASS_BOOST 0x09 -#define ADC_FU_CONTROL_LOUDNESS 0x0a -#define ADC_FU_CONTROL_INP_GAIN 0x0b -#define ADC_FU_CONTROL_INP_GAIN_PAD 0x0c -#define ADC_FU_CONTROL_PHASE_INVERT 0x0d -#define ADC_FU_CONTROL_UNDERFLOW 0x0e -#define ADC_FU_CONTROL_OVERFLOW 0x0f -#define ADC_FU_CONTROL_LATENCY 0x10 - -/* Parametric Equalizer Section Effect Unit Control Selectors */ - -#define ADC_PE_CONTROL_UNDEF 0x00 -#define ADC_PE_CONTROL_ENABLE 0x01 -#define ADC_PE_CONTROL_CENTERFREQ 0x02 -#define ADC_PE_CONTROL_QFACTOR 0x03 -#define ADC_PE_CONTROL_GAIN 0x04 -#define ADC_PE_CONTROL_UNDERFLOW 0x05 -#define ADC_PE_CONTROL_OVERFLOW 0x06 -#define ADC_PE_CONTROL_LATENCY 0x07 - -/* Reverberation Effect Unit Control Selectors */ - -#define ADC_RV_CONTROL_UNDEF 0x00 -#define ADC_RV_CONTROL_ENABLE 0x01 -#define ADC_RV_CONTROL_TYPE 0x02 -#define ADC_RV_CONTROL_LEVEL 0x03 -#define ADC_RV_CONTROL_TIME 0x04 -#define ADC_RV_CONTROL_FEEDBACK 0x05 -#define ADC_RV_CONTROL_PREDELAY 0x06 -#define ADC_RV_CONTROL_DENSITY 0x07 -#define ADC_RV_CONTROL_HF_ROLLOFF 0x08 -#define ADC_RV_CONTROL_UNDERFLOW 0x09 -#define ADC_RV_CONTROL_OVERFLOW 0x0a -#define ADC_RV_CONTROL_LATENCY 0x0b - -/* Modulation Delay Effect Unit Control Selectors */ - -#define ADC_MD_CONTROL_UNDEF 0x00 -#define ADC_MD_CONTROL_ENABLE 0x01 -#define ADC_MD_CONTROL_BALANCE 0x02 -#define ADC_MD_CONTROL_RATE 0x03 -#define ADC_MD_CONTROL_DEPTH 0x04 -#define ADC_MD_CONTROL_TIME 0x05 -#define ADC_MD_CONTROL_FEEDBACK 0x06 -#define ADC_MD_CONTROL_UNDERFLOW 0x07 -#define ADC_MD_CONTROL_OVERFLOW 0x08 -#define ADC_MD_CONTROL_LATENCY 0x09 - -/* Dynamic Range Compressor Effect Unit Control Selectors */ - -#define ADC_DR_CONTROL_UNDEF 0x00 -#define ADC_DR_CONTROL_ENABLE 0x01 -#define ADC_DR_CONTROL_COMP_RATE 0x02 -#define ADC_DR_CONTROL_MAXAMPL 0x03 -#define ADC_DR_CONTROL_THRESHOLD 0x04 -#define ADC_DR_CONTROL_ATTACK_TIME 0x05 -#define ADC_DR_CONTROL_RELEASE_TIME 0x06 -#define ADC_DR_CONTROL_UNDERFLOW 0x07 -#define ADC_DR_CONTROL_OVERFLOW 0x08 -#define ADC_DR_CONTROL_LATENCY 0x09 - -/* Up/Down-mix Processing Unit Control Selectors */ - -#define ADC_UD_CONTROL_UNDEF 0x00 -#define ADC_UD_CONTROL_ENABLE 0x01 -#define ADC_UD_CONTROL_MODE_SELECT 0x02 -#define ADC_UD_CONTROL_CLUSTER 0x03 -#define ADC_UD_CONTROL_UNDERFLOW 0x04 -#define ADC_UD_CONTROL_OVERFLOW 0x05 -#define ADC_UD_CONTROL_LATENCY 0x06 - -/* Dolby Prologic™ Processing Unit Control Selectors */ - -#define ADC_DP_CONTROL_UNDEF 0x00 -#define ADC_DP_CONTROL_ENABLE 0x01 -#define ADC_DP_CONTROL_MODE_SELECT 0x02 -#define ADC_DP_CONTROL_CLUSTER 0x03 -#define ADC_DP_CONTROL_UNDERFLOW 0x04 -#define ADC_DP_CONTROL_OVERFLOW 0x05 -#define ADC_DP_CONTROL_LATENCY 0x06 - -/* Stereo Extender Processing Unit Control Selectors */ - -#define ADC_STEXT_CONTROL_UNDEF 0x00 -#define ADC_STEXT_CONTROL_ENABLE 0x01 -#define ADC_STEXT_CONTROL_WIDTH 0x02 -#define ADC_STEXT_CONTROL_UNDERFLOW 0x03 -#define ADC_STEXT_CONTROL_OVERFLOW 0x04 -#define ADC_STEXT_CONTROL_LATENCY 0x05 - -/* Extension Unit Control Selectors */ - -#define ADC_XU_CONTROL_UNDEF 0x00 -#define ADC_XU_CONTROL_ENABLE 0x01 -#define ADC_XU_CONTROL_CLUSTER 0x02 -#define ADC_XU_CONTROL_UNDERFLOW 0x03 -#define ADC_XU_CONTROL_OVERFLOW 0x04 -#define ADC_XU_CONTROL_LATENCY 0x05 - -/* AudioStreaming Interface Control Selectors */ - -#define ADC_AS_CONTROL_UNDEF 0x00 -#define ADC_AS_CONTROL_ACT_ALT 0x01 -#define ADC_AS_CONTROL_VAL_ALT 0x02 -#define ADC_AS_CONTROL_AUDIO_FORMAT 0x03 - -/* Encoder Control Selectors */ - -#define ADC_EN_CONTROL_UNDEF 0x00 -#define ADC_EN_CONTROL_BIT_RATE 0x01 -#define ADC_EN_CONTROL_QUALITY 0x02 -#define ADC_EN_CONTROL_VBR 0x03 -#define ADC_EN_CONTROL_TYPE 0x04 -#define ADC_EN_CONTROL_UNDERFLOW 0x05 -#define ADC_EN_CONTROL_OVERFLOW 0x06 -#define ADC_EN_CONTROL_ENCODER_ERR 0x07 -#define ADC_EN_CONTROL_PARAM1 0x08 -#define ADC_EN_CONTROL_PARAM2 0x09 -#define ADC_EN_CONTROL_PARAM3 0x0a -#define ADC_EN_CONTROL_PARAM4 0x0b -#define ADC_EN_CONTROL_PARAM5 0x0c -#define ADC_EN_CONTROL_PARAM6 0x0d -#define ADC_EN_CONTROL_PARAM7 0x0e -#define ADC_EN_CONTROL_PARAM8 0x0f - -/* MPEG Decoder Control Selectors */ - -#define ADC_MPGD_CONTROL_UNDEF 0x00 -#define ADC_MPGD_CONTROL_DUAL_CHAN 0x01 -#define ADC_MPGD_CONTROL_2ND_STEREO 0x02 -#define ADC_MPGD_CONTROL_MULTILING 0x03 -#define ADC_MPGD_CONTROL_DYN_RANGE 0x04 -#define ADC_MPGD_CONTROL_SCALING 0x05 -#define ADC_MPGD_CONTROL_HILO_SCALE 0x06 -#define ADC_MPGD_CONTROL_UNDERFLOW 0x07 -#define ADC_MPGD_CONTROL_OVERFLOW 0x08 -#define ADC_MPGD_CONTROL_DECODE_ERR 0x09 - -/* AC-3 Decoder Control Selectors */ - -#define ADC_AC3D_CONTROL_UNDEF 0x00 -#define ADC_AC3D_CONTROL_MODE 0x01 -#define ADC_AC3D_CONTROL_DYN_RANGE 0x02 -#define ADC_AC3D_CONTROL_SCALING 0x03 -#define ADC_AC3D_CONTROL_HILO_SCALE 0x04 -#define ADC_AC3D_CONTROL_UNDERFLOW 0x05 -#define ADC_AC3D_CONTROL_OVERFLOW 0x06 -#define ADC_AC3D_CONTROL_DECODE_ERR 0x07 - -/* WMA Decoder Control Selectors */ - -#define ADC_WMAD_CONTROL_UNDEF 0x00 -#define ADC_WMAD_CONTROL_UNDERFLOW 0x01 -#define ADC_WMAD_CONTROL_OVERFLOW 0x02 -#define ADC_WMAD_CONTROL_DECODE_ERR 0x03 - -/* DTS Decoder Control Selectors */ - -#define ADC_DTSD_CONTROL_UNDEF 0x00 -#define ADC_DTSD_CONTROL_UNDERFLOW 0x01 -#define ADC_DTSD_CONTROL_OVERFLOW 0x02 -#define ADC_DTSD_CONTROL_DECODE_ERR 0x03 - -/* Endpoint Control Selectors */ - -#define ADC_EP_CONTROL_UNDEF 0x00 -#define ADC_EP_CONTROL_PITCH 0x01 -#define ADC_EP_CONTROL_OVERRUN 0x02 -#define ADC_EP_CONTROL_UNDERRUN 0x03 - -/* Encoder Error Codes */ - - /* <0: Reserved for vendor extensions */ -#define ADC_ENCODER_SUCCESS 0 /* No Error */ -#define ADC_ENCODER_ERROR_NOMEM 1 /* Out of Memory */ -#define ADC_ENCODER_ERROR_BW 2 /* Out of Bandwidth */ -#define ADC_ENCODER_ERROR_CYCLE 3 /* Out of Processing Cycles */ -#define ADC_ENCODER_ERROR_FRAME 4 /* General Format Frame Error */ -#define ADC_ENCODER_ERROR_TOOSMALL 5 /* Format Frame Too Small */ -#define ADC_ENCODER_ERROR_TOOBIG 6 /* Format Frame Too Large */ -#define ADC_ENCODER_ERROR_BADFORMAT 7 /* Bad Data Format */ -#define ADC_ENCODER_ERROR_NCHAN 8 /* Incorrect Number of Channels */ -#define ADC_ENCODER_ERROR_RATE 9 /* Incorrect Sampling Rate */ -#define ADC_ENCODER_ERROR_BITRATE 10 /* Unable to Meet Target Bitrate */ -#define ADC_ENCODER_ERROR_PARMS 11 /* Inconsistent Set of Parameters */ -#define ADC_ENCODER_ERROR_NOTREADY 12 /* Not Ready */ -#define ADC_ENCODER_ERROR_BUSY 13 /* Busy */ - /* >13: Reserved */ - -/* Format Type Codes */ - -#define ADC_FORMAT_TYPE_UNDEF 0x00 -#define ADC_FORMAT_TYPEI 0x01 -#define ADC_FORMAT_TYPEII 0x02 -#define ADC_FORMAT_TYPEIII 0x03 -#define ADC_FORMAT_TYPEIV 0x04 -#define ADC_FORMAT_EXT_TYPEI 0x81 -#define ADC_FORMAT_EXT_TYPEII 0x82 -#define ADC_FORMAT_EXT_TYPEIII 0x83 - -/* Audio Data Format Type I Bit Allocations */ - -#define ADC_FORMAT_TYPEI_PCM (1 << 0) -#define ADC_FORMAT_TYPEI_PCM8 (1 << 1) -#define ADC_FORMAT_TYPEI_IEEEFLOAT (1 << 2) -#define ADC_FORMAT_TYPEI_ALAW (1 << 3) -#define ADC_FORMAT_TYPEI_MULAW (1 << 4) -#define ADC_FORMAT_TYPEI_RAWDATA (1 << 31) - -/* Audio Data Format Type II Bit Allocations */ - -#define ADC_FORMAT_TYPEII_MPEG (1 << 0) -#define ADC_FORMAT_TYPEII_AC3 (1 << 1) -#define ADC_FORMAT_TYPEII_WMA (1 << 2) -#define ADC_FORMAT_TYPEII_DTS (1 << 3) -#define ADC_FORMAT_TYPEII_RAWDATA (1 << 31) - -/* Audio Data Format Type III Bit Allocations */ - - -#define ADC_FORMAT_TYPEIII_IEC61937_AC3 (1 << 0) -#define ADC_FORMAT_TYPEIII_IEC61937_MPEG1_L1 (1 << 1) -#define ADC_FORMAT_TYPEIII_IEC61937_MPEG1_L2_3 (1 << 1) -#define ADC_FORMAT_TYPEIII_IEC61937_MPEG2_NOEXT (1 << 2) -#define ADC_FORMAT_TYPEIII_IEC61937_MPEG2_EXT (1 << 3) -#define ADC_FORMAT_TYPEIII_IEC61937_MPEG2_AAC_ADTS (1 << 4) -#define ADC_FORMAT_TYPEIII_IEC61937_MPEG2_L1_LS (1 << 5) -#define ADC_FORMAT_TYPEIII_IEC61937_MPEG2_L2_3_LS (1 << 6) -#define ADC_FORMAT_TYPEIII_IEC61937_DTS-I (1 << 7) -#define ADC_FORMAT_TYPEIII_IEC61937_DTS-II (1 << 8) -#define ADC_FORMAT_TYPEIII_IEC61937_DTS-III (1 << 9) -#define ADC_FORMAT_TYPEIII_IEC61937_ATRAC (1 << 10) -#define ADC_FORMAT_TYPEIII_IEC61937_ATRAC2_3 (1 << 11) -#define ADC_FORMAT_TYPEIII_WMA (1 << 12) - -/* Audio Data Format Type IV Bit Allocations */ - -#define ADC_FORMAT_TYPEIV_PCM (1 << 0) -#define ADC_FORMAT_TYPEIV_PCM8 (1 << 1) -#define ADC_FORMAT_TYPEIV_IEEE_FLOAT (1 << 2) -#define ADC_FORMAT_TYPEIV_ALAW (1 << 3) -#define ADC_FORMAT_TYPEIV_MULAW (1 << 4) -#define ADC_FORMAT_TYPEIV_MPEG (1 << 5) -#define ADC_FORMAT_TYPEIV_AC3 (1 << 6) -#define ADC_FORMAT_TYPEIV_WMA (1 << 7) -#define ADC_FORMAT_TYPEIV_IEC61937_AC3 (1 << 8) -#define ADC_FORMAT_TYPEIV_IEC61937_MPEG1_L1 (1 << 9) -#define ADC_FORMAT_TYPEIV_IEC61937_MPEG1_L2_3 (1 << 10) -#define ADC_FORMAT_TYPEIV_IEC61937_MPEG2_NOEXT (1 << 10) -#define ADC_FORMAT_TYPEIV_IEC61937_MPEG2_EXT (1 << 11) -#define ADC_FORMAT_TYPEIV_IEC61937_MPEG2_AAC_ADTS (1 << 12) -#define ADC_FORMAT_TYPEIV_IEC61937_MPEG2_L1_LS (1 << 13) -#define ADC_FORMAT_TYPEIV_IEC61937_MPEG2_L2_3_LS (1 << 14) -#define ADC_FORMAT_TYPEIV_IEC61937_DTS-I (1 << 15) -#define ADC_FORMAT_TYPEIV_IEC61937_DTS-II (1 << 16) -#define ADC_FORMAT_TYPEIV_IEC61937_DTS-III (1 << 17) -#define ADC_FORMAT_TYPEIV_IEC61937_ATRAC (1 << 18) -#define ADC_FORMAT_TYPEIV_IEC61937_ATRAC2_3 (1 << 19) -#define ADC_FORMAT_TYPEIV_TYPE_III_WMA (1 << 20) -#define ADC_FORMAT_TYPEIV_IEC60958_PCM (1 << 21) - -/* Side Band Protocol Codes */ - -#define ADC_SIDEBAND_PROTOCOL_UNDEF 0x00 -#define ADC_PRES_TIMESTAMP_PROTOCOL 0x01 - -/* USB Terminal Types */ - -#define ADC_TERMINAL_UNDEF 0x0100 -#define ADC_TERMINAL_STREAMING 0x0101 -#define ADC_TERMINAL_VENDOR 0x01ff - -/* Input Terminal Types */ - -#define ADC_INTERM_UNDEF 0x0200 /* Undefined Type */ -#define ADC_INTERM_MIC 0x0201 /* A generic microhpone */ -#define ADC_INTERM_DESKTOP_MIC 0x0202 /* A desktop microphone */ -#define ADC_INTERM_PERSONAL_MIC 0x0203 /* Head-mounted or clip-on microphone */ -#define ADC_INTERM_OMNI_MIC 0x0204 /* Omni-directional microphone */ -#define ADC_INTERM_MIC_ARRAY 0x0205 /* Microphone array */ -#define ADC_INTERM_PROC_MIC_ARRAY 0x0206 /* Microphone array with signal processor */ - -/* Output Terminal Types */ - -#define ADC_OUTTERM_UNDEF 0x0300 /* Undefined Type */ -#define ADC_OUTTERM_SPEAKER 0x0301 /* Generic speakers */ -#define ADC_OUTTERM_HEADPHONES 0x0302 /* A head-mounted audio output device */ -#define ADC_OUTTERM_HEADDISPLAY 0x0303 /* Head Mounted Display Audio */ -#define ADC_OUTTERM_DESKTOP 0x0304 /* Desktop speaker */ -#define ADC_OUTTERM_ROOM 0x0305 /* Room speaker */ -#define ADC_OUTTERM_COMMS 0x0306 /* Communication speaker */ -#define ADC_OUTTERM_LOFREQ 0x0307 /* Low frequency effects speaker */ - -/* Bi-directional Terminal Types */ - -#define ADC_BIDITERM_UNDEF 0x0400 /* Undefined Type */ -#define ADC_BIDITERM_HANDSET 0x0401 /* Hand-held bi-directional audio device */ -#define ADC_BIDITERM_HEADSET 0x0402 /* Head-mounted bi-directional audio device */ -#define ADC_BIDITERM_SPEAKERPHONE 0x0403 /* Speakerphone, no echo reduction */ -#define ADC_BIDITERM_ECHOSUPPRESS 0x0404 /* Echo-suppressing speakerphone */ -#define ADC_BIDITERM_ECHOCANCEL 0x0405 /* Echo-canceling speakerphone */ - -/* Telephony Terminal Types */ - -#define ADC_TELETERM_UNDEF 0x0500 /* Undefined Type */ -#define ADC_TELETERM_PHONELINE 0x0501 /* Analog telephone line jack, an ISDN line, - * a proprietary PBX interface, or a wireless link */ -#define ADC_TELETERM_TELEPHONE 0x0502 /* Device can be used as a telephone */ -#define ADC_TELETERM_DOWNLINE 0x0503 /* Down Line Phone */ - -/* External Terminal Types */ - -#define ADC_EXTTERM_UNDEF 0x0600 /* Undefined Type */ -#define ADC_EXTTERM_ANALOG 0x0601 /* Generic analog connector */ -#define ADC_EXTTERM_DIGITAL 0x0602 /* Generic digital audio interface */ -#define ADC_EXTTERM_LINE 0x0603 /* Analog connector at standard line levels */ -#define ADC_EXTTERM_LEGACY 0x0604 /* Legacy audio line out connector */ -#define ADC_EXTTERM_SPDIF 0x0605 /* SPDIF interface */ -#define ADC_EXTTERM_1394DA 0x0606 /* 1394 DA stream */ -#define ADC_EXTTERM_1394DV 0x0607 /* 1394 DV stream soundtrack */ -#define ADC_EXTTERM_ADAT 0x0608 /* ADAT Lightpipe */ -#define ADC_EXTTERM_TDIF 0x0609 /* TDIF - Tascam Digital Interface */ -#define ADC_EXTTERM_MADI 0x060a /* MADI - Multi-channel Audio Digital Interface (AES) */ - -/* Embedded Function Terminal Types */ - -#define ADC_EMBEDTERM_UNDEF 0x0700 /* Undefined Type */ -#define ADC_EMBEDTERM_CALIBRATION 0x0701 /* Level Calibration Noise Source */ -#define ADC_EMBEDTERM_EQUALIZATION 0x0702 /* Equalization Noise */ -#define ADC_EMBEDTERM_CD 0x0703 /* CD player */ -#define ADC_EMBEDTERM_DAT 0x0704 /* Digital Audio Tape */ -#define ADC_EMBEDTERM_DCC 0x0705 /* Digital Compact Cassette */ -#define ADC_EMBEDTERM_COMPRESSED 0x0706 /* Compressed Audio Player */ -#define ADC_EMBEDTERM_TAPE 0x0707 /* Analog Audio Tape */ -#define ADC_EMBEDTERM_PHONOGRAPH 0x0708 /* Analog vinyl record player */ -#define ADC_EMBEDTERM_VCR 0x0709 /* Audio track of VCR */ -#define ADC_EMBEDTERM_VIDDISC 0x070a /* Audio track of VideoDisc player */ -#define ADC_EMBEDTERM_DVD 0x070b /* Audio track of DVD player */ -#define ADC_EMBEDTERM_TVTUNER 0x070c /* Audio track of TV tuner */ -#define ADC_EMBEDTERM_SATELLITE 0x070d /* Audio track of satellite receiver */ -#define ADC_EMBEDTERM_CABLETUNER 0x070e /* Audio track of cable tuner */ -#define ADC_EMBEDTERM_DSS 0x070f /* Audio track of DSS receiver */ -#define ADC_EMBEDTERM_RADIO 0x0710 /* AM/FM radio receiver */ -#define ADC_EMBEDTERM_TRANSMITTER 0x0711 /* AM/FM radio transmitter */ -#define ADC_EMBEDTERM_MULTITRACK 0x0712 /* A multi-track recording system */ -#define ADC_EMBEDTERM_SYNTHESIZER 0x0713 /* Synthesizer */ -#define ADC_EMBEDTERM_PIANO 0x0714 /* Piano */ -#define ADC_EMBEDTERM_GUITAR 0x0715 /* Guitar */ -#define ADC_EMBEDTERM_PERCUSSON 0x0716 /* Percussion Instrument */ -#define ADC_EMBEDTERM_INSTRUMENT 0x0717 /* Other Musical Instrument */ - -/******************************************************************************************** - * Public Types - ********************************************************************************************/ -/* Audio Channel Cluster Descriptor */ - -struct adc_cluster_desc_s -{ - uint8_t cl_nchan; /* 0: Number of logical channels in the cluster */ - uint8_t cl_config[4]; /* 1: The spatial location of the channels */ - uint8_t cl_names; /* 5: Index of name string of first channel */ -}; -#define USB_SIZEOF_ADC_CLUSTER_DESC 6 - -/* Class-specific AC Interface Descriptor */ - -struct adc_ac_ifdesc_s -{ - uint8_t ac_len; /* 0: Descriptor length (9)*/ - uint8_t ac_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t ac_subtype; /* 2: Descriptor sub-type (ADC_AC_HEADER) */ - uint8_t ac_adc[2]; /* 3: ADC spec version in BCD */ - uint8_t ac_category; /* 5: Category of audio function */ - uint8_t ac_totallen[2]; /* 6: Total length */ - uint8_t ac_controls; /* 8: Bits 0-1: Latency control; Bits 2-7 reserved */ -}; -#define USB_SIZEOF_ADC_AC_IFDESC 9 - -/* Clock Source Descriptor */ - -struct adc_clksrc_desc_s -{ - uint8_t cs_len; /* 0: Descriptor length (8)*/ - uint8_t cs_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t cs_subtype; /* 2: Descriptor sub-type (ADC_AC_CLOCK_SOURCE) */ - uint8_t cs_clockid; /* 3: Identifies clock source entity */ - uint8_t cs_attr; /* 4: Bits 0-1: CLKSRC type, D2: Clock synch'ed top SOF */ - uint8_t cs_controls; /* 5: Bits 0-1: Clock freq control, Bits 2-3: Clock valid control */ - uint8_t cs_termid; /* 6: ID of the terminal associated with the clock source */ - uint8_t cs_clksrc; /* 7: Clock source string index */ -}; -#define USB_SIZEOF_ADC_CLKSRC_DESC 8 - -/* Clock Selector Descriptor */ - -struct adc_clksel_desc_s -{ - uint8_t cl_len; /* 0: Descriptor length (7+npins)*/ - uint8_t cl_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t cl_subtype; /* 2: Descriptor sub-type (ADC_AC_CLOCK_SELECTOR) */ - uint8_t cl_clockid; /* 3: Identifies clock source entity */ - uint8_t cl_npins; /* 4: Number of input pins */ - uint8_t cl_variable[1]; /* 5-(5+npins-1): cl_csrcid, ID of clock input to pin n, n=1-npins */ - /* 5+npins: cl_controls: - * Bits 0-1: Clock selector controls, Bits 2-7: Reserved */ - /* 6+npins: cl_clksel - * Clock selector string index */ -}; - -#define cl_csrcid(n) cl_variable[(n)-1] -#define cl_controls(p) cl_variable[(p)->cl_npins] -#define cl_clksel(p) cl_variable[(p)->cl_npins+1] - -#define USB_SIZEOF_ADC_CLKSEL_DESC(npins) (7+(npins)) - -/* Clock Multiplier Descriptor */ - -struct adc_clkmult_desc_s -{ - uint8_t cm_len; /* 0: Descriptor length (7) */ - uint8_t cm_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t cm_subtype; /* 2: Descriptor sub-type (ADC_AC_CLOCK_MULTIPLIER) */ - uint8_t cm_clockid; /* 3: Identifies clock source entity */ - uint8_t cm_csrcid; /* 4: ID of clock input to list pin n */ - uint8_t cm_controls; /* 5: Bits 0-1: Clock numerator control, - * Bits 2-3: Clock denominator control */ - uint8_t cm_clkmult; /* 6: Index of clock multiplier name string */ -}; -#define USB_SIZEOF_ADC_CLKMULT_DESC 7 - -/* Input Terminal Descriptor */ - -struct adc_interm_desc_s -{ - uint8_t it_len; /* 0: Descriptor length (17) */ - uint8_t it_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t it_subtype; /* 2: Descriptor sub-type (ADC_AC_INPUT_TERMINAL) */ - uint8_t it_termid; /* 3: Identifies terminal in audio function */ - uint8_t it_termtype[2]; /* 4: Terminal type */ - uint8_t it_outterm; /* 6: ID of the associated output terminal */ - uint8_t it_csrcid; /* 7: ID of clock entity to which terminal is connected */ - uint8_t it_nchan; /* 8: Number of logical output channels */ - uint8_t it_config[4]; /* 9: The spatial location of the logical channels */ - uint8_t it_names; /* 13: Index of name string of first logical channel */ - uint8_t it_controls{2]; /* 14: Bits 0-1: Copy protect control, - * Bits 2-3: Converter control - * Bits 4-5: Overload control - * Bits 6-7: Cluster control - * Bits 8-9: Underflow control - * Bits 10-11: Overflow control - * Bits 12-15: Reserved */ - uint8_t it_interm; /* 16: Input terminal string index */ -}; -#define USB_SIZEOF_ADC_INTERM_DESC 17 - -/* Output Terminal Descriptor */ - -struct adc_outterm_desc_s -{ - uint8_t ot_len; /* 0: Descriptor length (12) */ - uint8_t ot_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t ot_subtype; /* 2: Descriptor sub-type (ADC_AC_OUTPUT_TERMINAL) */ - uint8_t ot_termid; /* 3: Identifies terminal in audio function */ - uint8_t ot_termtype[2]; /* 4: Terminal type */ - uint8_t ot_interm; /* 6: ID of the associated input terminal */ - uint8_t ot_srcid; /* 7: ID of unit/terminal to which terminal is connnected */ - uint8_t ot_csrcid; /* 8: ID of clock entity to whcih terminal is connected */ - uint8_t ot_controls{2]; /* 9: Bits 0-1: Copy protect control, - * Bits 2-3: Connector control - * Bits 4-5: Overload control - * Bits 6-7: Underflow control - * Bits 8-9: Overflow control - * Bits 10-15: Reserved */ - uint8_t ot_outterm; /* 11: Output terminal string index */ -}; -#define USB_SIZEOF_ADC_OUTTERM_DESC 12 - -/* Mixer Unit Descriptor */ - -struct adc_mixerunit_desc_s -{ - uint8_t mu_len; /* 0: Descriptor length (13+npins+nchan)*/ - uint8_t mu_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t mu_subtype; /* 2: Descriptor sub-type (ADC_AC_MIXER_UNIT) */ - uint8_t mu_unitid; /* 3: Identifies unit in audio function */ - uint8_t mu_npins; /* 4: Number of input pins of this unit */ - uint8_t mu_variable[1]; /* 5-(5+npins-1): mu_srcid[n] - * ID of clock input connected to pin n, n=1-npins */ - /* 5+npins: nchan=Number of logic output channels */ - /* 6+npins: config[4]=spatial location of channels */ - /* 10+npins: name=String index of first channel name */ - /* 11+npins+nchan: controls - * Bits 0-1: Cluster control - * Bits 2-3: Underflow control - * Bits 4-5: Overflow control - * Bits 6-7: Reserved */ - /* 12+npins+nchan: mixer=String index of mixer unit name */ -}; - -#define mu_srcid[n] mu_variable[(n)-1] -#define mu_nchan(p) mu_variable[(p)->mu_npins] -#define mu_controls(p) mu_variable[(p)->mu_npins+1] -#define mu_mixer(p) mu_variable[(p)->mu_npins+2] - -#define USB_SIZEOF_ADC_CLKSEL_DESC(npins,nchan) (13+(npins)+(nchan)) - -/* Selector Unit Descriptor */ - -struct adc_selunit_desc_s -{ - uint8_t su_len; /* 0: Descriptor length (7+npins) */ - uint8_t su_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t su_subtype; /* 2: Descriptor sub-type (ADC_AC_SELECTOR_UNIT) */ - uint8_t su_unitid; /* 3: Identifies unit in audio function */ - uint8_t su_npins; /* 4: Number of input pins of this unit */ - uint8_t su_vairable[1]; /* 5-(5+npins-1): su_srcid[n]=ID of unit/terminal input connected to - * pin n, n=1-npins */ - /* 5+npins: su_controls - * Bits 0-1: Selector control - * Bits 2-7: Reserved */ - /* 6+npins: su_selector=String index of selector unit name */ -}; - -#define su_srcid(n) su_srcid[(n)-1] -#define su_controls(p) su_srcid[(p)->su_npins+1] -#define su_selector(p) su_srcid[(p)->su_npins+2] - -#define USB_SIZEOF_ADC_SELUNIT_DESC(npins,nchan) (7+(npins)) - -/* Feature Unit Descriptor */ - -struct adc_featunit_desc_s -{ - uint8_t fu_len; /* 0: Descriptor length (6+4*(nchan+1)) */ - uint8_t fu_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t fu_subtype; /* 2: Descriptor sub-type (ADC_AC_FEATURE_UNIT) */ - uint8_t fu_unitid; /* 3: Identifies unit in audio function */ - uint8_t fu_srcid; /* 4: ID of unit/terminal to which unit is connected */ - uint8_t fu_variable[1]; /* 5-(5+4*nchan): fu_controls - * Controls for master channel n, n=0,..nchan, - * Bits 0-1: Mute control - * Bits 2-3: Volume control - * Bits 4-5: Bass control - * Bits 6-7: Mid control - * Bits 8-9: Treble control - * Bits 10-11: Graphic equalizer control - * Bits 12-13: Automatic gain control - * Bits 14-15: Delay control - * Bits 16-17: Bass boos control - * Bits 18-19: Loudness control - * Bits 20-21: Input gain control - * Bits 22-23: Input gain pad control - * Bits 24-25: Phase inverter control - * Bits 26-27: Underflow control - * Bits 28-29: Overflow control - * Bits 30-31: Reserved */ - /* 5+4*(nchan+1): feature=Strings index to feature unit name */ -}; - -#define fu_controls(n) fu_variable[4*(n)] -#define fu_feature(nchan) fu_variable[4*((nchan)+1] - -#define USB_SIZEOF_ADC_FEATUNIT_DESC(nchan) (6+4*((nchan)+1))) - -/* Sampling Rate Converter Descriptor */ - -struct adc_srconverter_desc_s -{ - uint8_t sr_len; /* 0: Descriptor length (8) */ - uint8_t sr_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t sr_subtype; /* 2: Descriptor sub-type (ADC_AC_SAMPLERATE_CONVERTER) */ - uint8_t sr_unitid; /* 3: Identifies unit in audio function */ - uint8_t sr_srcid; /* 4: ID of unit/terminal to which unit is connected */ - uint8_t sr_csrcinid; /* 5: ID of clock entity to which unit input is connected */ - uint8_t sr_csrcoutid; /* 6: ID of clock entity to which unit output is connected */ - uint8_t sr_converter; /* 7: String index to the name fo the SRC unit */ -}; -#define USB_SIZEOF_ADC_SRCCONVERTER_DESC (8) - -/* Common Effect Unit Descriptor */ - -struct adc_effectunit_desc_s -{ - uint8_t ef_len; /* 0: Descriptor length (16+4*nchan) */ - uint8_t ef_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t ef_subtype; /* 2: Descriptor sub-type (ADC_AC_EFFECT_UNIT) */ - uint8_t ef_unitid; /* 3: Identifies unit in audio function */ - uint8_t ef_eftype[2]; /* 4: Effect type */ - uint8_t ef_srcid; /* 6: ID of unit/terminal to which unit is connected */ - unit8_t ef_variable[1]; /* 7-(7+4*(nchan+1)): ef_controls[n] - * Controls for channel n, n=0,..,nchan - * Bits 0-31: Effect-specific allocation */ - /* 15+4*nchan: ef_effects=String index to the effect unit name */ -}; - -#define ef_controls(n) ef_controls[4*(n)] -#define ef_effects(nchan) ef_controls[4*(nchan)] - -#define USB_SIZEOF_ADC_EFFECTUNIT_DESC(nchan) (16+4*(nchsn)) - -/* Parametric Equalizer Section Effect Unit Descriptor - * - * ef_eftype = ADC_EFFECT_PARAM_EQ_SECTION - * ef_controls: - * Bits 0-1: Enable control - * Bits 2-3: Center frequency control - * Bits 4-5: Q factor control - * Bits 6-7: Gain control - * Bits 8-9: Underflow control - * Bits 10-11: Overflow control - * Bits 12-31: Reserved - * - * Reverberation Effect Unit Descriptor - * - * ef_eftype = ADC_EFFECT_REVERBERATION - * ef_controls: - * Bits 0-1: Enable control - * Bits 2-3: Type control - * Bits 4-5: Level control - * Bits 6-7: Time control - * Bits 8-9: Delay feedback control - * Bits 10-11: Pre-delay control - * Bits 12-13: Density control - * Bits 13-15: Hi-freq roll-off control - * Bits 16-17: Underflow control - * Bits 18-19: Overflow control - * Bits 20-31: Reserved - * - * Modulation Delay Effect Unit Descriptor - * - * ef_eftype = ADC_EFFECT_MOD_DELAY - * ef_controls: - * Bits 0-1: Enable control - * Bits 2-3: Balance control - * Bits 4-5: Rate control - * Bits 6-7: Depth control - * Bits 8-9: Time control - * Bits 10-11: Feedback level control - * Bits 12-13: Underflow control - * Bits 14-15: Overflow control - * Bits 16-31: Reserved - * - * Dynamic Range Compressor Effect Unit Descriptor - * - * ef_eftype = ADC_EFFECT_DYN_RANGE_COMP - * ef_controls: - * Bits 0-1: Enable control - * Bits 2-3: Compression control - * Bits 4-5: MaxAmpl control - * Bits 6-7: Threshold control - * Bits 8-9: Attack time control - * Bits 10-11: Release time control - * Bits 12-13: Underflow control - * Bits 14-15: Overflow control - * Bits 16-31: Reserved - */ - -/* Common Processing Unit Descriptor */ - -struct adc_procunit_desc_s -{ - uint8_t pu_len; /* 0: Descriptor length (17+npins+x) */ - uint8_t pu_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t pu_subtype; /* 2: Descriptor sub-type (ADC_AC_PROCESSING_UNIT) */ - uint8_t pu_unitid; /* 3: Identifies unit in audio function */ - uint8_t pu_putype[2]; /* 4: Processing unit type */ - uint8_t pu_npins; /* 6: Number of input pins of this unit */ - unit8_t pu_variable[1]; /* 7-(7+(npins11)): pu_srcid[n] - * ID of unit/terminal input is connected to, n=1,..,npins */ - /* 7+npins: pu_nchan: Number of logic output channels */ - /* 8+npins: pu_config: Spatial location of channels */ - /* 12+npins: pu_names: String index to first channel name */ - /* 13+npins: pu_controls - * Bits 0-1: Enable control - * Bits 2-15: Process-specific controls */ - /* 15+npins: pu_processing: String index to name of processing unit */ - /* 16+npins: pu_specific: Beginning of process-specific descriptor */ -}; - -#define pu_srcid(n) pu_variable[n] -#define pu_nchan(p) pu_variable[(Ip)->npins] -#define pu_config(p) pu_variable[(Ip)->npins+1] -#define pu_names(p) pu_variable[(Ip)->npins+5] -#define pu_controls(p) pu_variable[(Ip)->npins+6] -#define pu_processing(p) pu_variable[(Ip)->npins+8] -#define pu_specific(p) &pu_variable[(Ip)->npins+9] - -#define USB_SIZEOF_ADC_PROCUNIT_DESC(npins) (16+(npins)) - -/* Up/Down-mix Processing Unit Descriptor */ - -struct adc_updownunit_desc_s -{ - uint8_t ud_len; /* 0: Descriptor length (18+4*nmodes) */ - uint8_t ud_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t ud_subtype; /* 2: Descriptor sub-type (ADC_AC_PROCESSING_UNIT) */ - uint8_t ud_unitid; /* 3: Identifies unit in audio function */ - uint8_t ud_putype[2]; /* 4: Processing unit type (ADC_PROCESS_UPDOWNMIX) */ - uint8_t ud_npins; /* 6: Number of input pins of this unit (1) */ - unit8_t ud_srcid; /* 7: ID of unit/terminal input is connected to */ - uint8_t ud_nchan; /* 8: Number of logic output channels */ - uint8_t ud_config[4]; /* 9: Spatial location of channels */ - uint8_t ud_names; /* 13: String index to first channel name */ - uint8_t ud_controls[2]; /* 14: controls - * Bits 0-1: Enable control - * Bits 2-3; Mode select control - * Bits 4-5: Cluster control - * Bits 6-7: Underflow control - * Bits 8-9: Overflow control - * Bits 10-15 Reserved */ - uint8_t ud_processing; /* 16: String index to name of processing unit */ - uint8_t ud_nmodes; /* 17: Number of modes supported */ - uint8_t ud_modes[1]; /* 18-(18+4*(nmodes-1)): Active logical channels in mode n */ -}; - -#define USB_SIZEOF_ADC_UPDOWNUNIT_DESC(nmodes) (18+4(nmodes)) - -/* Dolby Prologic Processing Unit Descriptor */ - -struct adc_dolbyunit_desc_s -{ - uint8_t dp_len; /* 0: Descriptor length (18+4*nmodes) */ - uint8_t dp_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t dp_subtype; /* 2: Descriptor sub-type (ADC_AC_PROCESSING_UNIT) */ - uint8_t dp_unitid; /* 3: Identifies unit in audio function */ - uint8_t dp_putype[2]; /* 4: Processing unit type (ADC_PROCESS_DOLBY_PROLOGIC) */ - uint8_t dp_npins; /* 6: Number of input pins of this unit (1) */ - unit8_t dp_srcid; /* 7: ID of unit/terminal input is connected to */ - uint8_t dp_nchan; /* 8: Number of logic output channels */ - uint8_t dp_config[4]; /* 9: Spatial location of channels */ - uint8_t dp_names; /* 13: String index to first channel name */ - uint8_t dp_controls[2]; /* 14: controls - * Bits 0-1: Enable control - * Bits 2-3; Mode select control - * Bits 4-5: Cluster control - * Bits 6-7: Underflow control - * Bits 8-9: Overflow control - * Bits 10-15 Reserved */ - uint8_t dp_processing; /* 16: String index to name of processing unit */ - uint8_t dp_nmodes; /* 17: Number of modes supported */ - uint8_t dp_modes[1]; /* 18-(18+4*(nmodes-1)): Active logical channels in mode n */ -}; - -#define USB_SIZEOF_ADC_DOLBYUNIT_DESC(nmodes) (18+4(nmodes)) - -/* Stereo Extender Processing Unit Descriptor */ - -struct adc_stextunit_desc_s -{ - uint8_t st_len; /* 0: Descriptor length (17) */ - uint8_t st_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t st_subtype; /* 2: Descriptor sub-type (ADC_AC_PROCESSING_UNIT) */ - uint8_t st_unitid; /* 3: Identifies unit in audio function */ - uint8_t st_putype[2]; /* 4: Processing unit type (ADC_PROCESS_STEREO_EXTENDER) */ - uint8_t st_npins; /* 6: Number of input pins of this unit (1) */ - unit8_t st_srcid; /* 7: ID of unit/terminal input is connected to */ - uint8_t st_nchan; /* 8: Number of logic output channels */ - uint8_t st_config[4]; /* 9: Spatial location of channels */ - uint8_t st_names; /* 13: String index to first channel name */ - uint8_t st_controls[2]; /* 14: controls - * Bits 0-1: Enable control - * Bits 2-3; Width control - * Bits 4-5: Cluster control - * Bits 6-7: Underflow control - * Bits 8-9: Overflow control - * Bits 10-15 Reserved */ - uint8_t st_processing; /* 16: String index to name of processing unit */ -}; - -#define USB_SIZEOF_ADC_DOLBYUNIT_DESC(nmodes) (17) - -/* Extension Unit Descriptor */ - -struct adc_extunit_desc_s -{ - uint8_t xu_len; /* 0: Descriptor length (16+p) */ - uint8_t xu_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t xu_subtype; /* 2: Descriptor sub-type (ADC_AC_EXTENSION_UNIT) */ - uint8_t xu_unitid; /* 3: Identifies unit in audio function */ - uint8_t xu_extcode[2]; /* 4: Vendor-specific code identifying the extension unit */ - uint8_t xu_npins; /* 6: Number of input pins of this unit */ - uint8_t xu_variable[1]; /* 7-(7+(npins-1)): xu_srcid: ID of unit/terminal to which - * input pin n is connect, n=1,..,npins */ - /* 8+npins: xu_nchan: Number of logic output channels */ - /* 9+npins: xu_config: Spatial location of logical channels */ - /* 13+npins: xu_names: String index to first channel name */ - /* 14+npins: xu_controls: - * Bits 0-1: Enable control - * Bits 2-3: Cluster control - * Bits 4-5: Underflow control - * Bits 6-7: Overflow control */ - /* 15+np;ins: xu_extunit: String index to unit name */ -}; - -#define xu_srcid(n) xu_variable[n] -#define xu_nchan(p) xu_variable[(p)->xu_npins+1] -#define xu_config(p) xu_variable[(p)->xu_npins+2] -#define xu_names(p) xu_variable[(p)->xu_npins+6] -#define xu_controls(p) xu_variable[(p)->xu_npins+7] -#define xu_extunit(p) xu_variable[(p)->xu_npins+8] - -#define USB_SIZEOF_ADC_EXTUNIT_DESC(npins) (16+(npins)) - -/* Class-Specific AS Interface Descriptor */ - -struct adc_as_ifdesc_s -{ - uint8_t as_len; /* 0: Descriptor length (9)*/ - uint8_t as_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t as_subtype; /* 2: Descriptor sub-type (ADC_AS_GENERAL) */ - uint8_t as_terminal; /* 3: ID of connected terminal */ - uint8_t as_controls; /* 4: controls - * Bits 0-1: Active alternate setting control - * Bits 2-3: Valid alternate setting control - * Bits 4-7: Reserved */ - uint8_t as_format; /* 5: Format type of audio streaming interface */ - uint8_t as_formats[4]; /* 6: Supported audio datat formats */ - uint8_t as_nchan; /* 10: Number of physical channels in audo channel cluster */ - uint8_t as_config[4]; /* 11: Spatial location of channels */ - uint8_t as_names; /* 15: String index to name of first channel */ -}; - -#define USB_SIZEOF_ADC_AS_IFDESC 9 - -/* Encoder Descriptor */ - -struct adc_encoder_desc_s -{ - uint8_t as_len; /* 0: Descriptor length (21) */ - uint8_t as_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t as_subtype; /* 2: Descriptor sub-type (ADC_AS_ENCODER) */ - uint8_t as_encoderid; /* 3: Identifies the encoder within the interface */ - uint8_t as_encoder; /* 4: Identifies the encoder */ - uint8_t as_pad[3]; /* (there is an apparent error in the spec) */ - uint8_t as_controls[4]; /* 8: Controls - * Bits 2-3: Quality Control - * Bits 4-5: VBR Control - * Bits 6-7: Type Control - * Bits 8-9: Underflow Control - * Bits 10-11: Overflow Control - * Bits 12-13: Encoder Error Control - * Bits 14-15: Param1 Control - * Bits 16-17: Param2 Control - * Bits 18-19: Param3 Control - * Bits 20-21: Param4 Control - * Bits 22-23: Param5 Control - * Bits 24-25: Param6 Control - * Bits 26-27: Param7 Control - * Bits 28-20: Param8 Control - * Bits 30-31: Reserved */ - uint8_t as_param[8]; /* 12: String index of purpose of parameter n-1, n=1-8 */ - uint8_t as_encoder: /* 20: String index to the name of the encoder */ -}; - -#define USB_SIZEOF_ADC_ENCODER_DESC 21 - -/* MPEG Decoder Descriptor */ - -struct adc_mpeg_decoder_desc_s -{ - uint8_t md_len; /* 0: Descriptor length (10) */ - uint8_t md_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t md_subtype; /* 2: Descriptor sub-type (ADC_AS_DECODER) */ - uint8_t md_decoderid; /* 3: Identifies the decoder within the interface */ - uint8_t md_decoder; /* 4: Identifies the decoder (ADC_DECODER_MPEG) */ - uint8_t md_capabilities[2]; /* 5: MPEG capabilities - * Bits 0-2: Layer support - * Bit 0: Layer I - * Bit 1: Layer II - * Bit 2: Layer III - * Bit 3: MPEG-1 only. - * Bit 4: MPEG-1 dual-channel - * Bit 5: MPEG-2 second stereo - * Bit 6: MPEG-2 7.1 channel augmentation - * Bit 7: Adaptive multi-channel prediction - * Bits 8-9: MPEG-2 multilingual support - * 00 = Not supported - * 01 = Supported at Fs - * 10 = Reserved - * 11 = Supported at Fs and ½Fs. - * Bit 10: - * Bit 11-15: Reserved */ - uint8_t md_features; /* 7: MPEG features - * Bits 0-3: Reserved - * Bits 4-5 Internal dynamic range control - * 00 = not supported - * 01 = supported but not scalable - * 10 = scalable, common boost and cut scaling value - * 11 = scalable, separate boost and cut scaling value. - * Bits 6-7: Reserved */ - uint8_t md_controls; /* 8: Controls: - * Bits 0-1: Underflow control - * Bits 2-3: Overflow control - * Bits 4-5: Decoder error control - * Bits 6-7: Reserved */ - uint8_t md_decoder; /* 9: String index to the name of the decoder */ -}; - -#define USB_SIZEOF_ADC_MPEG_DECODER_DESC 10 - -/* AC-3 Decoder Descriptor */ - -struct adc_ac3_decoder_desc_s -{ - uint8_t ad_len; /* 0: Descriptor length (12) */ - uint8_t ad_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t ad_subtype; /* 2: Descriptor sub-type (ADC_AS_DECODER) */ - uint8_t ad_decoderid; /* 3: Identifies the decoder within the interface */ - uint8_t ad_decoder; /* 4: Identifies the decoder (ADC_DECODER_AC3) */ - uint8_t ad_id[4]; /* 5: Bitmap, 1=corresponding BSID mode supported */ - uint8_t ad_features; /* 7: MPEG features - * Bit 0: RF mode - * Bit 1: Line mode - * Bit 2: Custom0 mode - * Bit 3: Custom1 mode - * Bits 4-5 Internal dynamic range control - * 00 = not supported - * 01 = supported but not scalable - * 10 = scalable, common boost and cut scaling value - * 11 = scalable, separate boost and cut scaling value. - * Bits 6-7: Reserved */ - uint8_t ad_controls; /* 8: Controls: - * Bits 0-1: Underflow control - * Bits 2-3: Overflow control - * Bits 4-5: Decoder error control - * Bits 6-7: Reserved */ - uint8_t ad_decoder; /* 9: String index to the name of the decoder */ -}; - -#define USB_SIZEOF_ADC_AC3_DECODER_DESC 12 - -/* WMA Decoder Descriptor */ - -struct adc_wma_decoder_desc_s -{ - uint8_t wd_len; /* 0: Descriptor length (9) */ - uint8_t wd_type; /* 1: Descriptor type (ADC_CS_ENDPOINT) */ - uint8_t wd_subtype; /* 2: Descriptor sub-type (ADC_AS_DECODER) */ - uint8_t wd_decoderid; /* 3: Identifies the decoder within the interface */ - uint8_t wd_decoder; /* 4: Identifies the decoder (ADC_DECODER_WMA) */ - uint8_t wd_profile[2]; /* 5: WMA profile - * Bit 0: WMA profile 1, L1 - * Bit 1: WMA profile 2, L2 - * Bit 2: WMA profile 3, L3 - * Bit 3: WMA profile other, L - * Bit 4: WMA speech 1, S1 - * Bit 5: WMA speech 2, S2 - * Bit 6: WMAPro profile 1, M1 - * Bit 7: WMAPro profile 2, M2 - * Bit 8: WMAPro profile 3, M3 - * Bit 9: WMAPro profile other, M - * Bit 10: WMA lossless decoding is supported - * Bits 11-15: Reserved */ - uint8_t wd_controls; /* 7: Controls: - * Bits 0-1: Underflow control - * Bits 2-3: Overflow control - * Bits 4-5: Decoder error control - * Bits 6-7: Reserved */ - uint8_t wd_decoder; /* 9: String index to the name of the decoder */ -}; - -#define USB_SIZEOF_ADC_WMA_DECODER_DESC 9 - -/* DTS Decoder Descriptor */ - -struct adc_dts_decoder_desc_s -{ - uint8_t dd_len; /* 0: Descriptor length (8) */ - uint8_t dd_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t dd_subtype; /* 2: Descriptor sub-type (ADC_AS_DECODER) */ - uint8_t dd_decoderid; /* 3: Identifies the decoder within the interface */ - uint8_t dd_decoder; /* 4: Identifies the decoder (ADC_DECODER_DTS) */ - uint8_t dd_capabilities; /* 5: DTS capabilities - * Bit 0: Core - * Bit 1: Lossless - * Bit 2: LBR - * Bit 3: MultipleStreamMixing - * Bit 4: DualDecode - * Bits 5-7: Reserved */ - uint8_t dd_controls; /* 7: Controls: - * Bits 0-1: Underflow control - * Bits 2-3: Overflow control - * Bits 4-5: Decoder error control - * Bits 6-7: Reserved */ - uint8_t dd_decoder; /* 9: String index to the name of the decoder */ -}; - -#define USB_SIZEOF_ADC_DTS_DECODER_DESC 8 - -/* Class-Specific AS Isochronous Audio Data Endpoint Descriptor */ - -struct adc_audio_epdesc_s -{ - uint8_t ae_len; /* 0: Descriptor length (8) */ - uint8_t ae_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t ae_subtype; /* 2: Descriptor sub-type (ADC_EPTYPE_GENERAL) */ - uint8_t ae_attr; /* 3: Attributes: Bit 7: MaxPacketsOnly */ - uint8_t ae_controls; /* 4 Controls - * Bits 0-1: Pitch control - * Bits 2-3: Data overrun control - * Bits 4-5: Data underrun control - * Bits 6-7: Reserved */ - uint8_t ae_units; /* 5: Lock delay units - * 0=undefined - * 1=milliseconds - * 2=Decoded PCM samples - * 2-255=Reserved */ - uint8_t ae_delay[2]; /* 6: Lock delay */ -}; - -#define USB_SIZEOF_ADC_AUDIO_EPDESC 8 - -/* Layout 1, Control CUR Parameter Block */ - -struct adc_l1_curparm_s -{ - uint8_t l1_cur; /* 0: Setting of the CUR attribute of the addressed control */ -}; - -#define USB_SIZEOF_ADC_LI_CURPARM 1 - -/* Layout 1, Control RANGE Parameter Block */ - -struct adc_l1_subrange_s packed_struct -{ - uint8_t l1_min; /* 0: MIN attribute */ - uint8_t l1_max; /* 1: MAX attribute */ - uint8_t l1_res; /* 2: RES attribute */ -}; - -struct adc_l1_rangeparm_s packed_struct -{ - uint8_t l1_nranges; /* 0: Number of sub-ranges */ - struct adc_l1_subrange_s l1_subrange[1]; -}; - -#define USB_SIZEOF_ADC_LI_RANGEPARM(nranges) (1+3*(nranges)) - -/* Layout 2, Control CUR Parameter Block */ - -struct adc_l2_curparm_s -{ - uint8_t l2_cur[2]; /* 0: Setting of the CUR attribute of the addressed control */ -}; - -#define USB_SIZEOF_ADC_L2_CURPARM 2 - -/* Layout 2, Control RANGE Parameter Block */ - -struct adc_l2_subrange_s -{ - uint8_t l2_min[2]; /* 0: MIN attribute */ - uint8_t l2_max[2]; /* 2: MAX attribute */ - uint8_t l2_res[2]; /* 4: RES attribute */ -}; - -struct adc_l2_rangeparm_s -{ - uint8_t l2_nranges[2]; /* 0: Number of sub-ranges */ - struct adc_l2_subrange_s l2_subrange[1]; -}; - -#define USB_SIZEOF_ADC_L2_RANGEPARM(nranges) (2+6*(nranges)) - -/* Layout 2, Control CUR Parameter Block */ - -struct adc_l3_curparm_s -{ - uint8_t l3_cur[4]; /* 0: Setting of the CUR attribute of the addressed control */ -}; - -#define USB_SIZEOF_ADC_L3_CURPARM 4 - -/* Layout 2, Control RANGE Parameter Block */ - -struct adc_l3_subrange_s -{ - uint8_t l3_min[4]; /* 0: MIN attribute */ - uint8_t l3_max[4]; /* 2: MAX attribute */ - uint8_t l3_res[4]; /* 4: RES attribute */ -}; - -struct adc_l3_rangeparm_s -{ - uint8_t l3_nranges[2]; /* 0: Number of sub-ranges */ - struct adc_l3_subrange_s l3_subrange[1]; -}; - -#define USB_SIZEOF_ADC_L3_RANGEPARM(nranges) (2+12*(nranges)) - -/* Cluster Control CUR Parameter Block */ - -struct adc_clustctrl_curparm_s -{ - uint8_t cc_nchan; /* 0: Number of logical channels */ - uint8_t cc_config[4]; /* 1: Spatial location of channels */ - uint8_t cc_names; /* 5: String index of first channel name */ -}; - -#define USB_SIZEOF_ADC_CLUSTCTRL_CURPARM 6 - -/* Cluster Control CUR Parameter Block */ - -struct adc_connctrl_curparm_s -{ - uint8_t cc_nchan; /* 0: Number of logical channels */ - uint8_t cc_config[4]; /* 1: Spatial location of channels */ - uint8_t cc_names; /* 5: String index of first channel name */ -}; - -#define USB_SIZEOF_ADC_CONNCTRL_CURPARM 6 - -/* Graphic Equalizer Control CUR Parameter Block */ - -struct adc_equalizer_curparm_s -{ - uint8_t eq_bands[4]; /* 0: A set bit indicates that the band is present */ - uint8_t eq_cur[[1]; /* 4: Setting for the band in bands bitset */ -}; - -#define USB_SIZEOF_ADC_CONNCTRL_CURPARM(nbands) (4+(nbands)) - -/* Graphic Equalizer Control RANGE Parameter Block */ - -struct adc_eq_subrange_s packed_struct -{ - uint8_t eq_min; /* 0: MIN attribute */ - uint8_t eq_max; /* 1: MAX attribute */ - uint8_t eq_res; /* 2: RES attribute */ -}; - -struct adc_equalizer_rangeparm_s packed_struct -{ - uint8_t eq_nranges; /* 0: Number of sub-ranges */ - struct adc_eq_subrange_s eq_subrange[1]; -}; - -#define USB_SIZEOF_ADC_EQUALIZER_RANGEPARM(nranges) (1+3*(nranges)) - -/* Valid Alternate Settings Control CUR Parameter Block */ - -struct adc_altsettings_curparm_s -{ - uint8_t as_nsettings; /* 0: Number of alternate settings */ - uint8_t as_settings[1]; /* 1-: Altnating setting n, n-1,..., nsettings */ -}; - -#define USB_SIZEOF_ADC_ALTSETTINGS_CURPARM(nsettings) (1+(nsettings)) - -/* High/Low Scaling Control CUR Parameter Block */ - -struct adc_hilo_curparm_s -{ - uint8_t hl_lo; /* 0: CUR value of the low level scaling control */ - uint8_t hl_hi; /* 0: CUR value of the high level scaling control */ -}; - -/* High/Low Scaling Control RANGE Parameter Block */ - -struct adc_hl_subrange_s packed_struct -{ - uint8_t hl_min; /* 0: MIN attribute */ - uint8_t hl_max; /* 1: MAX attribute */ - uint8_t hl_res; /* 2: RES attribute */ -}; - -struct adc_hilo_rangeparm_s packed_struct -{ - uint8_t hl_nranges[2]; /* 0: Number of sub-ranges */ - struct adc_hl_subrange_s hl_subrange[1]; -}; - -#define USB_SIZEOF_ADC_HILO_RANGEPARM(nranges) (2+3*(nranges)) - -/* Interrupt Data Message Format */ - -struct adc_int_message_s -{ - uint8_t im_info; /* 0: Bitmap - * Bit 0: Vender specific, - * Bit 1: Interface or endpoint - * Bits 2-7: Reserved */ - uint8_t im_attr; /* 1: The attribute that cause the interrupt */ - uint8_t im_value[2]; /* 2: CS is MS byte; CN or MCN in LS byte */ - uint8_t im_index[2]; /* 4: ID or zero in MS bytes; Interface or endpoint is LS byte */ -}; - -#define USB_SIZEOF_ADC_INT_MESSAGE 6 - -/* Type I Format Type Descriptor */ - -struct adc_t1_format_desc_s -{ - uint8_t t1_len; /* 0: Descriptor length (6) */ - uint8_t t1_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t t1_subtype; /* 2: Descriptor sub-type (ADC_AS_FORMAT_TYPE) */ - uint8_t t1_fmttype; /* 3: Identifies the format type (ADC_FORMAT_TYPEI) */ - uint8_t t1_size; /* 4: Number of bytes in one audio subslot, 1,2,3, or 4 */ - uint8_t fl_resolution; /* 5: Number of bits used from audio subslot */ -}; - -#define USB_SIZEOF_ADC_T1_FORMAT_DESC 6 - -/* Type II Format Type Descriptor */ - -struct adc_t2_format_desc_s -{ - uint8_t t2_len; /* 0: Descriptor length (8) */ - uint8_t t2_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t t2_subtype; /* 2: Descriptor sub-type (ADC_AS_FORMAT_TYPE) */ - uint8_t t2_fmttype; /* 3: Identifies the format type (ADC_FORMAT_TYPEII) */ - uint8_t t2_bitrate[2]; /* 4 Maximum number of bits per second */ - uint8_t t2_slotsperframe[2]; /* 6: Number of PCM audio slots in one encoded audio frame*/ -}; - -#define USB_SIZEOF_ADC_T2_FORMAT_DESC 8 - -/* Type III Format Type Descriptor */ - -struct adc_t3_format_desc_s -{ - uint8_t t3_len; /* 0: Descriptor length (6) */ - uint8_t t3_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t t3_subtype; /* 2: Descriptor sub-type (ADC_AS_FORMAT_TYPE) */ - uint8_t t3_fmttype; /* 3: Identifies the format type (ADC_FORMAT_TYPEIII) */ - uint8_t t3_size; /* 4: Number of bytes in one audio subslot (2) */ - uint8_t t3_resolution; /* 5: Number of bits used from audio subslot */ -}; - -#define USB_SIZEOF_ADC_T3_FORMAT_DESC 6 - -/* Type IV Format Type Descriptor */ - -struct adc_t4_format_desc_s -{ - uint8_t t4_len; /* 0: Descriptor length (4) */ - uint8_t t4_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t t4_subtype; /* 2: Descriptor sub-type (ADC_AS_FORMAT_TYPE) */ - uint8_t t4_fmttype; /* 3: Identifies the format type (ADC_FORMAT_TYPEIV) */ -}; - -#define USB_SIZEOF_ADC_T4_FORMAT_DESC 6 - -/* Extended Type I Format Type Descriptor */ - -struct adc_x1_format_desc_s -{ - uint8_t x1_len; /* 0: Descriptor length (8) */ - uint8_t x1_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t x1_subtype; /* 2: Descriptor sub-type (ADC_AS_FORMAT_TYPE) */ - uint8_t x1_fmttype; /* 3: Identifies the format type (ADC_FORMAT_EXT_TYPEI) */ - uint8_t x1_size; /* 4: Number of bytes in one audio subslo, 1,2,3, or 4 */ - uint8_t xl_resolution; /* 5: Number of bits used from audio subslot */ - uint8_t x1_hdrlen; /* 6: Size of packet header (in bytes) */ - uint8_t x1_ctrlsize; /* 7: Size of control channel words (in bytes) */ - uint8_t x1_sbproto; /* 8: Sideband protocol used in packet header and ctrl channel */ -}; - -#define USB_SIZEOF_ADC_X1_FORMAT_DESC 8 - -/* Extended Type II Format Type Descriptor */ - -struct adc_x2_format_desc_s -{ - uint8_t x2_len; /* 0: Descriptor length (10) */ - uint8_t x2_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t x2_subtype; /* 2: Descriptor sub-type (ADC_AS_FORMAT_TYPE) */ - uint8_t x2_fmttype; /* 3: Identifies the format type (ADC_FORMAT_TYPEII) */ - uint8_t x2_bitrate[2]; /* 4 Maximum number of bits per second */ - uint8_t x2_samperframe[2]; /* 6: Number of PCM audio samples in one encoded audio frame*/ - uint8_t x2_hdrlen; /* 8: Size of packet header (in bytes) */ - uint8_t x2_sbproto; /* 9: Sideband protocol used in packet header and ctrl channel */ -}; - -#define USB_SIZEOF_ADC_x2_FORMAT_DESC 10 - -/* Extended Type III Format Type Descriptor */ - -struct adc_x3_format_desc_s -{ - uint8_t x3_len; /* 0: Descriptor length (8) */ - uint8_t x3_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */ - uint8_t x3_subtype; /* 2: Descriptor sub-type (ADC_AS_FORMAT_TYPE) */ - uint8_t x3_fmttype; /* 3: Identifies the format type (ADC_FORMAT_TYPEIII) */ - uint8_t x3_size; /* 4: Number of bytes in one audio subslot (2) */ - uint8_t x3_resolution; /* 5: Number of bits used from audio subslot */ - uint8_t x3_hdrlen; /* 6: Size of packet header (in bytes) */ - uint8_t x3_sbproto; /* 7: Sideband protocol used in packet header and ctrl channel */ -}; - -#define USB_SIZEOF_ADC_X3_FORMAT_DESC 8 - -/* Hi-Res Presentation TimeStamp Layout*/ - -struct adc_hires_timestamp_s -{ - uint8_t hr_flags; /* Bit32=valid */ - uint8_t hr_nsec[8]; /* Offset in nanoseconds from the beginning of the stream */ -}; - -/******************************************************************************************** - * Public Function Prototypes - ********************************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -# define EXTERN extern "C" -extern "C" { -#else -# define EXTERN extern -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_USB_AUDIO_H */ diff --git a/nuttx/include/nuttx/usb/cdc.h b/nuttx/include/nuttx/usb/cdc.h deleted file mode 100644 index 627dd77e3..000000000 --- a/nuttx/include/nuttx/usb/cdc.h +++ /dev/null @@ -1,879 +0,0 @@ -/******************************************************************************************** - * include/nuttx/usb/cdc.h - * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * References: "Universal Serial Bus Class Definitions for Communication - * Devices," Version 1.1, January 19, 1999 - * - * 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_NUTTX_USB_CDC_H -#define __INCLUDE_NUTTX_USB_CDC_H - -/******************************************************************************************** - * Included Files - ********************************************************************************************/ - -#include - -/******************************************************************************************** - * Pre-processor Definitions - ********************************************************************************************/ -/* Device Class Codes ***********************************************************************/ -/* Table 14: Communication Device Class Code (see definition USB_CLASS_CDC in usb.h) */ -/* Table 18: Data Interface Class Code (see definition USB_CLASS_CDC_DATA in usb.h) */ - -/* Communication Inteface Class Codes *******************************************************/ -/* Table 15: Communication Interface Class Code */ - -#define CDC_CLASS_COMM 0x02 /* Communication Interface Class */ - -/* Communication Interface Sub-Class Codes **************************************************/ - -#define CDC_SUBCLASS_NONE 0x00 /* Reserved */ -#define CDC_SUBCLASS_DLC 0x01 /* Direct Line Control Model */ -#define CDC_SUBCLASS_ACM 0x02 /* Abstract Control Model */ -#define CDC_SUBCLASS_TCM 0x03 /* Telephone Control Model */ -#define CDC_SUBCLASS_MCM 0x04 /* Multi-Channel Control Model */ -#define CDC_SUBCLASS_CAPI 0x05 /* CAPI Control Model */ -#define CDC_SUBCLASS_ECM 0x06 /* Ethernet Networking Control Model */ -#define CDC_SUBCLASS_ATM 0x07 /* ATM Networking Control Model */ - /* 0x08-0x7f Reserved (future use) */ - /* 0x80-0xfe Reserved (vendor specific) */ -/* Communication Interface Class Protocol Codes ********************************************/ -/* Table 17: Communication Interface Class Control Protocol Codes */ - -#define CDC_PROTO_NONE 0x00 /* No class specific protocol required */ -#define CDC_PROTO_ATM 0x01 /* Common AT commands (also known as Hayes compatible”) */ - /* 0x02-0xfe Reserved (future use) */ -#define CDC_PROTO_VENDOR 0xff /* Vendor-specific */ - -/* Data Interface Sub-Class Codes ***********************************************************/ -/* None defined, should be zero */ - -#define CDC_DATA_SUBCLASS_NONE 0x00 - -/* Date Interface Class Protocol Codes ******************************************************/ -/* Table 19: Data Interface Class Protocol Codes */ - -#define CDC_DATA_PROTO_NONE 0x00 /* No class specific protocol required */ - /* 0x01-0x2f Reserved (future use) */ -#define CDC_DATA_PROTO_ISDN 0x30 /* Physical interface protocol for ISDN BRI */ -#define CDC_DATA_PROTO_HDLC 0x31 /* HDLC */ -#define CDC_DATA_PROTO_TRANSP 0x32 /* Transparent */ - /* 0x33-0x4f Reserved (future use) */ -#define CDC_DATA_PROTO_Q921M 0x50 /* Management protocol for Q.921 data link protocol */ -#define CDC_DATA_PROTO_Q921 0x51 /* Data link protocol for Q.931 */ -#define CDC_DATA_PROTO_Q921TM 0x52 /* TEI-multiplexor for Q.921 data link protocol */ - /* 0x53-0x8f Reserved (future use) */ -#define CDC_DATA_PROTO_V42BIS 0x90 /* Data compression procedures */ -#define CDC_DATA_PROTO_EUROISDN 0x91 /* Euro-ISDN protocol control */ -#define CDC_DATA_PROTO_V120 0x92 /* V.24 rate adaptation to ISDN */ -#define CDC_DATA_PROTO_CAPI 0x93 /* CAPI Commands */ - /* 0x94-0xfc Reserved (future use) */ -#define CDC_DATA_PROTO_HBD 0xfd /* Host based driver. */ -#define CDC_DATA_PROTO_PUFD 0xfe /* The protocol(s) are described using a Protocol Unit - * Functional Descriptors on Communication Class - * Interface. - */ -#define CDC_DATA_PROTO_VENDOR 0xff /* Vendor-specific */ - -/* Requests and Notifications ***************************************************************/ -/* Table 2: Requests, Direct Line Control Model */ - -#define DLC_SET_AUX_LINE_STATE 0x10 /* Request to connect or disconnect secondary jack from - * POTS circuit or CODEC, depending on hook state. - * (Optional). - */ -#define DLC_SET_HOOK_STATE 0x11 /* Select relay setting for on-hook, off-hook, and caller - * ID. (Required) - */ -#define DLC_PULSE_SETUP 0x12 /* Initiate pulse dialing preparation. (Optional). - */ -#define DLC_SEND_PULSE 0x13 /* Request number of make/break cycles to generate. - * (Optional) - */ -#define DLC_SET_PULSE_TIME 0x14 /* Setup value for time of make and break periods when - * pulse dialing. (Optional) - */ -#define DLC_RING_AUX_JACK 0x15 /* Request for a ring signal to be generated on secondary - * phone jack. (Optional) - */ -/* Table 3: Notifications, Direct Line Control Model */ - -#define DLC_AUX_JACK_HOOK_STATE 0x08 /* Indicates hook state of secondary device plugged - * into the auxiliary phone jack. (Optional) - */ -#define DLC_RING_DETECT 0x09 /* Message to notify host that ring voltage was - * detected on POTS interface. (Required) - */ -/* Table 4: Requests, Abstract Control Model */ - -#define ACM_SEND_COMMAND 0x00 /* Issues a command in the format of the supported - * control protocol. (Required) - */ -#define ACM_GET_RESPONSE 0x01 /* Requests a response in the format of the - * supported control protocol. (Required) - */ -#define ACM_SET_COMM_FEATURE 0x02 /* Controls the settings for a particular - * communication feature. (Optional) - */ -#define ACM_GET_COMM_FEATURE 0x03 /* Returns the current settings for the - * communication feature. (Optional) - */ -#define ACM_CLEAR_COMM_FEATURE 0x04 /* Clears the settings for a particular - * communication feature. (Optional) - */ -#define ACM_SET_LINE_CODING 0x20 /* Configures DTE rate, stop-bits, parity, and - * number-of-character bits. (Optional) - */ -#define ACM_GET_LINE_CODING 0x21 /* Requests current DTE rate, stop-bits, parity, and - * number-of-character bits. (Optional) - */ -#define ACM_SET_CTRL_LINE_STATE 0x22 /* RS-232 signal used to tell the DCE device the - * DTE device is now present. (Optional) - */ -#define ACM_SEND_BREAK 0x23 /* Sends special carrier - */ -/* Table 5: Notifications, Abstract Control Model */ - -#define ACM_NETWORK_CONNECTION 0x00 /* Notification to host of network connection status. - * (Optional) - */ -#define ACM_RESPONSE_AVAILABLE 0x01 /* Notification to host to issue a GET_ENCAPSULATED_RESPONSE - * request. (Required) - */ -#define ACM_SERIAL_STATE 0x20 /* Returns the current state of the carrier detect, DSR, - * break, and ring signal. (Optional) - */ -/* Table 6: Requests, Telephone Control Model */ - -#define TCM_SET_COMM_FEATURE 0x02 /* Used to set a unique communication feature, which is - * normally specific to a particular device. - * (Optional) - */ -#define TCM_GET_COMM_FEATURE 0x03 /* Returns the current settings for the communication - * feature. (Optional) - */ -#define TCM_CLEAR_COMM_FEATURE 0x04 /* Clears the settings for a particular communication - * feature. (Optional) - */ -#define TCM_SET_RINGER_PARMS 0x30 /* Configures the ringer for a telephone device. - * (Optional) - */ -#define TCM_GET_RINGER_PARMS 0x31 /* Gets the current ringer configuration for a telephone - * device. (Required) - */ -#define TCM_SET_OPERATION_PARMS 0x32 /* Configures the operational mode of the telephone. - * (Optional) - */ -#define TCM_GET_OPERATION_PARMS 0x33 /* Gets the current operational mode of the telephone. - * (Optional) - */ -#define TCM_SET_LINE_PARMS 0x34 /* Allows changing the current state of the line - * associated with the interface, providing basic call - * capabilities, such as dialing and answering calls. - * (Required) - */ -#define TCM_GET_LINE_PARMS 0x35 /* Gets current status of the line. (Required) - */ -#define TCM_DIAL_DIGITS 0x36 /* Dials digits on the network connection. (Required) - */ -/* Table 7: Notifications, Telephone Control Model */ - -#define TCM_CALL_STATE_CHANGE 0x28 /* DReports a state change on a call. (Required) - */ -#define TCM_LINE_STATE_CHANGE 0x29 /* DReports a state change on a line. (Optional) - */ -/* Table 8: Requests, Multi-Channel Model */ - -#define MCM_SET_UNIT_PARAM 0x37 /* Used to set a Unit specific parameter (Optional) - */ -#define MCM_GET_UNIT_PARAM 0x38 /* Used to retrieve a Unit specific parameter (Required) - */ -#define MCM_CLEAR_UNIT_PARAM 0x39 /* Used to set a Unit specific parameter to its default - * state. (Optional) - */ -/* Table 9: Request, CAPI Control Model */ - -#define CAPI_GET_PROFILE 0x3a /* Returns the implemented capabilities of the device - * (Required) - */ -/* Table 10: Requests, Ethernet Networking Control Model */ - -#define ECM_SEND_COMMAND 0x00 /* Issues a command in the format of the supported - * control protocol. The intent of this mechanism is - * to support networking devices (e.g., host-based - * cable modems) that require an additional vendor- - * defined interface for media specific hardware - * configuration and management. (Optional) - */ -#define ECM_GET_RESPONSE 0x01 /* equests a response in the format of the supported - * control protocol. - * (Optional) - */ -#define ECM_SET_MCAST_FILTERS 0x40 /* As applications are loaded and unloaded on the host, - * the networking transport will instruct the device’s MAC - * driver to change settings of the Networking device’s - * multicast filters. (Optional) - */ -#define ECM_SET_PM_PAT_FILTER 0x41 /* Some hosts are able to conserve energy and stay quiet - * in a “sleeping” state while not being used. USB - * Networking devices may provide special pattern filtering - * hardware that enables it to wake up the attached host - * on demand when something is attempting to contact the - * host (e.g., an incoming web browser connection). - * Primitives are needed in management plane to negotiate - * the setting of these special filters - * (Optional) - */ -#define ECM_GET_PM_PAT_FILTER 0x42 /* Retrieves the status of the above power management - * pattern filter setting - * (Optional) - */ -#define ECM_SET_PACKET_FILTER 0x43 /* Sets device filter for running a network analyzer - * application on the host machine (Required) - */ -#define ECM_GET_STATISTIC 0x44 /* Retrieves Ethernet device statistics such as frames - * transmitted, frames received, and bad frames received. - * (Optional) - */ -/* Table 11: Notifications, Ethernet Networking Control Model */ - -#define ECM_NETWORK_CONNECTION 0x00 /* Reports whether or not the physical layer (modem, - * Ethernet PHY, etc.) link is up. (Required) - */ -#define ECM_RESPONSE_AVAILABLE 0x01 /* Notification to host to issue a - * GET_ENCAPSULATED_RESPONSE request. (Optional) - */ -#define ECM_SPEED_CHANGE 0x2a /* Reports a change in upstream or downstream (Required) - */ -/* Table 12: Requests, ATM Networking Control Model */ - -#define ATM_SEND_COMMAND 0x00 /* Issues a command in the format of the supported control - * protocol. The intent of this mechanism is to support - * networking devices (e.g., host-based cable modems) - * that require an additional vendor-defined interface for - * media specific hardware configuration and - * management. (Optional) - */ -#define ATM_GET_RESPONSE 0x01 /* Requests a response in the format of the supported - * control protocol. (Optional) - */ -#define ATM_SET_DATA_FORMAT 0x50 /* Chooses which ATM data format will be exchanged - * between the host and the ATM Networking device. - * (Required) - */ -#define ATM_GET_DEV_STATISTICS 0x51 /* Retrieves global statistics from the ATM Networking - * device. (Required) - */ -#define ATM_SET_DEFAULT_VC 0x52 /* Pre-selects the VPI/VCI value for subsequent - * GetATMVCStatistics requests (Optional) - */ -#define ATM_GET_VC_STATISTICS 0x53 /* Retrieves statistics from the ATM Networking device for - * a particular VPI/VCI. (Optional) - */ -/* Table 13: Requests, Ethernet and ATM Networking Control Model */ - -#define ATM_NETWORK_CONNECTION 0x00 /* Reports whether or not the physical layer (modem, - * Ethernet PHY, etc.) link is up. (Required) - */ -#define ECM_NETWORK_CONNECTION ATM_NETWORK_CONNECTION -#define ATM_RESPONSE_AVAILABLE 0x01 /* Notification to host to issue a - * GET_ENCAPSULATED_RESPONSE request. (Optional) - */ -#define ECM_RESPONSE_AVAILABLE ATM_RESPONSE_AVAILABLE -#define ATM_SPEED_CHANGE 0x2a /* Reports a change in upstream or downstream speed of the - * networking device connection. (Required) - */ -#define ECM_SPEED_CHANGE ATM_SPEED_CHANGE - -/* Descriptors ******************************************************************************/ -/* Table 25: bDescriptor SubType in Functional Descriptors */ - -#define CDC_DSUBTYPE_HDR 0x00 /* Header Functional Descriptor, which marks the - * beginning of the concatenated set of functional - * descriptors for the interface. */ -#define CDC_DSUBTYPE_CALLMGMT 0x01 /* Call Management Functional Descriptor */ -#define CDC_DSUBTYPE_ACM 0x02 /* Abstract Control Management Functional Descriptor */ -#define CDC_DSUBTYPE_DLC 0x03 /* Direct Line Management Functional Descriptor */ -#define CDC_DSUBTYPE_TCMRINGER 0x04 /* Telephone Ringer Functional Descriptor */ -#define CDC_DSUBTYPE_TCMCALL 0x05 /* Telephone Call and Line State Reporting Capabilities - * Functional Descriptor. */ -#define CDC_DSUBTYPE_UNION 0x06 /* Union Functional descriptor */ -#define CDC_DSUBTYPE_COUNTRY 0x07 /* Country Selection Functional Descriptor */ -#define CDC_DSUBTYPE_TCMOPS 0x08 /* Telephone Operational Modes Functional Descriptor */ -#define CDC_DSUBTYPE_USBTERM 0x09 /* USB Terminal Functional Descriptor */ -#define CDC_DSUBTYPE_NETCHAN 0x0a /* Network Channel Terminal Descriptor */ -#define CDC_DSUBTYPE_PROTOUNIT 0x0b /* Protocol Unit Functional Descriptor */ -#define CDC_DSUBTYPE_EXTUNIT 0x0c /* Extension Unit Functional Descriptor */ -#define CDC_DSUBTYPE_MCM 0x0d /* Multi-Channel Management Functional Descriptor */ -#define CDC_DSUBTYPE_CAPI 0x0e /* CAPI Control Management Functional Descriptor */ -#define CDC_DSUBTYPE_ECM 0x0f /* Ethernet Networking Functional Descriptor */ -#define CDC_DSUBTYPE_ATM 0x10 /* ATM Networking Functional Descriptor */ - /* 0x11-0xff Reserved (future use) */ - -/* Table 42: Ethernet Statistics Capabilities */ - -#define ECMCAP_XMIT_OK (1 << 0) /* Frames transmitted without errors */ -#define ECMCAP_RVC_OK (1 << 1) /* Frames received without errors */ -#define ECMCAP_XMIT_ERROR (1 << 2) /* Frames not transmitted, or transmitted with errors */ -#define ECMCAP_RCV_ERROR (1 << 3) /* Frames received with errors that are not delivered - * to the USB host - */ -#define ECMCAP_RCV_NO_BUFFER (1 << 4) /* Frame missed, no buffers */ -#define ECMCAP_DIR_BYTES_XMIT (1 << 5) /* Directed bytes transmitted without errors */ -#define ECMCAP_DIR_FRAMES_XMIT (1 << 6) /* Directed frames transmitted without errors */ -#define ECMCAP_MCAST_BYTES_XMIT (1 << 7) /* Multicast bytes transmitted without errors */ -#define ECMCAP_MCAST_FRAMES_XMIT (1 << 8) /* Multicast frames transmitted without errors */ -#define ECMCAP_BCAST_BYTES_XMIT (1 << 9) /* Broadcast bytes transmitted without errors */ -#define ECMCAP_BCAST_FRAMES_XMIT (1 << 10) /* Broadcast frames transmitted without errors */ -#define ECMCAP_DIR_BYTES_RCV (1 << 11) /* Directed bytes received without errors */ -#define ECMCAP_DIR_FRAMES_RCV (1 << 12) /* Directed frames received without errors */ -#define ECMCAP_MCAST_BYTES_RCV (1 << 13) /* Multicast bytes received without errors */ -#define ECMCAP_MCAST_FRAMES_RCV (1 << 14) /* Multicast frames received without errors */ -#define ECMCAP_BCAST_BYTES_RCV (1 << 15) /* Broadcast bytes received without errors */ -#define ECMCAP_BCAST_FRAMES_RCV (1 << 16) /* Broadcast frames received without errors */ -#define ECMCAP_RCV_CRC_ERROR (1 << 17) /* Frames received with circular redundancy check - * (CRC) or frame check sequence (FCS) error - */ -#define ECMCAP_TRANSMIT_QUEUE_LENG (1 << 18) /* Length of transmit queue */ -#define ECMCAP_RCV_ERROR_ALIGNMENT (1 << 19) /* Frames received with alignment error */ -#define ECMCAP_XMIT_ONE_COLL (1 << 20) /* Frames transmitted with one collision */ -#define ECMCAP_XMIT_MORE_COLLS (1 << 21) /* Frames transmitted with more than one collision */ -#define ECMCAP_XMIT_DEFERRED (1 << 22) /* Frames transmitted after deferral */ -#define ECMCAP_XMIT_MAX_COLLS (1 << 23) /* Frames not transmitted due to collisions */ -#define ECMCAP_RCV_OVERRUN (1 << 24) /* Frames not received due to overrun */ -#define ECMCAP_XMIT_UNDERRUN (1 << 25) /* Frames not transmitted due to underrun */ -#define ECMCAP_XMIT_HB_FAILURE (1 << 26) /* Frames transmitted with heartbeat failure */ -#define ECMCAP_XMIT_TIMES_CRS_LOST (1 << 27) /* Times carrier sense signal lost during - * transmission - */ -#define ECMCAP_XMIT_LATE_COLLS (1 << 28) /* Late collisions detected */ - /* Bits 29-31 Resrved, Must be set to zero */ - -/* Table 47: Communication Feature Selector Codes */ - -#define FEATURE_ABSTRACT_STATE 0x01 /* Two bytes of data describing multiplexed state - * and idle state for this Abstract Model - * communications device - */ -#define FEATURE_COUNTRY_SETTING 0x02 /* Country code in hexadecimal format as defined in - * ISO 3166 - */ -/* Table 49: POTS Relay Configuration Values */ - -#define POTS_ON_HOOK 0x0000 -#define POTS_OFF_HOOK 0x0001 -#define POTS_SNOOPING 0x0002 - -/* Table 50: Line Coding Structure */ - -#define CDC_CHFMT_STOP1 0 /* One stop bit */ -#define CDC_CHFMT_STOP1p5 1 /* 1.5 stop bits */ -#define CDC_CHFMT_STOP2 2 /* 2 stop bits */ - -#define CDC_PARITY_NONE 0 /* No parity */ -#define CDC_PARITY_ODD 1 /* Odd parity */ -#define CDC_PARITY_EVEN 2 /* Even parity */ -#define CDC_PARITY_MARK 3 /* Mark parity */ -#define CDC_PARITY_SPACE 4 /* Space parity */ - -/* Table 51: Control Signal Bitmap Values for SetControlLineState */ - -#define CDC_DTE_PRESENT (1 << 0) /* Indicates to DCE if DTE is present or not. - * This signal corresponds to V.24 signal - * 108/2 and RS-232 signal DTR. - */ -#define CDC_ACTIVATE_CARRIER (1 << 1) /* Carrier control for half duplex modems. - * This signal corresponds to V.24 signal - * 105 and RS-232 signal RTS. - */ - -/* Table 58: Call State Value Definitions */ - -#define CDC_CALLST_IDLE 0x00 /* Call is idle */ -#define CDC_CALLST_DIAL 0x01 /* Typical dial tone */ -#define CDC_CALLST_INTDIAL 0x02 /* Interrupted dial tone */ -#define CDC_CALLST_DIALING 0x03 /* Dialing is in progress */ -#define CDC_CALLST_RINGBACK 0x04 /* Ringback */ -#define CDC_CALLST_CONNECTED 0x05 /* Connected */ -#define CDC_CALLSTINCOMING 0x06 /* Incoming call */ - -/* Table 62: Ethernet Packet Filter Bitmap */ - -#define PACKET_TYPE_PROMISCUOUS (1 << 0) -#define PACKET_TYPE_ALL_MULTICAST (1 << 1) -#define PACKET_TYPE_DIRECTED (1 << 2) -#define PACKET_TYPE_BROADCAST (1 << 3) -#define PACKET_TYPE_MULTICAST (1 << 4) - -/* Table 63: Ethernet Statistics Feature Selector Codes */ - -#define ECM_XMIT_OK 0x01 /* Frames transmitted without errors */ -#define ECM_RVC_OK 0x02 /* Frames received without errors */ -#define ECM_XMIT_ERROR 0x03 /* Frames not transmitted, or transmitted with errors */ -#define ECM_RCV_ERROR 0x04 /* Frames received with errors that are not delivered - * to the USB host - */ -#define ECM_RCV_NO_BUFFER 0x05 /* Frame missed, no buffers */ -#define ECM_DIR_BYTES_XMIT 0x06 /* Directed bytes transmitted without errors */ -#define ECM_DIR_FRAMES_XMIT 0x07 /* Directed frames transmitted without errors */ -#define ECM_MCAST_BYTES_XMIT 0x08 /* Multicast bytes transmitted without errors */ -#define ECM_MCAST_FRAMES_XMIT 0x09 /* Multicast frames transmitted without errors */ -#define ECM_BCAST_BYTES_XMIT 0x0a /* Broadcast bytes transmitted without errors */ -#define ECM_BCAST_FRAMES_XMIT 0x0b /* Broadcast frames transmitted without errors */ -#define ECM_DIR_BYTES_RCV 0x0c /* Directed bytes received without errors */ -#define ECM_DIR_FRAMES_RCV 0x0d /* Directed frames received without errors */ -#define ECM_MCAST_BYTES_RCV 0x0e /* Multicast bytes received without errors */ -#define ECM_MCAST_FRAMES_RCV 0x0f /* Multicast frames received without errors */ -#define ECM_BCAST_BYTES_RCV 0x10 /* Broadcast bytes received without errors */ -#define ECM_BCAST_FRAMES_RCV 0x11 /* Broadcast frames received without errors */ -#define ECM_RCV_CRC_ERROR 0x12 /* Frames received with circular redundancy check - * (CRC) or frame check sequence (FCS) error - */ -#define ECM_TRANSMIT_QUEUE_LENG 0x13 /* Length of transmit queue */ -#define ECM_RCV_ERROR_ALIGNMENT 0x14 /* Frames received with alignment error */ -#define ECM_XMIT_ONE_COLL 0x15 /* Frames transmitted with one collision */ -#define ECM_XMIT_MORE_COLLS 0x16 /* Frames transmitted with more than one collision */ -#define ECM_XMIT_DEFERRED 0x17 /* Frames transmitted after deferral */ -#define ECM_XMIT_MAX_COLLS 0x18 /* Frames not transmitted due to collisions */ -#define ECM_RCV_OVERRUN 0x19 /* Frames not received due to overrun */ -#define ECM_XMIT_UNDERRUN 0x1a /* Frames not transmitted due to underrun */ -#define ECM_XMIT_HB_FAILURE 0x1b /* Frames transmitted with heartbeat failure */ -#define ECM_XMIT_TIMES_CRS_LOST 0x1c /* Times carrier sense signal lost during - * transmission - */ -#define ECM_XMIT_LATE_COLLS 0x1d /* Late collisions detected */ - -/* Table 64: ATM Data Format */ - -#define ATM_FMT_TYPE1 1 /* Type 1 format: concatenated ATM cells */ -#define ATM_FMT_TYPE1 2 /* Type 2 format: ATM header template + concatenated ATM - * cell payloads - */ -#define ATM_FMT_TYPE1 3 /* Type 3 format: AAL 5 SDU */ - -/* Table 65: ATM Device Statistics Feature Selector Codes */ - -#define US_CELLS_SENT 0x01h /* The number of cells that have been sent - * upstream to the WAN link by the ATM layer. - */ -#define DS_CELLS_RECEIVED 0x02h /* The number of cells that have been received - * downstream from the WAN link by the ATM - * layer. - */ -#define DS_CELLS_USB_CONGESTION 0x03h /* The number of cells that have been received - * downstream from the WAN link by the ATM - * layer and discarded due to congestion on the - * USB link. - */ -#define DS_CELLS_AAL5_CRC_ERROR 0x04h /* The number of cells that have been received - * downstream from the WAN link by the ATM - * layer and discarded due to AAL5 CRC errors. - */ -#define DS_CELLS_HEC_ERROR 0x05h /* The number of cells that have been received - * downstream from the WAN link and discarded - * due to HEC errors in the cell header. - */ -#define DS_CELLS_HEC_ERROR_CORRECTED 0x06h /* The number of cells that have been received - * downstream from the WAN link and have - * been detected with HEC errors in the cell - * header and successfully corrected. - */ -/* Table 66: ATM VC Selector Codes */ - -#define VC_US_CELLS_SENT 0x01 /* The number of cells that have been sent upstream to - * the WAN link for the specified VPI/VCI since the - * device has been powered on or reset - */ -#define VC_DS_CELLS_RECEIVED 0x02 /* The number of cells that have been received - * downstream from the WAN link for the specified - * VPI/VCI since the device has been - * powered on or reset - */ -/* Notifications ****************************************************************************/ -/* Table 69: UART State Bitmap Values */ - -#define CDC_UART_RXCARRIER (1 << 0) /* bRxCarrier State of receiver carrier detection - * mechanism of device. This signal corresponds to - * V.24 signal 109 and RS-232 signal DCD. - */ -#define CDC_UART_TXCARRIER (1 << 1) /* bTxCarrier State of transmission carrier. This - * signal corresponds to V.24 signal 106 and RS-232 - * signal DSR. - */ -#define CDC_UART_BREAK (1 << 2) /* bBreak State of break detection mechanism of the - * device. - */ -#define CDC_UART_RING (1 << 3) /* bRingSignal State of ring signal detection of the - * device. - */ -#define CDC_UART_FRAMING (1 << 4) /* bFraming A framing error has occurred */ -#define CDC_UART_PARITY (1 << 5) /* bParity A parity error has occurred */ -#define CDC_UART_OVERRUN (1 << 6) /* bOverRun Received data has been discarded due to - * overrun in the device. - */ -/* Table 70: Call State Change Value Definitions */ - -#define CDC_CALLST_IDLE 0x01 /* Call has become idle */ -#define CDC_CALLST_DIALING 0x02 /* Dialing */ -#define CDC_CALLST_RINGBACK 0x03 /* Ringback, with an extra byte of data provided to - * describe the type of ringback signaling - */ -#define CDC_CALLST_CONNECTED 0x04 /* Connected, with an extra byte of data provided to - * describe the type of connection - */ -#define CDC_CALLST_INCOMING 0x05 /* Incoming Call, with the extra bytes of data */ - -/* Table 71: Line State Change Values */ - -#define CDC_LINEST_IDLE 0x0000 /* Line has become idle */ -#define CDC_LINEST_HOLD 0x0001 /* Line connected to hold position */ -#define CDC_LINEST_OFFHOOK 0x0002 /* Hook-switch has gone off hook */ -#define CDC_LINEST_ONHOOK 0x0003 /* Hook-switch has gone on hook */ - -/******************************************************************************************** - * Public Types - ********************************************************************************************/ - -/* Table 1: Data Class Protocol Wrapper */ - -struct cdc_protowrapper_s -{ - uint8_t size[2]; /* Size of wrapper in bytes */ - uint8_t dstproto; /* bDstProtocol, Destination protocol ID */ - uint8_t srcproto; /* bSrcProtocol, Source protocol ID */ - uint8_t data[1]; /* Data payload, actual size depends of size of the wrapper */ -}; - -/* Functional Descriptors *******************************************************************/ -/* Table 23: Functional Descriptor General Format */ - -struct cdc_funcdesc_s -{ - uint8_t size; /* bFunctionLength, Size of this descriptor */ - uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */ - uint8_t data[1]; /* Function-specific data follows */ -}; - -/* Table 26: Class-Specific Descriptor Header Format */ - -struct cdc_hdr_funcdesc_s -{ - uint8_t size; /* bFunctionLength, Size of this descriptor */ - uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */ - uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_HDR as defined in Table 25 */ - uint8_t cdc[2]; /* bcdCDC, USB Class Definitions for Communication Devices Specification release - * number in binary-coded decimal. - */ -}; -#define SIZEOF_HDR_FUNCDESC 5 - -/* Table 27: Call Management Functional Descriptor */ - -struct cdc_callmgmt_funcdesc_s -{ - uint8_t size; /* bFunctionLength, Size of this descriptor */ - uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */ - uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_CALLMGMT as defined in Table 25 */ - uint8_t caps; /* bmCapabilities: Bit encoded */ - uint8_t ifno; /* bDataInterface, Interface number of Data Class interface - * optionally used for call management - */ -}; -#define SIZEOF_CALLMGMT_FUNCDESC 5 - -/* Table 28: Abstract Control Management Functional Descriptor */ - -struct cdc_acm_funcdesc_s -{ - uint8_t size; /* bFunctionLength, Size of this descriptor */ - uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */ - uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_ACM as defined in Table 25 */ - uint8_t caps; /* bmCapabilities: Bit encoded */ -}; -#define SIZEOF_ACM_FUNCDESC 4 - -/* Table 29: Direct Line Management Functional Descriptor */ - -struct cdc_dlc_funcdesc_s -{ - uint8_t size; /* bFunctionLength, Size of this descriptor */ - uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */ - uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_DLC as defined in Table 25 */ - uint8_t caps; /* bmCapabilities: Bit encoded */ -}; -#define SIZEOF_DLC_FUNCDESC 4 - -/* Table 30: Telephone Ringer Functional Descriptor */ - -struct cdc_tcmr_funcdesc_s -{ - uint8_t size; /* bFunctionLength, Size of this descriptor */ - uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */ - uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_TCMRINGER as defined in Table 25 */ - uint8_t volsteps; /* bRingerVolSteps, Number of discrete steps in volume supported - * by the ringer. - */ - uint8_t npats; /* bNumRingerPatterns: Number of ringer patterns supported. */ -}; -#define SIZEOF_TCMR_FUNCDESC 5 - -/* Table 31: Telephone Operational Modes Functional Descriptor */ - -struct cdc_tcmops_funcdesc_s -{ - uint8_t size; /* bFunctionLength, Size of this descriptor */ - uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */ - uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_TCMOPS as defined in Table 25 */ - uint8_t caps; /* bmCapabilities: Bit encoded */ -}; -#define SIZEOF_TCMOPS_FUNCDESC 4 - -/* Table 32: Telephone Call State Reporting Capabilities Descriptor */ - -struct cdc_tcmc_funcdesc_s -{ - uint8_t size; /* bFunctionLength, Size of this descriptor */ - uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */ - uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_TCMCALL as defined in Table 25 */ - uint8_t caps; /* bmCapabilities: Bit encoded */ -}; -#define SIZEOF_TCMC_FUNCDESC 4 - -/* Table 33: Union Interface Functional Descriptor */ - -struct cdc_union_funcdesc_s -{ - uint8_t size; /* bFunctionLength, Size of this descriptor */ - uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */ - uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_UNION as defined in Table 25 */ - uint8_t master; /* bMasterInterface: The interface number of the Communication or Data - * Class interface, designated as the master or controlling interface - * for the union - */ - uint8_t slave[1]; /* bSlaveInterfaceN: Interface number of N slave or associated - * interface in the union - */ -}; -#define SIZEOF_UNION_FUNCDESC(n) ((n)+4) - -/* Table 34: Country Selection Functional Descriptor */ - -struct cdc_country_funcdesc_s -{ - uint8_t size; /* bFunctionLength, Size of this descriptor */ - uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */ - uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_COUNTRY as defined in Table 25 */ - uint8_t reldate; /* iCountryCodeRelDate: Index of a string giving the release date for the - * implemented ISO 3166 Country Codes - */ - uint16_t code[1]; /* wCountryCodeN: Country code in hexadecimal format as defined in ISO 3166, - * release date as specified in offset 3 for Nth country supported - */ -}; -#define SIZEOF_COUNTRY_FUNCDESC(n) (sizeof(uint16_t)*(n) + 4) - -/* Table 35: USB Terminal Functional Descriptor */ - -struct cdc_usbterm_funcdesc_s -{ - uint8_t size; /* bFunctionLength, Size of this descriptor */ - uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */ - uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_USBTERM as defined in Table 25 */ - uint8_t id; /* bEntityId, Constant uniquely identifying the Terminal */ - uint8_t ifno; /* bInInterfaceNo, The input interface number of the associated - * USB interface - */ - uint8_t outif; /* bOutInterfaceNo, The output interface number of the associated - * USB interface - */ - uint8_t options; /* bmOptions, bit-encoded options */ - uint8_t child[1]; /* Nth ID of lower Terminal or Unit to which this Terminal is connected. */ -}; -#define SIZEOF_USBTERM_FUNCDESC(n) ((n)+7) - -/* Table 36: Network Channel Terminal Functional Descriptor */ - -struct cdc_netchan_funcdesc_s -{ - uint8_t size; /* bFunctionLength, Size of this descriptor */ - uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */ - uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_NETCHAN as defined in Table 25 */ - uint8_t id; /* bEntityId, Constant uniquely identifying the Terminal */ - uint8_t name; /* iName, Index of string descriptor, describing the name of the Network - * Channel Terminal - */ - uint8_t index; /* bChannelIndex, The channel index of the associated network channel */ - uint8_t phyif; /* bPhysicalInterface, Type of physical interface */ -}; -#define SIZEOF_NETCHAN_FUNCDESC 7 - -/* Table 37: Protocol Unit Functional Descriptor */ - -struct cdc_protounit_funcdesc_s -{ - uint8_t size; /* bFunctionLength, Size of this descriptor */ - uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */ - uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_PROTOUNIT as defined in Table 25 */ - uint8_t id; /* bEntityId, Constant uniquely identifying the Unit */ - uint8_t proto; /* bProtocol, Protocol code as defined in Table 19 */ - uint8_t child[1]; /* Nth ID of lower Terminal or Unit to which this Terminal is connected */ -}; -#define SIZEOF_PROTOUNIT_FUNCDESC(n) ((n)+5) - -/* Table 38: Extension Unit Functional Descriptor */ - -struct cdc_extunit_funcdesc_s -{ - uint8_t size; /* bFunctionLength, Size of this descriptor */ - uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */ - uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_EXTUNIT as defined in Table 25 */ - uint8_t id; /* bEntityId, Constant uniquely identifying the Extension Unit */ - uint8_t code; /* bExtensionCode, Vendor specific code identifying the Extension Unit */ - uint8_t name; /* iName, Index of string descriptor, describing the name of the Extension Unit */ - uint8_t child[1]; /* Nth ID of lower Terminal or Unit to which this Terminal is connected */ -}; -#define SIZEOF_EXTUNIT_FUNCDESC(n) ((n)+6) - -/* Table 39: Multi-Channel Management Functional Descriptor */ - -struct cdc_mcm_funcdesc_s -{ - uint8_t size; /* bFunctionLength, Size of this descriptor */ - uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */ - uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_MCM as defined in Table 25 */ - uint8_t caps; /* bmCapabilities: Bit encoded */ -}; -#define SIZEOF_MCM_FUNCDESC 4 - -/* Table 40: CAPI Control Management Functional Descriptor */ - -struct cdc_capi_funcdesc_s -{ - uint8_t size; /* bFunctionLength, Size of this descriptor */ - uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */ - uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_CAPI as defined in Table 25 */ - uint8_t caps; /* bmCapabilities: Bit encoded */ -}; -#define SIZEOF_CAPI_FUNCDESC 4 - -/* Table 41: Ethernet Networking Functional Descriptor*/ - -struct cdc_ecm_funcdesc_s -{ - uint8_t size; /* bFunctionLength, Size of this descriptor */ - uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */ - uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_ECM as defined in Table 25 */ - uint8_t mac; /* iMACAddress, Index of teh 48bit Ethernet MAC address string descriptor */ - uint8_t stats[4]; /* bmEthernetStatistics, Indicates which Ethernet statistics functions - * the device collects. See Table 42. - */ - uint8_t maxseg[2]; /* wMaxSegmentSize, The maximum segment size that the Ethernet device is - * capable of supporting. - */ - uint8_t nmcflts[2]; /* wNumberMCFilters, Contains the number of multicast filters that can be - * configured by the host. - */ - uint8_t npwrflts; /* bNumberPowerFilters, Contains the number of pattern filters that are - * available for causing wake-up of the host. - */ -}; -#define SIZEOF_ECM_FUNCDESC 13 - -/* Table 43: ATM Networking Functional Descriptor */ - -struct cdc_atm_funcdesc_s -{ - uint8_t size; /* bFunctionLength, Size of this descriptor */ - uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */ - uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_ATM as defined in Table 25 */ - uint8_t endid; /* iEndSystemIdentifier, Index of End System Identifier string descriptor */ - uint8_t datacaps; /* bmDataCapabilities, The ATM data types the device supports */ - uint8_t devstats; /* bmATMDeviceStatistics, Indicates which optional statistics functions the - * device collects. - */ - uint8_t mxseg2[2]; /* wType2MaxSegmentSize, The maximum segment size that the Type 2 device is - * capable of supporting. - */ - uint8_t mxseg3[2]; /* wType3MaxSegmentSize, The maximum segment size that the Type 3 device is - * capable of supporting - */ - uint8_t mxvc[2]; /* wMaxVC, The maximum number of simultaneous virtual circuits the device is - * capable of supporting - */ -}; -#define SIZEOF_CALLMGMT_FUNCDESC 12 - -/* Descriptor Data Structures ***************************************************************/ -/* Table 50: Line Coding Structure */ - -struct cdc_linecoding_s -{ - uint8_t baud[4]; /* dwDTERate, Data terminal rate, in bits per second */ - uint8_t stop; /* bCharFormat 0=1, 1=1.5, 2=2 stop bits */ - uint8_t parity; /* bParityType, 0=None, 1=Odd, 2=Even, 3=Mark, 4=Space */ - uint8_t nbits; /* bDataBits, Data bits (5,6,7,8, or 16) */ -}; -#define SIZEOF_CDC_LINECODING 7 - -/* Table 55: Line Status Information Structure */ - -struct cdc_linestatus_s -{ - uint8_t size[2]; /* wLength, Size of this structure, in bytes */ - uint8_t ringer[4]; /* dwRingerBitmap, Ringer Configuration bitmap for this line */ - uint8_t line[4]; /* dwLineState, Defines current state of the line */ - uint32_t call[1]; /* dwCallStateN, Defines current state of call N on the line */ -}; - -/* Table 60: Unit Parameter Structure */ - -struct cdc_unitparm_s -{ - uint8_t id; /* bEntityId, Unit ID */ - uint8_t index; /* bParameterIndex, A zero based value indicating Unit parameter index */ -}; - -/* Table 61: Power Management Pattern Filter Structure */ - -/* Notification Data Structures *************************************************************/ -/* Table 72: ConnectionSpeedChange Data Structure */ - -struct cdc_speedchange_s -{ - uint8_t us[4]; /* Contains the upstream bit rate, in bits per second */ - uint8_t ds[4]; /* Contains the downstream bit rate, in bits per second */ -}; - -#endif /* __INCLUDE_NUTTX_USB_CDC_H */ diff --git a/nuttx/include/nuttx/usb/cdcacm.h b/nuttx/include/nuttx/usb/cdcacm.h deleted file mode 100644 index 49dc4ee12..000000000 --- a/nuttx/include/nuttx/usb/cdcacm.h +++ /dev/null @@ -1,417 +0,0 @@ -/**************************************************************************** - * include/nuttx/usb/cdcacm.h - * - * Copyright (C) 2011-2012 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_NUTTX_USB_CDCACM_H -#define __INCLUDE_NUTTX_USB_CDCACM_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include -#include - -/**************************************************************************** - * Preprocessor definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* CONFIG_CDCACM - * Enable compilation of the USB serial driver - * CONFIG_CDCACM_EP0MAXPACKET - * Endpoint 0 max packet size. Default 64. - * CONFIG_CDCACM_EPINTIN - * The logical 7-bit address of a hardware endpoint that supports - * interrupt IN operation. Default 1. - * CONFIG_CDCACM_EPINTIN_FSSIZE - * Max package size for the interrupt IN endpoint if full speed mode. - * Default 64. - * CONFIG_CDCACM_EPINTIN_HSSIZE - * Max package size for the interrupt IN endpoint if high speed mode. - * Default 64. - * CONFIG_CDCACM_EPBULKOUT - * The logical 7-bit address of a hardware endpoint that supports - * bulk OUT operation. Default: 3 - * CONFIG_CDCACM_EPBULKOUT_FSSIZE - * Max package size for the bulk OUT endpoint if full speed mode. - * Default 64. - * CONFIG_CDCACM_EPBULKOUT_HSSIZE - * Max package size for the bulk OUT endpoint if high speed mode. - * Default 512. - * CONFIG_CDCACM_EPBULKIN - * The logical 7-bit address of a hardware endpoint that supports - * bulk IN operation. Default: 2 - * CONFIG_CDCACM_EPBULKIN_FSSIZE - * Max package size for the bulk IN endpoint if full speed mode. - * Default 64. - * CONFIG_CDCACM_EPBULKIN_HSSIZE - * Max package size for the bulk IN endpoint if high speed mode. - * Default 512. - * CONFIG_CDCACM_NWRREQS and CONFIG_CDCACM_NRDREQS - * The number of write/read requests that can be in flight. - * CONFIG_CDCACM_NWRREQS includes write requests used for both the - * interrupt and bulk IN endpoints. Default 4. - * CONFIG_CDCACM_VENDORID and CONFIG_CDCACM_VENDORSTR - * The vendor ID code/string. Default 0x0525 and "NuttX" - * 0x0525 is the Netchip vendor and should not be used in any - * products. This default VID was selected for compatibility with - * the Linux CDC ACM default VID. - * CONFIG_CDCACM_PRODUCTID and CONFIG_CDCACM_PRODUCTSTR - * The product ID code/string. Default 0xa4a7 and "CDC/ACM Serial" - * 0xa4a7 was selected for compatibility with the Linux CDC ACM - * default PID. - * CONFIG_CDCACM_RXBUFSIZE and CONFIG_CDCACM_TXBUFSIZE - * Size of the serial receive/transmit buffers. Default 256. - */ - -/* EP0 max packet size */ - -#ifndef CONFIG_CDCACM_EP0MAXPACKET -# define CONFIG_CDCACM_EP0MAXPACKET 64 -#endif - -/* Endpoint number and size (in bytes) of the CDC serial device-to-host (IN) - * notification interrupt endpoint. - */ - -#ifndef CONFIG_CDCACM_EPINTIN -# define CONFIG_CDCACM_EPINTIN 1 -#endif - -#ifndef CONFIG_CDCACM_EPINTIN_FSSIZE -# define CONFIG_CDCACM_EPINTIN_FSSIZE 64 -#endif - -#ifndef CONFIG_CDCACM_EPINTIN_HSSIZE -# define CONFIG_CDCACM_EPINTIN_HSSIZE 64 -#endif - -/* Endpoint number and size (in bytes) of the CDC device-to-host (IN) data - * bulk endpoint. NOTE that difference sizes may be selected for full (FS) - * or high speed (HS) modes. - */ - -#ifndef CONFIG_CDCACM_EPBULKIN -# define CONFIG_CDCACM_EPBULKIN 2 -#endif - -#ifndef CONFIG_CDCACM_EPBULKIN_FSSIZE -# define CONFIG_CDCACM_EPBULKIN_FSSIZE 64 -#endif - -#ifndef CONFIG_CDCACM_EPBULKIN_HSSIZE -# define CONFIG_CDCACM_EPBULKIN_HSSIZE 512 -#endif - -/* Endpoint number and size (in bytes) of the CDC host-to-device (OUT) data - * bulk endpoint. NOTE that difference sizes may be selected for full (FS) - * or high speed (HS) modes. - */ - -#ifndef CONFIG_CDCACM_EPBULKOUT -# define CONFIG_CDCACM_EPBULKOUT 3 -#endif - -#ifndef CONFIG_CDCACM_EPBULKOUT_FSSIZE -# define CONFIG_CDCACM_EPBULKOUT_FSSIZE 64 -#endif - -#ifndef CONFIG_CDCACM_EPBULKOUT_HSSIZE -# define CONFIG_CDCACM_EPBULKOUT_HSSIZE 512 -#endif - -/* Number of requests in the write queue. This includes write requests used - * for both the interrupt and bulk IN endpoints. - */ - -#ifndef CONFIG_CDCACM_NWRREQS -# define CONFIG_CDCACM_NWRREQS 4 -#endif - -/* Number of requests in the read queue */ - -#ifndef CONFIG_CDCACM_NRDREQS -# define CONFIG_CDCACM_NRDREQS 4 -#endif - -/* TX/RX buffer sizes */ - -#ifndef CONFIG_CDCACM_RXBUFSIZE -# define CONFIG_CDCACM_RXBUFSIZE 256 -#endif - -#ifndef CONFIG_CDCACM_TXBUFSIZE -# define CONFIG_CDCACM_TXBUFSIZE 256 -#endif - -/* Vendor and product IDs and strings. The default is the Linux Netchip - * CDC ACM VID and PID. - */ - -#ifndef CONFIG_CDCACM_VENDORID -# define CONFIG_CDCACM_VENDORID 0x0525 -#endif - -#ifndef CONFIG_CDCACM_PRODUCTID -# define CONFIG_CDCACM_PRODUCTID 0xa4a7 -#endif - -#ifndef CONFIG_CDCACM_VENDORSTR -# define CONFIG_CDCACM_VENDORSTR "NuttX" -#endif - -#ifndef CONFIG_CDCACM_PRODUCTSTR -# define CONFIG_CDCACM_PRODUCTSTR "CDC ACM Serial" -#endif - -#undef CONFIG_CDCACM_SERIALSTR -#define CONFIG_CDCACM_SERIALSTR "0" - -#undef CONFIG_CDCACM_CONFIGSTR -#define CONFIG_CDCACM_CONFIGSTR "Bulk" - -/* USB Controller */ - -#ifndef CONFIG_USBDEV_SELFPOWERED -# define SELFPOWERED USB_CONFIG_ATTR_SELFPOWER -#else -# define SELFPOWERED (0) -#endif - -#ifndef CONFIG_USBDEV_REMOTEWAKEUP -# define REMOTEWAKEUP USB_CONFIG_ATTR_WAKEUP -#else -# define REMOTEWAKEUP (0) -#endif - -#ifndef CONFIG_USBDEV_MAXPOWER -# define CONFIG_USBDEV_MAXPOWER 100 -#endif - -/* IOCTL Commands ***********************************************************/ -/* The USB serial driver will support a subset of the TIOC IOCTL commands - * defined in include/nuttx/serial/tioctl.h. This subset includes: - * - * CAICO_REGISTERCB - * Register a callback for serial event notification. Argument: - * cdcacm_callback_t. See cdcacm_callback_t type definition below. - * NOTE: The callback will most likely invoked at the interrupt level. - * The called back function should, therefore, limit its operations to - * invoking some kind of IPC to handle the serial event in some normal - * task environment. - * CAIOC_GETLINECODING - * Get current line coding. Argument: struct cdc_linecoding_s*. - * See include/nuttx/usb/cdc.h for structure definition. This IOCTL - * should be called to get the data associated with the - * CDCACM_EVENT_LINECODING event (see devent definition below). - * CAIOC_GETCTRLLINE - * Get control line status bits. Argument FAR int*. See - * include/nuttx/usb/cdc.h for bit definitions. This IOCTL should be - * called to get the data associated CDCACM_EVENT_CTRLLINE event (see event - * definition below). - * CAIOC_NOTIFY - * Send a serial state to the host via the Interrupt IN endpoint. - * Argument: int. This includes the current state of the carrier detect, - * DSR, break, and ring signal. See "Table 69: UART State Bitmap Values" - * and CDC_UART_definitions in include/nuttx/usb/cdc.h. - */ - -#define CAIOC_REGISTERCB _CAIOC(0x0001) -#define CAIOC_GETLINECODING _CAIOC(0x0002) -#define CAIOC_GETCTRLLINE _CAIOC(0x0003) -#define CAIOC_NOTIFY _CAIOC(0x0004) - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -# define EXTERN extern "C" -extern "C" { -#else -# define EXTERN extern -#endif - -/* Reported serial events. Data is associated with CDCACM_EVENT_LINECODING - * and CDCACM_EVENT_CTRLLINE. The data may be obtained using CDCACM IOCTL - * commands described above. - * - * CDCACM_EVENT_LINECODING - See "Table 50: Line Coding Structure" and struct - * cdc_linecoding_s in include/nuttx/usb/cdc.h. - * CDCACM_EVENT_CTRLLINE - See "Table 51: Control Signal Bitmap Values for - * SetControlLineState" and definitions in include/nutt/usb/cdc.h - * CDCACM_EVENT_SENDBREAK - See Paragraph "6.2.15 SendBreak." This request - * sends special carrier modulation that generates an RS-232 style break. - */ - -enum cdcacm_event_e -{ - CDCACM_EVENT_LINECODING = 0, /* New line coding received from host */ - CDCACM_EVENT_CTRLLINE, /* New control line status received from host */ - CDCACM_EVENT_SENDBREAK /* Send break request received */ -}; - -typedef FAR void (*cdcacm_callback_t)(enum cdcacm_event_e event); - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Name: board_cdcclassobject - * - * Description: - * If the CDC serial class driver is part of composite device, then - * board-specific logic must provide board_cdcclassobject(). In the simplest - * case, board_cdcclassobject() is simply a wrapper around cdcacm_classobject() - * that provides the correct device minor number. - * - * Input Parameters: - * classdev - The location to return the CDC serial class' device - * instance. - * - * Returned Value: - * 0 on success; a negated errno on failure - * - ****************************************************************************/ - -#if defined(CONFIG_USBDEV_COMPOSITE) && defined(CONFIG_CDCACM_COMPOSITE) -struct usbdevclass_driver_s; -EXTERN int board_cdcclassobject(FAR struct usbdevclass_driver_s **classdev); -#endif - -/**************************************************************************** - * Name: board_cdcuninitialize - * - * Description: - * Un-initialize the USB serial class driver. This is just an application- - * specific wrapper aboutn cdcadm_unitialize() that is called form the composite - * device logic. - * - * Input Parameters: - * classdev - The class driver instrance previously give to the composite - * driver by board_cdcclassobject(). - * - * Returned Value: - * None - * - ****************************************************************************/ - -#if defined(CONFIG_USBDEV_COMPOSITE) && defined(CONFIG_CDCACM_COMPOSITE) -struct usbdevclass_driver_s; -EXTERN void board_cdcuninitialize(FAR struct usbdevclass_driver_s *classdev); -#endif - -/**************************************************************************** - * Name: cdcacm_classobject - * - * Description: - * Register USB serial port (and USB serial console if so configured) and - * return the class object. - * - * Input Parameter: - * minor - Device minor number. E.g., minor 0 would correspond to - * /dev/ttyACM0. - * classdev - The location to return the CDC serial class' device - * instance. - * - * Returned Value: - * A pointer to the allocated class object (NULL on failure). - * - ****************************************************************************/ - -#if defined(CONFIG_USBDEV_COMPOSITE) && defined(CONFIG_CDCACM_COMPOSITE) -int cdcacm_classobject(int minor, FAR struct usbdevclass_driver_s **classdev); -#endif - -/**************************************************************************** - * Name: cdcacm_initialize - * - * Description: - * Register USB serial port (and USB serial console if so configured). - * - * Input Parameter: - * minor - Device minor number. E.g., minor 0 would correspond to - * /dev/ttyACM0. - * handle - An optional opaque reference to the CDC/ACM class object that - * may subsequently be used with cdcacm_uninitialize(). - * - * Returned Value: - * Zero (OK) means that the driver was successfully registered. On any - * failure, a negated errno value is retured. - * - ****************************************************************************/ - -#if !defined(CONFIG_USBDEV_COMPOSITE) || !defined(CONFIG_CDCACM_COMPOSITE) -EXTERN int cdcacm_initialize(int minor, FAR void **handle); -#endif - -/**************************************************************************** - * Name: cdcacm_uninitialize - * - * Description: - * Un-initialize the USB storage class driver. This function is used - * internally by the USB composite driver to unitialized the CDC/ACM - * driver. This same interface is available (with an untyped input - * parameter) when the CDC/ACM driver is used standalone. - * - * Input Parameters: - * There is one parameter, it differs in typing depending upon whether the - * CDC/ACM driver is an internal part of a composite device, or a standalone - * USB driver: - * - * classdev - The class object returned by board_cdcclassobject() or - * cdcacm_classobject() - * handle - The opaque handle represetning the class object returned by - * a previous call to cdcacm_initialize(). - * - * Returned Value: - * None - * - ****************************************************************************/ - -#if defined(CONFIG_USBDEV_COMPOSITE) && defined(CONFIG_CDCACM_COMPOSITE) -EXTERN void cdcacm_uninitialize(FAR struct usbdevclass_driver_s *classdev); -#else -EXTERN void cdcacm_uninitialize(FAR void *handle); -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_USB_CDCACM_H */ diff --git a/nuttx/include/nuttx/usb/composite.h b/nuttx/include/nuttx/usb/composite.h deleted file mode 100644 index 98f992bf3..000000000 --- a/nuttx/include/nuttx/usb/composite.h +++ /dev/null @@ -1,186 +0,0 @@ -/************************************************************************************ - * include/nuttx/usb/composite.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 __INCLUDE_NUTTX_USB_COMPOSITE_H -#define __INCLUDE_NUTTX_USB_COMPOSITE_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#ifdef CONFIG_USBDEV_COMPOSITE - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* CONFIG_USBDEV_COMPOSITE - * Enables USB composite device support - * CONFIG_CDCACM_COMPOSITE - * Configure the CDC serial driver as part of a composite driver - * (only if CONFIG_USBDEV_COMPOSITE is also defined) - * CONFIG_COMPOSITE_COMPOSITE - * Configure the mass storage driver as part of a composite driver - * (only if CONFIG_USBDEV_COMPOSITE is also defined) - * CONFIG_COMPOSITE_EP0MAXPACKET - * Max packet size for endpoint 0 - * CONFIG_COMPOSITE_VENDORID and CONFIG_COMPOSITE_VENDORSTR - * The vendor ID code/string - * CONFIG_COMPOSITE_PRODUCTID and CONFIG_COMPOSITE_PRODUCTSTR - * The product ID code/string - * CONFIG_COMPOSITE_SERIALSTR - * Device serial number string - * CONFIG_COMPOSITE_CONFIGSTR - * Configuration string - * CONFIG_COMPOSITE_VERSIONNO - * Interface version number. - */ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: composite_initialize - * - * Description: - * Register USB composite device as configured. This function will call - * board-specific implementations in order to obtain the class objects for - * each of the members of the composite (see board_mscclassobject(), - * board_cdcclassobjec(), ...) - * - * Input Parameter: - * None - * - * Returned Value: - * A non-NULL "handle" is returned on success. This handle may be used - * later with composite_uninitialize() in order to removed the composite - * device. This handle is the (untyped) internal representation of the - * the class driver instance. - * - * NULL is returned on any failure. - * - ****************************************************************************/ - -EXTERN FAR void *composite_initialize(void); - -/**************************************************************************** - * Name: composite_uninitialize - * - * Description: - * Un-initialize the USB composite driver. The handle is the USB composite - * class' device object as was returned by composite_initialize(). This - * function will call board-specific implementations in order to free the - * class objects for each of the members of the composite (see - * board_mscuninitialize(), board_cdcuninitialize(), ...) - * - * Input Parameters: - * handle - The handle returned by a previous call to composite_initialize(). - * - * Returned Value: - * None - * - ***************************************************************************/ - -EXTERN void composite_uninitialize(FAR void *handle); - -/**************************************************************************** - * Name: composite_initialize - * - * Description: - * Register USB composite device as configured. This function will call - * board-specific implementations in order to obtain the class objects for - * each of the members of the composite (see board_mscclassobject(), - * board_cdcclassobjec(), ...) - * - * Input Parameter: - * None - * - * Returned Value: - * A non-NULL "handle" is returned on success. This handle may be used - * later with composite_uninitialize() in order to removed the composite - * device. This handle is the (untyped) internal representation of the - * the class driver instance. - * - * NULL is returned on any failure. - * - ****************************************************************************/ - -EXTERN FAR void *composite_initialize(void); - -/**************************************************************************** - * Name: composite_ep0submit - * - * Description: - * Members of the composite cannot send on EP0 directly because EP0 is - * is "owned" by the composite device. Instead, when configured as members - * of a composite device, those classes should call this method so that - * the composite device can send on EP0 onbehalf of the class. - * - ****************************************************************************/ - -struct usbdevclass_driver_s; -struct usbdev_s; -struct usbdev_req_s; - -EXTERN int composite_ep0submit(FAR struct usbdevclass_driver_s *driver, - FAR struct usbdev_s *dev, - FAR struct usbdev_req_s *ctrlreq); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* CONFIG_USBDEV_COMPOSITE */ -#endif /* __INCLUDE_NUTTX_USB_COMPOSITE_H */ diff --git a/nuttx/include/nuttx/usb/hid.h b/nuttx/include/nuttx/usb/hid.h deleted file mode 100644 index 877203a9c..000000000 --- a/nuttx/include/nuttx/usb/hid.h +++ /dev/null @@ -1,693 +0,0 @@ -/**************************************************************************** - * include/nuttx/usb/hid.h - * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * References: - * HID Universal Serial Bus (USB), Device Class Definition for Human - * Interface Devices (HID), Firmware Specification—6/27/01, Version - * 1.11. - * - * HuT Universal Serial Bus (USB), HID Usage Tables, 10/28/2004, Version - * 1.12 - * - * 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_NUTTX_USB_HID_H -#define __INCLUDE_NUTTX_USB_HID_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Preprocessor definitions - ****************************************************************************/ - -/* Subclass and Protocol ****************************************************/ -/* Subclass codes (HID 4.2) */ - -#define USBHID_SUBCLASS_NONE 0 /* No subclass */ -#define USBHID_SUBCLASS_BOOTIF 1 /* Boot Interface Subclass */ - -/* A variety of protocols are supported HID devices. The protocol member of - * an Interface descriptor only has meaning if the subclass member declares - * that the device supports a boot interface, otherwise it is 0. (HID 4.3) - */ - -#define USBHID_PROTOCOL_NONE 0 -#define USBHID_PROTOCOL_KEYBOARD 1 -#define USBHID_PROTOCOL_MOUSE 2 - -/* Descriptor Requests ******************************************************/ -/* "When a Get_Descriptor(Configuration) request is issued, it returns the - * Configuration descriptor, all Interface descriptors, all Endpoint - * descriptors, and the HID descriptor for each interface." - */ - -/* Standard Requests (HID 7.1) - * GET_DESCRIPTOR (HID 7.1.1): - * - * bmRequestType (USB_REQ_DIR_IN | USB_REQ_TYPE_STANDARD | USB_REQ_RECIPIENT_INTERFACE) - * bRequest (USB_REQ_GETDESCRIPTOR) - * wValue Descriptor Type (MS) and Descriptor Index (LS) - * wIndex Interface Number - * wLength Descriptor Length - * Data Descriptor - * - * SET_DESCRIPTOR (HID 7.1.2): - * - * bmRequestType (USB_REQ_TYPE_STANDARD | USB_REQ_RECIPIENT_INTERFACE) - * bRequest (USB_REQ_SETDESCRIPTOR) - * wValue Descriptor Type (MS) and Descriptor Index (LS) - * wIndex Interface Number - * wLength Descriptor Length - * Data Descriptor - */ - -/* Class Descriptor Types (HID 7.1) */ - -#define USBHID_DESCTYPE_HID 0x21 /* HID */ -#define USBHID_DESCTYPE_REPORT 0x22 /* Report */ -#define USBHID_DESCTYPE_PHYSICAL 0x23 /* Physical descriptor */ - -/* Class-specific requests (HID 7.2) - * - * bmRequestType ( USB_REQ_TYPE_CLASS | USB_REQ_RECIPIENT_INTERFACE) -or- - * (USB_REQ_DIR_IN | USB_REQ_TYPE_CLASS | USB_REQ_RECIPIENT_INTERFACE) - * bRequest Class-specific request - * wValue Varies according to request - * wIndex Varies according to request - * wLength Number of bytes to transfer in the data phase - * Data Data - */ - -#define USBHID_REQUEST_GETREPORT 0x01 -#define USBHID_REQUEST_GETIDLE 0x02 -#define USBHID_REQUEST_GETPROTOCOL 0x03 -#define USBHID_REQUEST_SETREPORT 0x09 -#define USBHID_REQUEST_SETIDLE 0x0a -#define USBHID_REQUEST_SETPROTOCOL 0x0b - -/* Report Type (MS byte of wValue for GET_REPORT) (HID 7.2.1) */ - -#define USBHID_REPORTTYPE_INPUT 0x01 -#define USBHID_REPORTTYPE_OUTPUT 0x02 -#define USBHID_REPORTTYPE_FEATURE 0x03 - -/* HID Descriptor ***********************************************************/ - -#define USBHID_COUNTRY_NONE 0x00 /* Not Supported */ -#define USBHID_COUNTRY_ARABIC 0x01 /* Arabic */ -#define USBHID_COUNTRY_BELGIAN 0x02 /* Belgian */ -#define USBHID_COUNTRY_CANADA 0x03 /* Canadian-Bilingual */ -#define USBHID_COUNTRY_CANADRFR 0x04 /* Canadian-French */ -#define USBHID_COUNTRY_CZECH 0x05 /* Czech Republic */ -#define USBHID_COUNTRY_DANISH 0x06 /* Danish */ -#define USBHID_COUNTRY_FINNISH 0x07 /* Finnish */ -#define USBHID_COUNTRY_FRENCH 0x08 /* French */ -#define USBHID_COUNTRY_GERMAN 0x09 /* German */ -#define USBHID_COUNTRY_GREEK 0x10 /* Greek */ -#define USBHID_COUNTRY_HEBREW 0x11 /* Hebrew */ -#define USBHID_COUNTRY_HUNGARY 0x12 /* Hungary */ -#define USBHID_COUNTRY_ISO 0x13 /* International (ISO) */ -#define USBHID_COUNTRY_ITALIAN 0x14 /* Italian */ -#define USBHID_COUNTRY_JAPAN 0x15 /* Japan (Katakana) */ -#define USBHID_COUNTRY_KOREAN 0x16 /* Korean */ -#define USBHID_COUNTRY_LATINAM 0x17 /* Latin American */ -#define USBHID_COUNTRY_DUTCH 0x18 /* Netherlands/Dutch */ -#define USBHID_COUNTRY_NORWEGIAN 0x19 /* Norwegian */ -#define USBHID_COUNTRY_PERSIAN 0x20 /* Persian (Farsi) */ -#define USBHID_COUNTRY_POLAND 0x21 /* Poland */ -#define USBHID_COUNTRY_PORTUGUESE 0x22 /* Portuguese */ -#define USBHID_COUNTRY_RUSSIA 0x23 /* Russia */ -#define USBHID_COUNTRY_SLOVAKIA 0x24 /* Slovakia */ -#define USBHID_COUNTRY_SPANISH 0x25 /* Spanish */ -#define USBHID_COUNTRY_SWEDISH 0x26 /* Swedish */ -#define USBHID_COUNTRY_SWISSFR 0x27 /* Swiss/French */ -#define USBHID_COUNTRY_SWISSGR 0x28 /* Swiss/German */ -#define USBHID_COUNTRY_SWITZERLAND 0x29 /* Switzerland */ -#define USBHID_COUNTRY_TAIWAN 0x30 /* Taiwan */ -#define USBHID_COUNTRY_TURKISHQ 0x31 /* Turkish-Q */ -#define USBHID_COUNTRY_UK 0x32 /* UK */ -#define USBHID_COUNTRY_US 0x33 /* US */ -#define USBHID_COUNTRY_YUGOSLAVIA 0x34 /* Yugoslavia */ -#define USBHID_COUNTRY_TURKISHF 0x35 /* Turkish-F */ - -/* HID report items */ - -#define USBHID_RPTITEM_SIZE_MASK 0x03 -# define USBHID_RPTITEM_SIZE_0 0x00 /* No data follows */ -# define USBHID_RPTITEM_SIZE_1 0x01 /* 1 byte of data follows */ -# define USBHID_RPTITEM_SIZE_2 0x02 /* 2 bytes of data follow */ -# define USBHID_RPTITEM_SIZE_4 0x03 /* 4 bytes of data follow */ -#define USBHID_RPTITEM_TYPE_MASK 0x0c -# define USBHID_RPTITEM_TYPE_MAIN 0x00 -# define USBHID_RPTITEM_TYPE_GLOBAL 0x04 -# define USBHID_RPTITEM_TYPE_LOCAL 0x08 -#define USBHID_RPTITEM_TAG_MASK 0xf0 - -/* Main Items (HID 6.2.2.4) */ - -#define USBHID_MAIN_CONSTANT (1 << 0) /* Constant(1) vs Data(0) */ -#define USBHID_MAIN_VARIABLE (1 << 1) /* Variable(1) vs Array(0) */ -#define USBHID_MAIN_RELATIVE (1 << 2) /* Relative(1) vs Absolute(0) */ -#define USBHID_MAIN_WRAP (1 << 3) /* Wrap(1) vs No Wrap(0) */ -#define USBHID_MAIN_NONLINEAR (1 << 4) /* Non Linear(1) vs Linear(0) */ -#define USBHID_MAIN_NOPREFERRED (1 << 5) /* No Preferred (1) vs Preferred State(0) */ -#define USBHID_MAIN_NULLSTATE (1 << 6) /* Null state(1) vs No Null position(0) */ -#define USBHID_MAIN_VOLATILE (1 << 7) /* Volatile(1) vs Non volatile(0) */ -#define USBHID_MAIN_BUFFEREDBYTES (1 << 8) /* Buffered Bytes(1) vs Bit Field(0) */ - -#define USBHID_MAIN_SIZE(pfx) ((pfx) & USBHID_RPTITEM_SIZE_MASK) -#define USBHID_MAIN_INPUT_PREFIX 0x80 -#define USBHID_MAIN_INPUT_CONSTANT USBHID_MAIN_CONSTANT -#define USBHID_MAIN_INPUT_VARIABLE USBHID_MAIN_VARIABLE -#define USBHID_MAIN_INPUT_RELATIVE USBHID_MAIN_RELATIVE -#define USBHID_MAIN_INPUT_WRAP USBHID_MAIN_WRAP -#define USBHID_MAIN_INPUT_NONLINEAR USBHID_MAIN_NONLINEAR -#define USBHID_MAIN_INPUT_NOPREFERRED USBHID_MAIN_NOPREFERRED -#define USBHID_MAIN_INPUT_NULLSTATE USBHID_MAIN_NULLSTATE -#define USBHID_MAIN_INPUT_BUFFEREDBYTES USBHID_MAIN_BUFFEREDBYTES - -#define USBHID_MAIN_OUTPUT_PREFIX 0x90 -#define USBHID_MAIN_OUTPUT_CONSTANT USBHID_MAIN_CONSTANT -#define USBHID_MAIN_OUTPUT_VARIABLE USBHID_MAIN_VARIABLE -#define USBHID_MAIN_OUTPUT_RELATIVE USBHID_MAIN_RELATIVE -#define USBHID_MAIN_OUTPUT_WRAP USBHID_MAIN_WRAP -#define USBHID_MAIN_OUTPUT_NONLINEAR USBHID_MAIN_NONLINEAR -#define USBHID_MAIN_OUTPUT_NOPREFERRED USBHID_MAIN_NOPREFERRED -#define USBHID_MAIN_OUTPUT_NULLSTATE USBHID_MAIN_NULLSTATE -#define USBHID_MAIN_OUTPUT_VOLATILE USBHID_MAIN_VOLATILE -#define USBHID_MAIN_OUTPUT_BUFFEREDBYTES USBHID_MAIN_BUFFEREDBYTES - -#define USBHID_MAIN_FEATURE_PREFIX 0xb0 -#define USBHID_MAIN_FEATURE_CONSTANT USBHID_MAIN_CONSTANT -#define USBHID_MAIN_FEATURE_VARIABLE USBHID_MAIN_VARIABLE -#define USBHID_MAIN_FEATURE_RELATIVE USBHID_MAIN_RELATIVE -#define USBHID_MAIN_FEATURE_WRAP USBHID_MAIN_WRAP -#define USBHID_MAIN_FEATURE_NONLINEAR USBHID_MAIN_NONLINEAR -#define USBHID_MAIN_FEATURE_NOPREFERRED USBHID_MAIN_NOPREFERRED -#define USBHID_MAIN_FEATURE_NULLSTATE USBHID_MAIN_NULLSTATE -#define USBHID_MAIN_FEATURE_VOLATILE USBHID_MAIN_VOLATILE -#define USBHID_MAIN_FEATURE_BUFFEREDBYTES USBHID_MAIN_BUFFEREDBYTES - -#define USBHID_MAIN_COLLECTION_PREFIX 0xa0 -#define USBHID_MAIN_COLLECTION_PHYSICAL 0x00 /* Physical (group of axes) */ -#define USBHID_MAIN_COLLECTION_APPL 0x01 /* Application (mouse, keyboard) */ -#define USBHID_MAIN_COLLECTION_LOGICAL 0x02 /* Logical (interrelated data) */ -#define USBHID_MAIN_COLLECTION_REPORT 0x03 /* Report */ -#define USBHID_MAIN_COLLECTION_ARRAY 0x04 /* Named Array */ -#define USBHID_MAIN_COLLECTION_SWITCH 0x05 /* Usage Switch */ -#define USBHID_MAIN_COLLECTION_MODIFIER 0x06 /* Usage Modifier */ - -#define USBHID_MAIN_ENDCOLLECTION_PREFIX 0xc0 - -/* Global Items (HID 6.2.2.7) */ - -#define USBHID_GLOBAL_SIZE(pfx) ((pfx) & USBHID_RPTITEM_SIZE_MASK) -#define USBHID_GLOBAL_USAGEPAGE_PREFIX 0x04 /* Usage Page */ -#define USBHID_GLOBAL_LOGICALMIN_PREFIX 0x14 /* Logical Minimum */ -#define USBHID_GLOBAL_LOGICALMAX_PREFIX 0x24 /* Logical Maximum */ -#define USBHID_GLOBAL_PHYSICALMIN_PREFIX 0x34 /* Physical Minimum */ -#define USBHID_GLOBAL_PHYSMICALAX_PREFIX 0x44 /* Physical Maximum */ -#define USBHID_GLOBAL_UNITEXP_PREFIX 0x54 /* Unit Exponent */ -#define USBHID_GLOBAL_UNIT_PREFIX 0x64 /* Unit */ -#define USBHID_GLOBAL_REPORTSIZE_PREFIX 0x74 /* Report Size */ -#define USBHID_GLOBAL_REPORTID_PREFIX 0x84 /* Report ID */ -#define USBHID_GLOBAL_REPORTCOUNT_PREFIX 0x94 /* Report Count */ -#define USBHID_GLOBAL_PUSH_PREFIX 0xa4 /* Push */ -#define USBHID_GLOBAL_POP_PREFIX 0xb4 /* Pop */ - -/* Local Items (HID 6.2.2.8) */ - -#define USBHID_LOCAL_SIZE(pfx) ((pfx) & USBHID_RPTITEM_SIZE_MASK) -#define USBHID_LOCAL_USAGE_PREFIX 0x08 /* Usage */ -#define USBHID_LOCAL_USAGEMIN_PREFIX 0x18 /* Usage Minimum */ -#define USBHID_LOCAL_USAGEMAX_PREFIX 0x28 /* Usage Maximum */ -#define USBHID_LOCAL_DESIGNATORIDX_PREFIX 0x38 /* Designator Index */ -#define USBHID_LOCAL_DESIGNATORMIN_PREFIX 0x48 /* Designator Minimum */ -#define USBHID_LOCAL_DESIGNATORMAX_PREFIX 0x58 /* Designator Maximum */ -#define USBHID_LOCAL_STRINGIDX_PREFIX 0x78 /* String Index */ -#define USBHID_LOCAL_STRINGMIN_PREFIX 0x88 /* String Minimum */ -#define USBHID_LOCAL_STRINGMAX_PREFIX 0x98 /* xx */ -#define USBHID_LOCAL_DELIMITER_PREFIX 0xa8 /*Delimiter */ - -/* Modifier Keys (HID 8.3) */ - -#define USBHID_MODIFER_LCTRL (1 << 0) /* Left Ctrl */ -#define USBHID_MODIFER_LSHIFT (1 << 1) /* Left Shift */ -#define USBHID_MODIFER_LALT (1 << 2) /* Left Alt */ -#define USBHID_MODIFER_LGUI (1 << 3) /* Left GUI */ -#define USBHID_MODIFER_RCTRL (1 << 4) /* Right Ctrl */ -#define USBHID_MODIFER_RSHIFT (1 << 5) /* Right Shift */ -#define USBHID_MODIFER_RALT (1 << 6) /* Right Alt */ -#define USBHID_MODIFER_RGUI (1 << 7) /* Right GUI */ - -/* Keyboard output report (1 byte) (HID B.1) */ - -#define USBHID_KBDOUT_NUMLOCK (1 << 0) -#define USBHID_KBDOUT_CAPSLOCK (1 << 1) -#define USBHID_KBDOUT_SCROLLLOCK (1 << 2) -#define USBHID_KBDOUT_COMPOSE (1 << 3) -#define USBHID_KBDOUT_KANA (1 << 4) - -/* Mouse input report (HID B.2) */ - -#define USBHID_MOUSEIN_BUTTON1 (1 << 0) -#define USBHID_MOUSEIN_BUTTON2 (1 << 1) -#define USBHID_MOUSEIN_BUTTON3 (1 << 2) - -/* Joystick input report (4 bytes) (HID D.1) */ - -#define USBHID_JSIN_HATSWITCH_SHIFT (0) -#define USBHID_JSIN_HATSWITCH_MASK (15 << USBHID_JSIN_HATSWITCH_SHIFT) -#define USBHID_JSIN_BUTTON1 (1 << 4) -#define USBHID_JSIN_BUTTON2 (1 << 5) -#define USBHID_JSIN_BUTTON3 (1 << 6) -#define USBHID_JSIN_BUTTON4 (1 << 7) - -/* Usage pages (HuT 3) */ - -#define USBHID_USAGE_PAGE_UNDEFINED 0x00 /* Undefined */ -#define USBHID_USAGE_PAGE_GENERIC_DCTRL 0x01 /* Generic Desktop Controls */ -#define USBHID_USAGE_PAGE_SIMCTRL 0x02 /* Simulation Controls */ -#define USBHID_USAGE_PAGE_VRCTRL 0x03 /* VR Controls */ -#define USBHID_USAGE_PAGE_SPORTCTRL 0x04 /* Sport Controls */ -#define USBHID_USAGE_PAGE_GAMECTRL 0x05 /* Game Controls */ -#define USBHID_USAGE_PAGE_GENERIC_DEVCTRL 0x06 /* Generic Device Controls */ -#define USBHID_USAGE_PAGE_KBD 0x07 /* Keyboard/Keypad */ -#define USBHID_USAGE_PAGE_LEDS 0x08 /* LEDs */ -#define USBHID_USAGE_PAGE_BUTTON 0x09 /* Button */ -#define USBHID_USAGE_PAGE_ORDINAL 0x0a /* Ordinal */ -#define USBHID_USAGE_PAGE_TELEPHONY 0x0b /* Telephony */ -#define USBHID_USAGE_PAGE_CONSUMER 0x0c /* Consumer */ -#define USBHID_USAGE_PAGE_DIGITIZER 0x0d /* Digitizer */ - /* 0x0e Reserved */ -#define USBHID_USAGE_PAGE_PIDPAGE 0x0f /* PID Page USB Physical Interface Device */ -#define USBHID_USAGE_PAGE_UNICODE 0x10 /* Unicode */ - /* 0x11-13 Reserved */ -#define USBHID_USAGE_PAGE_ALPHA_DISPLAY 0x14 /* Alphanumeric Display */ - /* 0x15-3f Reserved */ -#define USBHID_USAGE_PAGE_MEDICAL 0x40 /* Medical Instruments */ - /* 0x41-7f Reserved */ - /* 0x80-83 Monitor Devices */ - /* 0x84-87 Power Devices */ - /* 0x88-8b Reserved */ -#define USBHID_USAGE_PAGE_BARCODE_SCANNER 0x8c /* Bar Code Scanner page */ -#define USBHID_USAGE_PAGE_SCALE 0x8d /* Scale page */ -#define USBHID_USAGE_PAGE_MSR 0x8e /* Magnetic Stripe Reading (MSR) Devices */ -#define USBHID_USAGE_PAGE_POS 0x8f /* Point of Sale devices */ -#define USBHID_USAGE_PAGE_CAMERA_CTRL 0x90 /* Camera Control Page */ - -/* Generic Desktop Page Usage IDs (HuT 4) */ - -#define USBHID_DCTRLUSE_UNDEFINED 0x00 /* Undefined */ -#define USBHID_DCTRLUSE_POINTER 0x01 /* Pointer */ -#define USBHID_DCTRLUSE_MOUSE 0x02 /* Mouse */ - /* 0x03 Reserved */ -#define USBHID_DCTRLUSE_JOYSTICK 0x04 /* Joystick */ -#define USBHID_DCTRLUSE_GAMEPAD 0x05 /* Game Pad */ -#define USBHID_DCTRLUSE_KEYBOARD 0x06 /* Keyboard */ -#define USBHID_DCTRLUSE_KEYPAD 0x07 /* Keypad */ -#define USBHID_DCTRLUSE_MULTIAXIS 0x08 /* Multi-axis Controller */ -#define USBHID_DCTRLUSE_TABLET 0x09 /* Tablet PC System Controls */ - /* 0x0a-2f Reserved */ -#define USBHID_DCTRLUSE_X 0x30 /* X */ -#define USBHID_DCTRLUSE_Y 0x31 /* Y */ -#define USBHID_DCTRLUSE_Z 0x32 /* Z */ -#define USBHID_DCTRLUSE_RX 0x33 /* Rx */ -#define USBHID_DCTRLUSE_RY 0x34 /* Ry */ -#define USBHID_DCTRLUSE_RZ 0x35 /* Rz */ -#define USBHID_DCTRLUSE_SLIDER 0x36 /* Slider */ -#define USBHID_DCTRLUSE_DIAL 0x37 /* Dial */ -#define USBHID_DCTRLUSE_WHEEL 0x38 /* Wheel */ -#define USBHID_DCTRLUSE_HATSWITCH 0x39 /* Hat switch */ -#define USBHID_DCTRLUSE_COUNTED 0x3a /* Counted Buffer */ -#define USBHID_DCTRLUSE_BYTECOUNT 0x3b /* Byte Count */ -#define USBHID_DCTRLUSE_MOTION 0x3c /* Motion Wakeup */ -#define USBHID_DCTRLUSE_START 0x3d /* Start */ -#define USBHID_DCTRLUSE_SELECT 0x3e /* Select */ - /* 0x3f Reserved */ -#define USBHID_DCTRLUSE_VX 0x40 /* Vx */ -#define USBHID_DCTRLUSE_VY 0x41 /* Vy */ -#define USBHID_DCTRLUSE_VZ 0x42 /* Vz */ -#define USBHID_DCTRLUSE_VBRX 0x43 /* Vbrx */ -#define USBHID_DCTRLUSE_VBRY 0x44 /* Vbry */ -#define USBHID_DCTRLUSE_VBRZ 0x45 /* Vbrz */ -#define USBHID_DCTRLUSE_VNO 0x46 /* Vno */ -#define USBHID_DCTRLUSE_FEATURE 0x47 /* Feature Notification */ -#define USBHID_DCTRLUSE_RESOLUTION 0x48 /* Resolution Multiplier */ - /* 0x49-7f Reserved */ -#define USBHID_DCTRLUSE_CONTROL 0x80 /* System Control */ -#define USBHID_DCTRLUSE_POWERDOWN 0x81 /* System Power Down */ -#define USBHID_DCTRLUSE_SLEEP 0x82 /* System Sleep */ -#define USBHID_DCTRLUSE_WAKEUP 0x83 /* System Wake Up */ -#define USBHID_DCTRLUSE_CONTEXT_MENU 0x84 /* System Context Menu */ -#define USBHID_DCTRLUSE_MAIN_MENU 0x85 /* System Main Menu */ -#define USBHID_DCTRLUSE_APP_MENU 0x86 /* System App Menu */ -#define USBHID_DCTRLUSE_MENU_HELP 0x87 /* System Menu Help */ -#define USBHID_DCTRLUSE_MENU_EXIT 0x88 /* System Menu Exit */ -#define USBHID_DCTRLUSE_MENU_SELECT 0x89 /* System Menu Select */ -#define USBHID_DCTRLUSE_MENU_RIGHT 0x8a /* System Menu Right */ -#define USBHID_DCTRLUSE_MENU_LEFT 0x8b /* System Menu Left */ -#define USBHID_DCTRLUSE_MENU_UP 0x8c /* System Menu Up */ -#define USBHID_DCTRLUSE_MENU_DOWN 0x8d /* System Menu Down */ -#define USBHID_DCTRLUSE_COLD_RESTART 0x8e /* System Cold Restart */ -#define USBHID_DCTRLUSE_WARM_RESTART 0x8f /* System Warm Restart */ -#define USBHID_DCTRLUSE_DPAD_UP 0x90 /* D-pad Up */ -#define USBHID_DCTRLUSE_DPAD_DOWN 0x91 /* D-pad Down */ -#define USBHID_DCTRLUSE_DPAD_RIGHT 0x92 /* D-pad Right */ -#define USBHID_DCTRLUSE_DPAD_LEFT 0x93 /* D-pad Left */ - /* 0x94-9f Reserved */ -#define USBHID_DCTRLUSE_DOCK 0xa0 /* System Dock */ -#define USBHID_DCTRLUSE_UNDOCK 0xa1 /* System Undock */ -#define USBHID_DCTRLUSE_SETUP 0xa2 /* System Setup */ -#define USBHID_DCTRLUSE_BREAK 0xa3 /* System Break */ -#define USBHID_DCTRLUSE_DEBUG_BREAK 0xa4 /* System Debugger Break */ -#define USBHID_DCTRLUSE_APP_BREAK 0xa5 /* Application Break */ -#define USBHID_DCTRLUSE_APP_DEBUG_BREAK 0xa6 /* Application Debugger Break */ -#define USBHID_DCTRLUSE_MUTE 0xa7 /* System Speaker Mute */ -#define USBHID_DCTRLUSE_HIBERNATE 0xa8 /* System Hibernate */ - /* 0xa9-af Reserved */ -#define USBHID_DCTRLUSE_DISPLAY_INVERT 0xb0 /* System Display Invert */ -#define USBHID_DCTRLUSE_DISPALY_INTERNAL 0xb1 /* System Display Internal */ -#define USBHID_DCTRLUSE_DISPLAY_EXTERNAL 0xb2 /* System Display External */ -#define USBHID_DCTRLUSE_DISPLAY_BOTH 0xb3 /* System Display Both */ -#define USBHID_DCTRLUSE_DISPLAY_DUAL 0xb4 /* System Display Dual */ -#define USBHID_DCTRLUSE_DISPLAY_TOGGLE 0xb5 /* System Display Toggle Int/Ext */ -#define USBHID_DCTRLUSE_DISPLAY_SWAP 0xb6 /* System Display Swap */ -#define USBHID_DCTRLUSE_ 0xb7 /* System Display LCD Autoscale */ - /* 0xb8-ffff Reserved */ - -/* Keyboard usage IDs (HuT 10) */ - -#define USBHID_KBDUSE_NONE 0x00 /* Reserved (no event indicated) */ -#define USBHID_KBDUSE_ERRORROLLOVER 0x01 /* Keyboard ErrorRollOver */ -#define USBHID_KBDUSE_POSTFAIL 0x02 /* Keyboard POSTFail */ -#define USBHID_KBDUSE_ERRUNDEF 0x03 /* Keyboard ErrorUndefined */ -#define USBHID_KBDUSE_A 0x04 /* Keyboard a or A (B-Z follow) */ -#define USBHID_KBDUSE_1 0x1e /* Keyboard 1 (2-9 follow) */ -#define USBHID_KBDUSE_EXCLAM 0x1e /* Keyboard 1 and ! */ -#define USBHID_KBDUSE_AT 0x1f /* Keyboard 2 and @ */ -#define USBHID_KBDUSE_POUND 0x20 /* Keyboard 3 and # */ -#define USBHID_KBDUSE_DOLLAR 0x21 /* Keyboard 4 and $ */ -#define USBHID_KBDUSE_PERCENT 0x22 /* Keyboard 5 and % */ -#define USBHID_KBDUSE_CARAT 0x23 /* Keyboard 6 and ^ */ -#define USBHID_KBDUSE_AMPERSAND 0x24 /* Keyboard 7 and & */ -#define USBHID_KBDUSE_ASTERISK 0x25 /* Keyboard 8 and * */ -#define USBHID_KBDUSE_LPAREN 0x26 /* Keyboard 9 and ( */ -#define USBHID_KBDUSE_0 0x27 /* Keyboard 0 and ) */ -#define USBHID_KBDUSE_RPAREN 0x27 /* Keyboard 0 and ) */ -#define USBHID_KBDUSE_ENTER 0x28 /* Keyboard Return (ENTER) */ -#define USBHID_KBDUSE_ESCAPE 0x29 /* Keyboard ESCAPE */ -#define USBHID_KBDUSE_DELETE 0x2a /* Keyboard DELETE (Backspace) */ -#define USBHID_KBDUSE_TAB 0x2b /* Keyboard Tab */ -#define USBHID_KBDUSE_SPACE 0x2c /* Keyboard Spacebar */ -#define USBHID_KBDUSE_HYPHEN 0x2d /* Keyboard - and (underscore) */ -#define USBHID_KBDUSE_UNDERSCORE 0x2d /* Keyboard - and (underscore) */ -#define USBHID_KBDUSE_EQUAL 0x2e /* Keyboard = and + */ -#define USBHID_KBDUSE_PLUS 0x2e /* Keyboard = and + */ -#define USBHID_KBDUSE_LBRACKET 0x2f /* Keyboard [ and { */ -#define USBHID_KBDUSE_LBRACE 0x2f /* Keyboard [ and { */ -#define USBHID_KBDUSE_RBRACKET 0x30 /* Keyboard ] and } */ -#define USBHID_KBDUSE_RBRACE 0x30 /* Keyboard ] and } */ -#define USBHID_KBDUSE_BSLASH 0x31 /* Keyboard \ and | */ -#define USBHID_KBDUSE_VERTBAR 0x31 /* Keyboard \ and | */ -#define USBHID_KBDUSE_NONUSPOUND 0x32 /* Keyboard Non-US # and ~ */ -#define USBHID_KBDUSE_TILDE 0x32 /* Keyboard Non-US # and ~ */ -#define USBHID_KBDUSE_SEMICOLON 0x33 /* Keyboard ; and : */ -#define USBHID_KBDUSE_COLON 0x33 /* Keyboard ; and : */ -#define USBHID_KBDUSE_SQUOTE 0x34 /* Keyboard ' and " */ -#define USBHID_KBDUSE_DQUOUTE 0x34 /* Keyboard ' and " */ -#define USBHID_KBDUSE_GACCENT 0x35 /* Keyboard Grave Accent and Tilde */ -#define USBHID_KBDUSE_GTILDE 0x35 /* Keyboard Grave Accent and Tilde */ -#define USBHID_KBDUSE_COMMON 0x36 /* Keyboard , and < */ -#define USBHID_KBDUSE_LT 0x36 /* Keyboard , and < */ -#define USBHID_KBDUSE_PERIOD 0x37 /* Keyboard . and > */ -#define USBHID_KBDUSE_GT 0x37 /* Keyboard . and > */ -#define USBHID_KBDUSE_DIV 0x38 /* Keyboard / and ? */ -#define USBHID_KBDUSE_QUESTION 0x38 /* Keyboard / and ? */ -#define USBHID_KBDUSE_CAPSLOCK 0x39 /* Keyboard Caps Lock */ -#define USBHID_KBDUSE_F1 0x3a /* Keyboard F1 */ -#define USBHID_KBDUSE_F2 0x3b /* Keyboard F2 */ -#define USBHID_KBDUSE_F3 0x3c /* Keyboard F3 */ -#define USBHID_KBDUSE_F4 0x3d /* Keyboard F4 */ -#define USBHID_KBDUSE_F5 0x3e /* Keyboard F5 */ -#define USBHID_KBDUSE_F6 0x3f /* Keyboard F6 */ -#define USBHID_KBDUSE_F7 0x40 /* Keyboard F7 */ -#define USBHID_KBDUSE_F8 0x41 /* Keyboard F8 */ -#define USBHID_KBDUSE_F9 0x42 /* Keyboard F9 */ -#define USBHID_KBDUSE_F10 0x43 /* Keyboard F10 */ -#define USBHID_KBDUSE_F11 0x44 /* Keyboard F11 */ -#define USBHID_KBDUSE_F12 0x45 /* Keyboard F12 */ -#define USBHID_KBDUSE_PRINTSCN 0x46 /* Keyboard PrintScreen */ -#define USBHID_KBDUSE_SCROLLLOCK 0x47 /* Keyboard Scroll Lock */ -#define USBHID_KBDUSE_PAUSE 0x48 /* Keyboard Pause */ -#define USBHID_KBDUSE_INSERT 0x49 /* Keyboard Insert */ -#define USBHID_KBDUSE_HOME 0x4a /* Keyboard Home */ -#define USBHID_KBDUSE_PAGEUP 0x4b /* Keyboard PageUp */ -#define USBHID_KBDUSE_DELFWD 0x4c /* Keyboard Delete Forward */ -#define USBHID_KBDUSE_END 0x4d /* Keyboard End */ -#define USBHID_KBDUSE_PAGEDOWN 0x4e /* Keyboard PageDown */ -#define USBHID_KBDUSE_RIGHT 0x4f /* eyboard RightArrow */ -#define USBHID_KBDUSE_LEFT 0x50 /* Keyboard LeftArrow */ -#define USBHID_KBDUSE_DOWN 0x5a /* Keyboard DownArrow */ -#define USBHID_KBDUSE_UP 0x52 /* Keyboard UpArrow */ -#define USBHID_KBDUSE_KPDNUMLOCK 0x53 /* Keypad Num Lock and Clear */ -#define USBHID_KBDUSE_KPDNUMLOCKCLEAR 0x53 /* Keypad Num Lock and Clear */ -#define USBHID_KBDUSE_KPDDIV 0x54 /* Keypad / */ -#define USBHID_KBDUSE_KPDMUL 0x55 /* Keypad * */ -#define USBHID_KBDUSE_KPDHMINUS 0x56 /* Keypad - */ -#define USBHID_KBDUSE_KPDPLUS 0x57 /* Keypad + */ -#define USBHID_KBDUSE_KPDEMTER 0x58 /* Keypad ENTER */ -#define USBHID_KBDUSE_KPD1 0x59 /* Keypad 1 (2-9 follow) */ -#define USBHID_KBDUSE_KPDEND 0x59 /* Keypad 1 and End */ -#define USBHID_KBDUSE_KPDDOWN 0x5a /* Keypad 2 and Down Arrow */ -#define USBHID_KBDUSE_KPDPAGEDN 0x5b /* Keypad 3 and PageDn */ -#define USBHID_KBDUSE_KPDLEFT 0x5c /* Keypad 4 and Left Arrow */ -#define USBHID_KBDUSE_KPDRIGHT 0x5e /* Keypad 6 and Right Arrow */ -#define USBHID_KBDUSE_KPDHOME 0x5f /* Keypad 7 and Home */ -#define USBHID_KBDUSE_KPDUP 0x60 /* Keypad 8 and Up Arrow */ -#define USBHID_KBDUSE_KPDPAGEUP 0x61 /* Keypad 9 and PageUp */ -#define USBHID_KBDUSE_KPD0 0x62 /* Keypad 0 and Insert */ -#define USBHID_KBDUSE_KPDINSERT 0x62 /* Keypad 0 and Insert */ -#define USBHID_KBDUSE_KPDDECIMALPT 0x63 /* Keypad . and Delete */ -#define USBHID_KBDUSE_KPDDELETE 0x63 /* Keypad . and Delete */ -#define USBHID_KBDUSE_NONUSBSLASH 0x64 /* Keyboard Non-US \ and | */ -#define USBHID_KBDUSE_NONUSVERT 0x64 /* Keyboard Non-US \ and | */ -#define USBHID_KBDUSE_APPLICATION 0x65 /* Keyboard Application */ -#define USBHID_KBDUSE_POWER 0x66 /* Keyboard Power */ -#define USBHID_KBDUSE_KPDEQUAL 0x67 /* Keypad = */ -#define USBHID_KBDUSE_F13 0x68 /* Keyboard F13 */ -#define USBHID_KBDUSE_F14 0x69 /* Keyboard F14 */ -#define USBHID_KBDUSE_F15 0x6a /* Keyboard F15 */ -#define USBHID_KBDUSE_F16 0x6b /* Keyboard F16 */ -#define USBHID_KBDUSE_F17 0x6c /* Keyboard F17 */ -#define USBHID_KBDUSE_F18 0x6d /* Keyboard F18 */ -#define USBHID_KBDUSE_F19 0x6e /* Keyboard F19 */ -#define USBHID_KBDUSE_F20 0x6f /* Keyboard F20 */ -#define USBHID_KBDUSE_F21 0x70 /* Keyboard F21 */ -#define USBHID_KBDUSE_F22 0x71 /* Keyboard F22 */ -#define USBHID_KBDUSE_F23 0x72 /* Keyboard F23 */ -#define USBHID_KBDUSE_F24 0x73 /* Keyboard F24 */ -#define USBHID_KBDUSE_EXECUTE 0x74 /* Keyboard Execute */ -#define USBHID_KBDUSE_HELP 0x75 /* Keyboard Help */ -#define USBHID_KBDUSE_MENU 0x76 /* Keyboard Menu */ -#define USBHID_KBDUSE_SELECT 0x77 /* Keyboard Select */ -#define USBHID_KBDUSE_STOP 0x78 /* Keyboard Stop */ -#define USBHID_KBDUSE_AGAIN 0x79 /* Keyboard Again */ -#define USBHID_KBDUSE_UNDO 0x7a /* Keyboard Undo */ -#define USBHID_KBDUSE_CUT 0x7b /* Keyboard Cut */ -#define USBHID_KBDUSE_COPY 0x7c /* Keyboard Copy */ -#define USBHID_KBDUSE_PASTE 0x7d /* Keyboard Paste */ -#define USBHID_KBDUSE_FIND 0x7e /* Keyboard Find */ -#define USBHID_KBDUSE_MUTE 0x7f /* Keyboard Mute */ -#define USBHID_KBDUSE_VOLUP 0x80 /* Keyboard Volume Up */ -#define USBHID_KBDUSE_VOLDOWN 0x81 /* Keyboard Volume Down */ -#define USBHID_KBDUSE_LCAPSLOCK 0x82 /* Keyboard Locking Caps Lock */ -#define USBHID_KBDUSE_LNUMLOCK 0x83 /* Keyboard Locking Num Lock */ -#define USBHID_KBDUSE_LSCROLLLOCK 0x84 /* Keyboard Locking Scroll Lock */ -#define USBHID_KBDUSE_KPDCOMMA 0x85 /* Keypad Comma */ -#define USBHID_KBDUSE_KPDEQUALSIGN 0x86 /* Keypad Equal Sign */ -#define USBHID_KBDUSE_INTERNATIONAL1 0x87 /* Keyboard International 1 */ -#define USBHID_KBDUSE_INTERNATIONAL2 0x88 /* Keyboard International 2 */ -#define USBHID_KBDUSE_INTERNATIONAL3 0x89 /* Keyboard International 3 */ -#define USBHID_KBDUSE_INTERNATIONAL4 0x8a /* Keyboard International 4 */ -#define USBHID_KBDUSE_INTERNATIONAL5 0x8b /* Keyboard International 5 */ -#define USBHID_KBDUSE_INTERNATIONAL6 0x8c /* Keyboard International 6 */ -#define USBHID_KBDUSE_INTERNATIONAL7 0x8d /* Keyboard International 7 */ -#define USBHID_KBDUSE_INTERNATIONAL8 0x8e /* Keyboard International 8 */ -#define USBHID_KBDUSE_INTERNATIONAL9 0x8f /* Keyboard International 9 */ -#define USBHID_KBDUSE_LANG1 0x90 /* Keyboard LANG1 */ -#define USBHID_KBDUSE_LANG2 0x91 /* Keyboard LANG2 */ -#define USBHID_KBDUSE_LANG3 0x92 /* Keyboard LANG3 */ -#define USBHID_KBDUSE_LANG4 0x93 /* Keyboard LANG4 */ -#define USBHID_KBDUSE_LANG5 0x94 /* Keyboard LANG5 */ -#define USBHID_KBDUSE_LANG6 0x95 /* Keyboard LANG6 */ -#define USBHID_KBDUSE_LANG7 0x96 /* Keyboard LANG7 */ -#define USBHID_KBDUSE_LANG8 0x97 /* Keyboard LANG8 */ -#define USBHID_KBDUSE_LANG9 0x98 /* Keyboard LANG9 */ -#define USBHID_KBDUSE_ALTERASE 0x99 /* Keyboard Alternate Erase */ -#define USBHID_KBDUSE_SYSREQ 0x9a /* Keyboard SysReq/Attention */ -#define USBHID_KBDUSE_CANCEL 0x9b /* Keyboard Cancel */ -#define USBHID_KBDUSE_CLEAR 0x9c /* Keyboard Clear */ -#define USBHID_KBDUSE_PRIOR 0x9d /* Keyboard Prior */ -#define USBHID_KBDUSE_RETURN 0x9e /* Keyboard Return */ -#define USBHID_KBDUSE_SEPARATOR 0x9f /* Keyboard Separator */ -#define USBHID_KBDUSE_OUT 0xa0 /* Keyboard Out */ -#define USBHID_KBDUSE_OPER 0xa1 /* Keyboard Oper */ -#define USBHID_KBDUSE_CLEARAGAIN 0xa2 /* Keyboard Clear/Again */ -#define USBHID_KBDUSE_CLRSEL 0xa3 /* Keyboard CrSel/Props */ -#define USBHID_KBDUSE_EXSEL 0xa4 /* Keyboard ExSel */ -#define USBHID_KBDUSE_KPD00 0xb0 /* Keypad 00 */ -#define USBHID_KBDUSE_KPD000 0xb1 /* Keypad 000 */ -#define USBHID_KBDUSE_THOUSEPARATOR 0xb2 /* Thousands Separator */ -#define USBHID_KBDUSE_DECSEPARATOR 0xb3 /* Decimal Separator */ -#define USBHID_KBDUSE_CURRUNIT 0xb4 /* Currency Unit */ -#define USBHID_KBDUSE_CURRSUBUNIT 0xb5 /* Currency Sub-unit */ -#define USBHID_KBDUSE_KPDLPAREN 0xb6 /* Keypad ( */ -#define USBHID_KBDUSE_KPDRPAREN 0xb7 /* Keypad ) */ -#define USBHID_KBDUSE_KPDLBRACE 0xb8 /* Keypad { */ -#define USBHID_KBDUSE_KPDRBRACE 0xb9 /* Keypad } */ -#define USBHID_KBDUSE_KPDTAB 0xba /* Keypad Tab */ -#define USBHID_KBDUSE_KPDBACKSPACE 0xbb /* Keypad Backspace */ -#define USBHID_KBDUSE_KPDA 0xbc /* Keypad A (B-F follow) */ -#define USBHID_KBDUSE_KPDXOR 0xc2 /* Keypad XOR */ -#define USBHID_KBDUSE_KPDEXP 0xc3 /* Keypad ^ */ -#define USBHID_KBDUSE_KPDPERCENT 0xc4 /* Keypad % */ -#define USBHID_KBDUSE_KPDLT 0xc5 /* Keypad < */ -#define USBHID_KBDUSE_KPDGT 0xc6 /* Keypad > */ -#define USBHID_KBDUSE_KPDAMPERSAND 0xc7 /* Keypad & */ -#define USBHID_KBDUSE_KPDAND 0xc8 /* Keypad && */ -#define USBHID_KBDUSE_KPDVERT 0xc9 /* Keypad | */ -#define USBHID_KBDUSE_KPDOR 0xca /* Keypad || */ -#define USBHID_KBDUSE_KPDCOLON 0xcb /* Keypad : */ -#define USBHID_KBDUSE_KPDPOUND 0xcc /* Keypad # */ -#define USBHID_KBDUSE_KPDSPACE 0xcd /* Keypad Space */ -#define USBHID_KBDUSE_KPDAT 0xce /* Keypad @ */ -#define USBHID_KBDUSE_KPDEXCLAM 0xcf /* Keypad ! */ -#define USBHID_KBDUSE_KPDMEMSTORE 0xd0 /* Keypad Memory Store */ -#define USBHID_KBDUSE_KPDMEMRECALL 0xd1 /* Keypad Memory Recall */ -#define USBHID_KBDUSE_KPDMEMCLEAR 0xd2 /* Keypad Memory Clear */ -#define USBHID_KBDUSE_KPDMEMADD 0xd3 /* Keypad Memory Add */ -#define USBHID_KBDUSE_KPDMEMSUB 0xd4 /* Keypad Memory Subtract */ -#define USBHID_KBDUSE_KPDMEMMULT 0xd5 /* Keypad Memory Multiply */ -#define USBHID_KBDUSE_KPDMEMDIV 0xd6 /* Keypad Memory Divide */ -#define USBHID_KBDUSE_KPDPLUSMINUS 0xd7 /* Keypad +/- */ -#define USBHID_KBDUSE_KPDCLEAR 0xd8 /* Keypad Clear */ -#define USBHID_KBDUSE_KPDCLEARENTRY 0xd9 /* Keypad Clear Entry */ -#define USBHID_KBDUSE_KPDBINARY 0xda /* Keypad Binary */ -#define USBHID_KBDUSE_KPDOCTAL 0xdb /* Keypad Octal */ -#define USBHID_KBDUSE_KPDDECIMAL 0xdc /* Keypad Decimal */ -#define USBHID_KBDUSE_KPDHEXADECIMAL 0xdd /* Keypad Hexadecimal */ -#define USBHID_KBDUSE_LCTRL 0xe0 /* Keyboard LeftControl */ -#define USBHID_KBDUSE_LSHIFT 0xe1 /* Keyboard LeftShift */ -#define USBHID_KBDUSE_LALT 0xe2 /* Keyboard LeftAlt */ -#define USBHID_KBDUSE_LGUI 0xe3 /* Keyboard Left GUI */ -#define USBHID_KBDUSE_RCTRL 0xe4 /* Keyboard RightControl */ -#define USBHID_KBDUSE_RSHIFT 0xe5 /* Keyboard RightShift */ -#define USBHID_KBDUSE_RALT 0xe6 /* Keyboard RightAlt */ -#define USBHID_KBDUSE_RGUI 0xe7 /* Keyboard Right GUI */ - -#define USBHID_KBDUSE_MAX 0xe7 - -/**************************************************************************** - * Public Types - ****************************************************************************/ -/* HID Descriptor (HID 6.2.1) ***********************************************/ - -struct usbhid_descriptor_s -{ - uint8_t len; /* Size of the HID descriptor */ - uint8_t type; /* HID descriptor type */ - uint8_t hid[2]; /* HID class specification release */ - uint8_t country; /* Country code */ - uint8_t ndesc; /* Number of descriptors (>=1) */ - uint8_t classdesc; /* Class descriptor type (See 7.1) */ - uint8_t desclen[2]; /* Size of the report descriptor */ - uint8_t optdesc; /* Type of optional descriptor */ - uint8_t optlen[2]; /* Size of the optional descriptor */ -}; - -/* Standard Reports *********************************************************/ -/* Keyboard input report (8 bytes) (HID B.1) */ - -struct usbhid_kbdreport_s -{ - uint8_t modifier; /* Modifier keys. See USBHID_MODIFIER_* definitions */ - uint8_t reserved; - uint8_t key[6]; /* Keycode 1-6 */ -}; - -/* Keyboard output report (1 byte) (HID B.1), see USBHID_KBDOUT_* definitions */ - -/* Mouse input report (HID B.2) */ - -struct usbhid_mousereport_s -{ - uint8_t buttons; /* See USBHID_MOUSEIN_* definitions */ - uint8_t xdisp; /* X displacement */ - uint8_t ydisp; /* y displacement */ - /* Device specific additional bytes may follow */ -}; - -/* Joystick input report (1 bytes) (HID D.1) */ - -struct usbhid_jsreport_s -{ - uint8_t xpos; /* X position */ - uint8_t ypos; /* X position */ - uint8_t buttons; /* See USBHID_JSIN_* definitions */ - uint8_t throttle; /* Throttle */ -}; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -# define EXTERN extern "C" -extern "C" { -#else -# define EXTERN extern -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_USB_HID_H */ diff --git a/nuttx/include/nuttx/usb/hid_parser.h b/nuttx/include/nuttx/usb/hid_parser.h deleted file mode 100644 index 07e1e5765..000000000 --- a/nuttx/include/nuttx/usb/hid_parser.h +++ /dev/null @@ -1,350 +0,0 @@ -/**************************************************************************** - * include/nuttx/usb/hid_parser.h - * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * - * Adapted from the LUFA Library: - * - * Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) - * dean [at] fourwalledcubicle [dot] com, www.lufa-lib.org - * - * Permission to use, copy, modify, distribute, and sell this - * software and its documentation for any purpose is hereby granted - * without fee, provided that the above copyright notice appear in - * all copies and that both that the copyright notice and this - * permission notice and warranty disclaimer appear in supporting - * documentation, and that the name of the author not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * The author disclaim all warranties with regard to this - * software, including all implied warranties of merchantability - * and fitness. In no event shall the author be liable for any - * special, indirect or consequential damages or any damages - * whatsoever resulting from loss of use, data or profits, whether - * in an action of contract, negligence or other tortious action, - * arising out of or in connection with the use or performance of - * this software. - * - ****************************************************************************/ - -#ifndef __INCLUDE_NUTTX_USB_HID_PARSER_H -#define __INCLUDE_NUTTX_USB_HID_PARSER_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -/* CONFIG_HID_STATEDEPTH - * Constant indicating the maximum stack depth of the state table. A larger - * state table allows for more PUSH/POP report items to be nested, but - * consumes more memory. By default this is set to 2 levels (allowing non- - * nested PUSH items) but this can be overridden by defining - * CONFIG_HID_STATEDEPTH in the Nuttx config file. - * - * CONFIG_HID_USAGEDEPTH - * Constant indicating the maximum stack depth of the usage table. A larger - * usage table allows for more USAGE items to be indicated sequentially for - * REPORT COUNT entries of more than one, but requires more stack space. By - * default this is set to 8 levels (allowing for a report item with a count - * of 8) but this can be overridden by defining CONFIG_HID_USAGEDEPTH to - * in the Nuttx config file. - * - * CONFIG_HID_MAXCOLLECTIONS - * Constant indicating the maximum number of COLLECTION items (nested or - * unnested) that can be processed in the report item descriptor. A large - * value allows for more COLLECTION items to be processed, but consumes - * more memory. By default this is set to 10 collections, but this can be - * overridden by defining CONFIG_HID_MAXCOLLECTIONS in the Nuttx config file. - * - * CONFIG_HID_MAXITEMS - * Constant indicating the maximum number of report items (IN, OUT or - * FEATURE) that can be processed in the report item descriptor and stored - * in the user HID Report Info structure. A large value allows - * for more report items to be stored, but consumes more memory. By default - * this is set to 20 items, but this can be overridden by defining - * CONFIG_HID_MAXITEMS in the Nuttx config file. - * - * CONFIG_HID_MAXIDS - * Constant indicating the maximum number of unique report IDs that can be - * processed in the report item descriptor for the report size information - * array in the user HID Report Info structure. A large value allows for - * more report ID report sizes to be stored, but consumes more memory. By - * default this is set to 10 items, but this can be overridden by defining - * CONFIG_HID_MAXIDS in the Nuttx config file. Note that IN, OUT and FEATURE - * items sharing the same report ID consume only one size item in the array. - */ - -#ifndef CONFIG_HID_STATEDEPTH -# define CONFIG_HID_STATEDEPTH 2 -#endif - -#ifndef CONFIG_HID_USAGEDEPTH -# define CONFIG_HID_USAGEDEPTH 8 -#endif - -#ifndef CONFIG_HID_MAXCOLLECTIONS -# define CONFIG_HID_MAXCOLLECTIONS 10 -#endif - -#ifndef CONFIG_HID_MAXITEMS -# define CONFIG_HID_MAXITEMS 20 -#endif - -#ifndef CONFIG_HID_MAXIDS -# define CONFIG_HID_MAXIDS 10 -#endif - -/* HID report type indices */ - -#define HID_REPORT_ITEM_IN 0 -#define HID_REPORT_ITEM_OUT 1 -#define HID_REPORT_ITEM_FEATURE 2 - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* HID Parser Report Item Min/Max Structure. Type define for an attribute - * with both minimum and maximum values (e.g. Logical Min/Max). - */ - -struct hid_range_s -{ - uint32_t min; /* Minimum value for the attribute */ - uint32_t max; /* Maximum value for the attribute */ -}; - -/* HID Parser Report Item Unit Structure. Type define for the Unit attributes - * of a report item. - */ - -struct hid_unit_t -{ - uint32_t type; /* Unit type (refer to HID spec for details) */ - uint8_t exponent; /* Unit exponent (refer to HID spec for details) */ -}; - -/* HID Parser Report Item Usage Structure. Type define for the Usage - * attributes of a report item. - */ - -struct hid_usage_t -{ - uint16_t page; /* Usage page of the report item */ - uint16_t usage; /* Usage of the report item */ -}; - -/* HID Parser Report Item Collection Path Structure. Type define for a - * COLLECTION object. Contains the collection attributes and a reference to - * the parent collection if any. - */ - -struct hid_collectionpath_s -{ - uint8_t type; /* Collection type (e.g. "Generic Desktop") */ - struct hid_usage_t usage; /* Collection usage */ - struct hid_collectionpath_s *parent; /* Reference to parent collection (NULL if root) */ -}; - -/* HID Parser Report Item Attributes Structure. Type define for all the data - * attributes of a report item, except flags. - */ - -struct hid_rptitem_attributes_s -{ - uint8_t bitsize; /* Size in bits of the report item's data */ - struct hid_usage_t usage; /* Usage of the report item */ - struct hid_unit_t unit; /* Unit type and exponent of the report item */ - struct hid_range_s logical; /* Logical minimum and maximum of the report item */ - struct hid_range_s physical; /* Physical minimum and maximum of the report item */ -}; - -/* HID Parser Report Item Details Structure. Type define for a report item - * (IN, OUT or FEATURE) layout attributes and other details. - */ - -struct hid_rptitem_s -{ - uint16_t bitoffset; /* Bit offset in IN, OUT or FEATURE report of the item */ - uint8_t type; /* Report item type */ - uint16_t flags; /* Item data flags */ - uint8_t id; /* Report ID this item belongs to (0 if only one report) */ - struct hid_collectionpath_s *collectionpath; /* Collection path of the item */ - struct hid_rptitem_attributes_s attrib; /* Report item attributes */ - uint32_t value; /* Current value of the report item */ - uint32_t previous; /* Previous value of the report item */ -}; - -/* HID Parser Report Size Structure. Type define for a report item size - * information structure, to retain the size of a device's reports by ID. - */ - -struct hid_rptsizeinfo_s -{ - uint8_t id; /* Report ID of the report within the HID interface */ - uint16_t size[3]; /* Number of bits in report type for the Report ID */ -}; - -/* HID Parser State Structure. Type define for a complete processed HID - * report, including all report item data and collections. - */ - -struct hid_rptinfo_s -{ - /* nitems is the number of report items stored in the report items array (rptitems[]). */ - - uint8_t nitems; - struct hid_rptitem_s items[CONFIG_HID_MAXITEMS]; - - /* All collection items, referenced by the report items. */ - - struct hid_collectionpath_s collectionpaths[CONFIG_HID_MAXCOLLECTIONS]; - - uint8_t nreports; /* Number of reports within the HID interface */ - struct hid_rptsizeinfo_s rptsize[CONFIG_HID_MAXIDS]; /* Report sizes for each report in the interface */ - uint16_t maxrptsize; /* Largest report that the attached device will generate, in bits */ - bool haverptid; /* Device has at least one REPORT ID in its HID report */ -}; - -/* Callback routine for the HID Report Parser. This callback must be - * implemented by the user code when the parser is used, to determine what - * report IN, OUT and FEATURE item's information is stored into the user - * struct hid_rptinfo_s structure. This can be used to filter only those - * items the application will be using, so that no RAM is wasted storing - * the attributes for report items which will never be referenced by the - * application. - * - * Input Parameters: - * item Pointer to the current report item for user checking. - * - * Returned value: - * Boolean true if the item should be stored into the struct hid_rptinfo_s - * structure, false if it should be ignored. - */ - -typedef bool (*hid_rptfilter_t)(FAR struct hid_rptitem_s *item); - -/**************************************************************************** - * Public Function Protoypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -# define EXTERN extern "C" -extern "C" { -#else -# define EXTERN extern -#endif - -/**************************************************************************** - * Name: hid_parsereport - * - * Description: - * Function to process a given HID report returned from an attached device, - * and store it into a given struct hid_rptinfo_s structure. - * - * Input Parameters: - * report Buffer containing the device's HID report table. - * rptlen Size in bytes of the HID report table. - * filter Callback function to decide if an item should be retained - * rptinfo Pointer to a struct hid_rptinfo_s instance for the parser output. - * - * Returned Value: - * Zero on success, otherwise a negated errno value. - ****************************************************************************/ - -EXTERN int hid_parsereport(FAR const uint8_t *report, int rptlen, - hid_rptfilter_t filter, - FAR struct hid_rptinfo_s *rptinfo); - -/**************************************************************************** - * Name: hid_getitem - * - * Description: - * Extracts the given report item's value out of the given HID report and - * places it into the value member of the report item's struct hid_rptitem_s - * structure. - * - * When called on a report with an item that exists in that report, this - * copies the report item's Value to it's previous element for easy - * checking to see if an item's value has changed before processing a - * report. If the given item does not exist in the report, the function - * does not modify the report item's data. - * - * Input Parameters - * report Buffer containing an IN or FEATURE report from an attached - * device. - * item Pointer to the report item of interest in a struct hid_rptinfo_s - * item array. - * - * Returned Value: - * Zero on success, otherwise a negated errno value. - * - ****************************************************************************/ - -EXTERN int hid_getitem(FAR const uint8_t *report, FAR struct hid_rptitem_s *item); - -/**************************************************************************** - * Name: hid_putitem - * - * Desription: - * Retrieves the given report item's value out of the value member of the - * report item's struct hid_rptitem_s structure and places it into the correct - * position in the HID report buffer. The report buffer is assumed to have - * the appropriate bits cleared before calling this function (i.e., the - * buffer should be explicitly cleared before report values are added). - * - * When called, this copies the report item's Value element to it's - * previous element for easy checking to see if an item's value has - * changed before sending a report. - * - * If the device has multiple HID reports, the first byte in the report is - * set to the report ID of the given item. - * - * Input Parameters: - * report Buffer holding the current OUT or FEATURE report data. - * item Pointer to the report item of interest in a struct hid_rptinfo_s - * item array. - * - ****************************************************************************/ - -#if 0 /* Not needed by host */ -EXTERN void hid_putitem(FAR uint8_t *report, FAR struct hid_rptitem_s *item); -#endif - -/**************************************************************************** - * Name: hid_reportsize - * - * Description: - * Retrieves the size of a given HID report in bytes from it's Report ID. - * - * InputParameters: - * rptinfo Pointer to a struct hid_rptinfo_s instance containing the parser output. - * id Report ID of the report whose size is to be retrieved. - * rpttype Type of the report whose size is to be determined, a valued from the - * HID_ReportItemTypes_t enum. - * - * Size of the report in bytes, or 0 if the report does not exist. - * - ****************************************************************************/ - -EXTERN size_t hid_reportsize(FAR struct hid_rptinfo_s *rptinfo, - uint8_t id, uint8_t rpttype); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - - -#endif /* __INCLUDE_NUTTX_USB_HID_PARSER_H */ diff --git a/nuttx/include/nuttx/usb/ohci.h b/nuttx/include/nuttx/usb/ohci.h deleted file mode 100644 index c5f15246b..000000000 --- a/nuttx/include/nuttx/usb/ohci.h +++ /dev/null @@ -1,459 +0,0 @@ -/**************************************************************************** - * include/nuttx/usb/ohci.h - * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * References: "OpenHCI Open Host Controller Interface Specification - * for USB," Release 1.0a, Compaq, Microsoft, National Semiconductor, - * September 14, 1999. - * - * 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_NUTTX_USB_OHCI_H -#define __INCLUDE_NUTTX_USB_OHCI_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Register offsets *********************************************************/ -/* Control and status registers (section 7.1) */ - -#define OHCI_HCIREV_OFFSET 0x0000 /* HcRevision: Version of HCI specification */ -#define OHCI_CTRL_OFFSET 0x0004 /* HcControl: HC control */ -#define OHCI_CMDST_OFFSET 0x0008 /* HcCommandStatus: HC command status */ -#define OHCI_INTST_OFFSET 0x000c /* HcInterruptStatus: HC interrupt status */ -#define OHCI_INTEN_OFFSET 0x0010 /* HcInterruptEnable: HC interrupt enable */ -#define OHCI_INTDIS_OFFSET 0x0014 /* HcInterruptDisable: HC interrupt disable */ - -/* Memory pointer registers (section 7.2) */ - -#define OHCI_HCCA_OFFSET 0x0018 /* HcHCCA: HC communication area */ -#define OHCI_PERED_OFFSET 0x001c /* HcPeriodCurrentED: Current isoc or int endpoint desc */ -#define OHCI_CTRLHEADED_OFFSET 0x0020 /* HcControlHeadED: First EP desc in the control list */ -#define OHCI_CTRLED_OFFSET 0x0024 /* HcControlCurrentED: Current EP desc in the control list */ -#define OHCI_BULKHEADED_OFFSET 0x0028 /* HcBulkHeadED: First EP desc in the bulk list */ -#define OHCI_BULKED_OFFSET 0x002c /* HcBulkCurrentED: Current EP desc in the bulk list */ -#define OHCI_DONEHEAD_OFFSET 0x0030 /* HcDoneHead: Last transfer desc added to DONE queue */ - -/* Frame counter registers (section 7.3) */ - -#define OHCI_FMINT_OFFSET 0x0034 /* HcFmInterval: Bit time interval that would not cause overrun */ -#define OHCI_FMREM_OFFSET 0x0038 /* HcFmRemaining: Bit time remaining in current frame */ -#define OHCI_FMNO_OFFSET 0x003c /* HcFmNumber: Frame number counter */ -#define OHCI_PERSTART_OFFSET 0x0040 /* HcPeriodicStart: Time to start processing periodic list */ - -/* Root hub registers (section 7.4) */ - -#define OHCI_LSTHRES_OFFSET 0x0044 /* HcLSThreshold: Commit to transfer threshold */ -#define OHCI_RHDESCA_OFFSET 0x0048 /* HcRhDescriptorA: Describes root hub (part A) */ -#define OHCI_RHDESCB_OFFSET 0x004c /* HcRhDescriptorB: Describes root hub (part B) */ -#define OHCI_RHSTATUS_OFFSET 0x0050 /* HcRhStatus: Root hub status */ - -#define OHCI_MAX_RHPORT 15 /* Maximum number of OHCI root hub ports */ - -#define OHCI_RHPORTST_OFFSET(n) (0x0054+(((n)-1) << 2)) -#define OHCI_RHPORTST1_OFFSET 0x0054 /* HcRhPort1Status: Root hub port status 1 */ -#define OHCI_RHPORTST2_OFFSET 0x0058 /* HcRhPort2Status: Root hub port status 2 */ -#define OHCI_RHPORTST3_OFFSET 0x005c /* HcRhPort3Status: Root hub port status 3 */ -#define OHCI_RHPORTST4_OFFSET 0x0060 /* HcRhPort4Status: Root hub port status 4 */ -#define OHCI_RHPORTST5_OFFSET 0x0064 /* HcRhPort5Status: Root hub port status 5 */ -#define OHCI_RHPORTST6_OFFSET 0x0068 /* HcRhPort6Status: Root hub port status 6 */ -#define OHCI_RHPORTST7_OFFSET 0x006c /* HcRhPort7Status: Root hub port status 7 */ -#define OHCI_RHPORTST8_OFFSET 0x0070 /* HcRhPort8Status: Root hub port status 8 */ -#define OHCI_RHPORTST9_OFFSET 0x0074 /* HcRhPort9Status: Root hub port status 9 */ -#define OHCI_RHPORTST10_OFFSET 0x0078 /* HcRhPort10Status: Root hub port status 10 */ -#define OHCI_RHPORTST11_OFFSET 0x007c /* HcRhPort11Status: Root hub port status 11 */ -#define OHCI_RHPORTST12_OFFSET 0x0080 /* HcRhPort12Status: Root hub port status 12 */ -#define OHCI_RHPORTST13_OFFSET 0x0084 /* HcRhPort13Status: Root hub port status 13 */ -#define OHCI_RHPORTST14_OFFSET 0x0088 /* HcRhPort14Status: Root hub port status 14 */ -#define OHCI_RHPORTST15_OFFSET 0x008c /* HcRhPort15Status: Root hub port status 15 */ - -/* Register bit definitions *************************************************/ - -/* HcRevision: Version of HCI specification (7.1.1) */ - -#define OHCI_HCIREV_SHIFT (0) /* Bits 0-7: HCI spec version (BCD) */ -#define OHCI_HCIREV_MASK (0xff << OHCI_HCIREV_SHIFT) - -/* HcControl: HC control (7.1.2) */ - -#define OHCI_CTRL_CBSR (3 << 0) /* Bit 0: Control/bulk service ratio */ -#define OHCI_CTRL_PLE (1 << 2) /* Bit 1: Periodic list enable */ -#define OHCI_CTRL_IE (1 << 3) /* Bit 2: Isochronous enable */ -#define OHCI_CTRL_CLE (1 << 4) /* Bit 3: Control list enable */ -#define OHCI_CTRL_BLE (1 << 5) /* Bit 4: Bulk list enable */ -#define OHCI_CTRL_HCFS_SHIFT (6) /* Bits 6-7: Host controller functional state */ -#define OHCI_CTRL_HCFS_MASK (3 << OHCI_CTRL_HCFS_SHIFT) -# define OHCI_CTRL_HCFS_RESET (0 << OHCI_CTRL_HCFS_SHIFT) -# define OHCI_CTRL_HCFS_RESUME (1 << OHCI_CTRL_HCFS_SHIFT) -# define OHCI_CTRL_HCFS_OPER (2 << OHCI_CTRL_HCFS_SHIFT) -# define OHCI_CTRL_HCFS_SUSPEND (3 << OHCI_CTRL_HCFS_SHIFT) -#define OHCI_CTRL_IR (1 << 8) /* Bit 8: Interrupt routing */ -#define OHCI_CTRL_RWC (1 << 9) /* Bit 9: Remote wakeup connected */ -#define OHCI_CTRL_RWE (1 << 10) /* Bit 10: Remote wakeup enable */ - /* Bits 11-31: Reserved */ - -/* HcCommandStatus: HC command status (7.1.3) */ - -#define OHCI_CMDST_HCR (1 << 0) /* Bit 0: Host controller reset */ -#define OHCI_CMDST_CLF (1 << 1) /* Bit 1: Control list filled */ -#define OHCI_CMDST_BLF (1 << 2) /* Bit 2: Bulk list filled */ -#define OHCI_CMDST_OCR (1 << 3) /* Bit 3: Ownership change request */ - /* Bits 4-15: Reserved */ -#define OHCI_CMDST_SOC (3 << 16) /* Bit 16: Scheduling overrun count */ - /* Bits 17-31: Reserved */ - -/* HcInterruptStatus: HC interrupt status (7.1.4), - * HcInterruptEnable: HC interrupt enable (7.1.5), and - * HcInterruptDisable: HC interrupt disable (7.1.6) - */ - -#define OHCI_INT_SO (1 << 0) /* Bit 0: Scheduling overrun */ -#define OHCI_INT_WDH (1 << 1) /* Bit 1: Writeback done head */ -#define OHCI_INT_SF (1 << 2) /* Bit 2: Start of frame */ -#define OHCI_INT_RD (1 << 3) /* Bit 3: Resume detected */ -#define OHCI_INT_UE (1 << 4) /* Bit 4: Unrecoverable error */ -#define OHCI_INT_FNO (1 << 5) /* Bit 5: Frame number overflow */ -#define OHCI_INT_RHSC (1 << 6) /* Bit 6: Root hub status change */ - /* Bits 7-29: Reserved */ -#define OHCI_INT_OC (1 << 30) /* Bit 30: Ownership change */ -#define OHCI_INT_MIE (1 << 31) /* Bit 31: Master interrupt enable - * (Enable/disable only) */ -/* HcHCCA: HC communication area (7.2.1): - * - * 32-bits aligned to 256 byte boundary. - */ - -/* HcPeriodCurrentED: Current isoc or int endpoint desc (7.2.2), - * HcControlHeadED: First EP desc in the control list (7.2.3), - * HcControlCurrentED: Current EP desc in the control list (7.2.4), - * HcBulkHeadED: First EP desc in the bulk list (7.2.5), - * HcBulkCurrentED: Current EP desc in the bulk list (7.2.6), and - * HcDoneHead: Last transfer desc added to DONE queue (7.2.7): - * - * All 32-bits aligned to an 8-byte boundary - */ - -/* HcFmInterval: Bit time interval that would not cause overrun (7.3.1) */ - -#define OHCI_FMINT_FI_SHIFT (0) /* Bits 0-13: Frame interval */ -#define OHCI_FMINT_FI_MASK (0x3fff << OHCI_FMINT_FI_SHIFT) - /* Bits 14-15: Reserved */ -#define OHCI_FMINT_FSMPS_SHIFT (16) /* Bits 16-30: FS largest packet data */ -#define OHCI_FMINT_FSMPS_MASK (0x7fff << OHCI_FMINT_FSMPS_SHIFT) -#define OHCI_FMINT_FIT (1 << 31) /* Bit 31: Frame interval toggle */ - -/* HcFmRemaining: Bit time remaining in current frame (7.3.2) */ - -#define OHCI_FMREM_FR_SHIFT (0) /* Bits 0-13: Frame remaining */ -#define OHCI_FMREM_FR_MASK (0x3fff << OHCI_FMREM_FR_SHIFT) - /* Bits 16-30: Reserved */ -#define OHCI_FMINT_FRT (1 << 31) /* Bit 31: Frame remaining toggle */ - -/* HcFmNumber: Frame number counter (7.3.3) */ - -#define OHCI_FMNO_FI_SHIFT (0) /* Bits 0-15: Frame number */ -#define OHCI_FMNO_FI_MASK (0xffff << OHCI_FMINT_FI_SHIFT) - /* Bits 16-31: Reserved */ -/* HcPeriodicStart: Time to start processing periodic list (7.3.4) */ - -#define OHCI_PERSTART_SHIFT (0) /* Bits 0-13: Periodic start */ -#define OHCI_PERSTART_MASK (0x3fff << OHCI_PERSTART_SHIFT) - /* Bits 14-31: Reserved */ -/* HcLSThreshold: Commit to transfer threshold (7.3.5) */ - -#define OHCI_LSTHRES_SHIFT (0) /* Bits 0-11: LS threshold */ -#define OHCI_LSTHRES_MASK (0x0fff << OHCI_PERSTART_SHIFT) - /* Bits 12-31: Reserved */ -/* HcRhDescriptorN: Describes root hub (part A) (7.4.1) */ - -#define OHCI_RHDESCA_NDP_SHIFT (0) /* Bits 0-7: Number downstream ports */ -#define OHCI_RHDESCA_NDP_MASK (0xff << OHCI_RHDESCA_NDP_SHIFT) -#define OHCI_RHDESCA_PSM (1 << 8) /* Bit 8: Power switching mode */ -#define OHCI_RHDESCA_NPS (1 << 9) /* Bit 9: No power switching */ -#define OHCI_RHDESCA_DT (1 << 10) /* Bit 10: Device type */ -#define OHCI_RHDESCA_OCPM (1 << 11) /* Bit 11: Over current protection mode */ -#define OHCI_RHDESCA_NOCP (1 << 12) /* Bit 12: No over current protection */ - /* Bits 13-23: Reserved */ -#define OHCI_RHDESCA_POTPGT_SHIFT (24) /* Bits 24-31: Power on to power good time */ -#define OHCI_RHDESCA_POTPGT_MASK (0xff << OHCI_RHDESCA_POTPGT_SHIFT) - -/* HcRhDescriptorB: Describes root hub (part B) (7.4.2) */ - -#define OHCI_RHDESCB_DR_SHIFT (0) /* Bits 0-15: Device removable */ -#define OHCI_RHDESCB_DR_MASK (0xffff << OHCI_RHDESCB_DR_SHIFT) -# define OHCI_RHDESCB_ATTACHED(n) (1 << (OHCI_RHDESCB_DR_SHIFT+(n))) -#define OHCI_RHDESCB_PPCM_SHIFT (16) /* Bits 16-31: Port power control mask */ -#define OHCI_RHDESCB_PPCM_MASK (0xffff << OHCI_RHDESCB_PPCM_SHIFT) -# define OHCI_RHDESCB_POWERED(n) (1 << (OHCI_RHDESCB_DR_SHIFT+(n))) - -/* HcRhStatus: Root hub status (7.4.3) */ - -#define OHCI_RHSTATUS_LPS (1 << 0) /* Bit 0: Local power status (read)*/ -#define OHCI_RHSTATUS_CGP (1 << 0) /* Bit 0: Clear global power (write)*/ -#define OHCI_RHSTATUS_OCI (1 << 1) /* Bit 1: Over current indicator */ - /* Bits 2-14: Reserved */ -#define OHCI_RHSTATUS_DRWE (1 << 15) /* Bit 15: Device remote wakeup enable */ -#define OHCI_RHSTATUS_LPSC (1 << 16) /* Bit 16: Local power status change (read) */ -#define OHCI_RHSTATUS_SGP (1 << 16) /* Bit 16: Set global power (write) */ -#define OHCI_RHSTATUS_OCIC (1 << 17) /* Bit 17: Overcurrent indicator change */ - /* Bits 18-30: Reserved */ -#define OHCI_RHSTATUS_CRWE (1 << 31) /* Bit 31: Clear remote wakeup enable */ - -/* HcRhPortStatus: Root hub port status (7.4.4) */ - -#define OHCI_RHPORTST_CCS (1 << 0) /* Bit 0: Current connect status */ -#define OHCI_RHPORTST_PES (1 << 1) /* Bit 1: Port enable status */ -#define OHCI_RHPORTST_PSS (1 << 2) /* Bit 2: Port suspend status */ -#define OHCI_RHPORTST_POCI (1 << 3) /* Bit 3: Port over current indicator */ -#define OHCI_RHPORTST_PRS (1 << 4) /* Bit 4: Port reset status */ - /* Bits 5-7: Reserved */ -#define OHCI_RHPORTST_PPS (1 << 8) /* Bit 8: Port power status */ -#define OHCI_RHPORTST_LSDA (1 << 9) /* Bit 9: Low speed device attached */ - /* Bits 10-15: Reserved */ -#define OHCI_RHPORTST_CSC (1 << 16) /* Bit 16: Connect status change */ -#define OHCI_RHPORTST_PESC (1 << 17) /* Bit 17: Port enable status change */ -#define OHCI_RHPORTST_PSSC (1 << 18) /* Bit 18: Port suspend status change */ -#define OHCI_RHPORTST_OCIC (1 << 19) /* Bit 19: Port over current indicator change */ -#define OHCI_RHPORTST_PRSC (1 << 20) /* Bit 20: Port reset status change */ - /* Bits 21-31: Reserved */ - -/* Transfer Descriptors *****************************************************/ -/* Endpoint Descriptor Offsets (4.2.1) */ - -#define ED_CONTROL_OFFSET (0x00) /* ED status/control bits */ -#define ED_TAILP_OFFSET (0x04) /* TD Queue Tail Pointer (TailP) */ -#define ED_HEADP_OFFSET (0x08) /* TD Queue Head Pointer (HeadP) */ -#define ED_NEXTED_OFFSET (0x0c) /* Next Endpoint Descriptor (NextED) */ - -/* Endpoint Descriptor Bit Definitions (4.2.2) */ - -#define ED_CONTROL_FA_SHIFT (0) /* Bits 0-6: Function Address */ -#define ED_CONTROL_FA_MASK (0x7f << ED_CONTROL_FA_SHIFT) -#define ED_CONTROL_EN_SHIFT (7) /* Bits 7-10: Endpoint number */ -#define ED_CONTROL_EN_MASK (15 << ED_CONTROL_EN_SHIFT) -#define ED_CONTROL_D_SHIFT (11) /* Bits 11-12: Direction */ -#define ED_CONTROL_D_MASK (3 << ED_CONTROL_D_SHIFT) -# define ED_CONTROL_D_TD1 (0 << ED_CONTROL_D_SHIFT) /* Get direction from TD */ -# define ED_CONTROL_D_OUT (1 << ED_CONTROL_D_SHIFT) /* OUT */ -# define ED_CONTROL_D_IN (2 << ED_CONTROL_D_SHIFT) /* IN */ -# define ED_CONTROL_D_TD2 (3 << ED_CONTROL_D_SHIFT) /* Get direction from TD */ -#define ED_CONTROL_S (1 << 13) /* Bit 13: Speed (low) */ -#define ED_CONTROL_K (1 << 14) /* Bit 14: Skip */ -#define ED_CONTROL_F (1 << 15) /* Bit 15: Format (isochronous) */ -#define ED_CONTROL_MPS_SHIFT (16) /* Bits 16-26: Maximum packet size */ -#define ED_CONTROL_MPS_MASK (0x7ff << ED_CONTROL_MPS_SHIFT) - -#define ED_HEADP_ADDR_SHIFT (0) -#define ED_HEADP_ADDR_MASK 0xfffffff0 -#define ED_HEADP_H (1 << 0) /* Bit 0: Halted */ -#define ED_HEADP_C (1 << 1) /* Bit 1: Toggle carry */ - -/* General Transfer Descriptor Offsets (4.3.1) */ - -#define GTD_STATUS_OFFSET (0x00) /* TD status bits */ -#define GTD_CBP_OFFSET (0x04) /* Current Buffer Pointer (CBP) */ -#define GTD_NEXTTD_OFFSET (0x08) /* Next TD (NextTD) */ -#define GTD_BE_OFFSET (0x0c) /* Buffer End (BE) */ - -/* General Transfer Descriptor Bit Definitions */ - /* Bits 0-17: Reserved */ -#define GTD_STATUS_R (1 << 18) /* Bit 18: Buffer rounding */ -#define GTD_STATUS_DP_SHIFT (19) /* Bits 19-20: Direction/PID */ -#define GTD_STATUS_DP_MASK (3 << GTD_STATUS_DP_SHIFT) -# define GTD_STATUS_DP_SETUP (0 << GTD_STATUS_DP_SHIFT) /* To endpoint */ -# define GTD_STATUS_DP_OUT (1 << GTD_STATUS_DP_SHIFT) /* To endpoint */ -# define GTD_STATUS_DP_IN (2 << GTD_STATUS_DP_SHIFT) /* From endpoint */ -#define GTD_STATUS_DI_SHIFT (21) /* Bits 21-23: Delay input */ -#define GTD_STATUS_DI_MASK (7 << GTD_STATUS_DI_SHIFT) -#define GTD_STATUS_T_SHIFT (24) /* Bits 24-25: Data Toggle */ -#define GTD_STATUS_T_MASK (3 << GTD_STATUS_T_SHIFT) -# define GTD_STATUS_T_TOGGLE (0 << GTD_STATUS_T_SHIFT) -# define GTD_STATUS_T_DATA0 (2 << GTD_STATUS_T_SHIFT) -# define GTD_STATUS_T_DATA1 (3 << GTD_STATUS_T_SHIFT) -#define GTD_STATUS_EC_SHIFT (26) /* Bits 26-27: Error count */ -#define GTD_STATUS_EC_MASK (3 << GTD_STATUS_EC_SHIFT) -#define GTD_STATUS_CC_SHIFT (28) /* Bits 28-31: Condition code */ -#define GTD_STATUS_CC_MASK (15 << GTD_STATUS_CC_SHIFT) - -/* Isochronous Transfer Descriptor Offsets (4.3.2) */ - -#define ITD_STATUS_OFFSET (0x00) /* TD status bits */ -#define ITD_BP0_OFFSET (0x04) /* Buffer page 0 (BP0) */ -#define ITD_NEXTTD_OFFSET (0x08) /* Next TD (NextTD) */ -#define ITD_BE_OFFSET (0x0c) /* Buffer End (BE) */ - -#define ITD_NPSW (8) -#define ITD_PSW0_OFFSET (0x10) /* Offset0/PSW0 */ -#define ITD_PSW1_OFFSET (0x12) /* Offset1/PSW1 */ -#define ITD_PSW2_OFFSET (0x14) /* Offset2/PSW2 */ -#define ITD_PSW3_OFFSET (0x16) /* Offset3/PSW3 */ -#define ITD_PSW4_OFFSET (0x18) /* Offset4/PSW4 */ -#define ITD_PSW5_OFFSET (0x1a) /* Offset5/PSW5 */ -#define ITD_PSW6_OFFSET (0x1c) /* Offset6/PSW6 */ -#define ITD_PSW7_OFFSET (0x1e) /* Offset7/PSW7 */ - -/* Condition codes (Table 4-7) */ - -#define TD_CC_NOERROR 0x00 -#define TD_CC_CRC 0x01 -#define TD_CC_BITSTUFFING 0x02 -#define TD_CC_DATATOGGLEMISMATCH 0x03 -#define TD_CC_STALL 0x04 -#define TD_CC_DEVNOTRESPONDING 0x05 -#define TD_CC_PIDCHECKFAILURE 0x06 -#define TD_CC_UNEXPECTEDPID 0x07 -#define TD_CC_DATAOVERRUN 0x08 -#define TD_CC_DATAUNDERRUN 0x09 -#define TD_CC_BUFFEROVERRUN 0x0c -#define TD_CC_BUFFERUNDERRUN 0x0d -#define TD_CC_NOTACCESSED 0x0f - -/* Host Controller Communications Area Format (4.4.1) ***********************/ - -/* HccaInterrruptTable: 32x32-bit pointers to interrupt EDs */ - -#define HCCA_INTTBL_OFFSET (0x00) -#define HCCA_INTTBL_WSIZE (32) -#define HCCA_INTTBL_BSIZE (HCCA_INTTBL_WSIZE*4) - -/* HccaFrameNumber: Current frame number */ - -#define HCCA_FMNO_OFFSET (0x80) -#define HCCA_FMNO_BSIZE (2) - -/* HccaPad1: Zero when frame no. updated */ - -#define HCCA_PAD1_OFFSET (0x82) -#define HCCA_PAD1_BSIZE (2) - -/* HccaDoneHead: When the HC reaches the end of a frame and its deferred - * interrupt register is 0, it writes the current value of its HcDoneHead to - * this location and generates an interrupt. - */ - -#define HCCA_DONEHEAD_OFFSET (0x84) -#define HCCA_DONEHEAD_BSIZE (4) - -/* 0x88: 116 bytes reserved */ - -#define HCCA_RESERVED_OFFSET (0x88) -#define HCCA_RESERVED_BSIZE (116) - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* Endpoint Descriptor Offsets (4.2.1) */ - -struct ohci_ed_s -{ - volatile uint32_t ctrl; /* ED status/control bits */ - volatile uint32_t tailp; /* TD Queue Tail Pointer (TailP) */ - volatile uint32_t headp; /* TD Queue Head Pointer (HeadP) */ - volatile uint32_t nexted; /* Next Endpoint Descriptor (NextED) */ -}; - -/* General Transfer Descriptor (4.3.1) */ - -struct ohci_gtd_s -{ - volatile uint32_t ctrl; /* TD status/control bits */ - volatile uint32_t cbp; /* Current Buffer Pointer (CBP) */ - volatile uint32_t nexttd; /* Next TD (NextTD) */ - volatile uint32_t be; /* Buffer End (BE) */ -}; - -/* Isochronous Transfer Descriptor Offsets (4.3.2) */ - -struct ohci_itd_s -{ - volatile uint32_t ctrl; /* TD status/control bits */ - volatile uint32_t bp0; /* Buffer page 0 (BP0 */ - volatile uint32_t nexttd; /* Next TD (NextTD) */ - volatile uint32_t be; /* Buffer End (BE) */ - volatile uint16_t psw[ITD_NPSW]; /* Offset/PSW */ -}; - -/* Host Controller Communications Area Format (4.4.1) */ - -struct ohci_hcca_s -{ - /* HccaInterrruptTable: 32x32-bit pointers to interrupt EDs */ - - volatile uint32_t inttbl[HCCA_INTTBL_WSIZE]; - - /* HccaFrameNumber: Current frame number and - * HccaPad1: Zero when frame no. updated - */ - - volatile uint16_t fmno; - volatile uint16_t pad1; - - /* HccaDoneHead: When the HC reaches the end of a frame and its deferred - * interrupt register is 0, it writes the current value of its HcDoneHead to - * this location and generates an interrupt. - */ - - volatile uint32_t donehead; - volatile uint8_t reserved[HCCA_RESERVED_BSIZE]; - volatile uint32_t extra; -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_USB_OHCI_H */ diff --git a/nuttx/include/nuttx/usb/pl2303.h b/nuttx/include/nuttx/usb/pl2303.h deleted file mode 100644 index 4e755d10d..000000000 --- a/nuttx/include/nuttx/usb/pl2303.h +++ /dev/null @@ -1,91 +0,0 @@ -/************************************************************************************ - * include/nuttx/usb/pl2303.h - * - * Copyright (C) 2008-2010, 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * NOTE: This interface was inspired by the Linux gadget interface by - * David Brownell. That work was very helpful in determining a usable - * partitioning of functionality between standard class drivers and various - * implementations of USB controller drivers. This work, however, does - * not derive directly from that work and is licensed differently. - * - * 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_NUTTX_USB_PL2303_H -#define _INCLUDE_NUTTX_USB_PL2303_H - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include - -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - -/************************************************************************************ - * Public Types - ************************************************************************************/ - - /************************************************************************************ - * Public Data - ************************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -# define EXTERN extern "C" -extern "C" -{ -#else -# define EXTERN extern -#endif - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -/************************************************************************************ - * Name: usbdev_serialinit - * - * Description: - * Register PL2303 USB serial port (and USB serial console if so configured). - * - ************************************************************************************/ - -EXTERN int usbdev_serialinitialize(int minor); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* _INCLUDE_NUTTX_USB_PL2303_H */ diff --git a/nuttx/include/nuttx/usb/storage.h b/nuttx/include/nuttx/usb/storage.h deleted file mode 100644 index 4c4bf0066..000000000 --- a/nuttx/include/nuttx/usb/storage.h +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************************ - * include/nuttx/usb/storage.h - * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * References: - * "Universal Serial Bus Mass Storage Class, Specification Overview," - * Revision 1.2, USB Implementer's Forum, June 23, 2003. - * - * "Universal Serial Bus Mass Storage Class, Bulk-Only Transport," - * Revision 1.0, USB Implementer's Forum, September 31, 1999. - * - * 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_NUTTX_USB_STORAGE_H -#define __INCLUDE_NUTTX_USB_STORAGE_H - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include -#include - -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - -/* Mass storage requests */ - -#define USBMSC_TYPE_SETUPIN (USB_DIR_IN|USB_REQ_TYPE_CLASS|USB_REQ_RECIPIENT_INTERFACE) -#define USBMSC_TYPE_SETUPOUT (USB_DIR_OUT|USB_REQ_TYPE_CLASS|USB_REQ_RECIPIENT_INTERFACE) - -#define USBMSC_REQ_MSRESET (0xff) /* Reset mass storage device and interface */ -#define USBMSC_REQ_GETMAXLUN (0xfe) /* Return number LUNs supported */ - -/* Mass storage subclass codes */ - -#define USBMSC_SUBCLASS_RBC (0x01) /* Reduced block commands (e.g., flash devices) */ -#define USBMSC_SUBCLASS_SFF1 (0x02) /* SFF-8020i/MMC-2 (ATAPI) (e.g., C/DVD) */ -#define USBMSC_SUBCLASS_QIC (0x03) /* QIC-157 (e.g., tape device) */ -#define USBMSC_SUBCLASS_UFI (0x04) /* e.g. floppy device */ -#define USBMSC_SUBCLASS_SFF2 (0x05) /* SFF-8070i (e.g. floppy disk) */ -#define USBMSC_SUBCLASS_SCSI (0x06) /* SCSI transparent */ - -/* Mass storage transport protocols */ - -#define USBMSC_PROTO_CBI0 (0x00) /* CBI transport with command completion interrupt */ -#define USBMSC_PROTO_CBI1 (0x01) /* CBI transport without command completion interrupt */ -#define USBMSC_PROTO_BULKONLY (0x50) /* Bulk only transport */ - -/* Common Block Wrapper (CBW) */ - -#define USBMSC_CBW_SIZEOF (31) -#define USBMSC_CBW_SIGNATURE (0x43425355) /* Little endian USBC */ -#define USBMSC_CBWFLAG_IN (0x80) /* Bit 7=1: Direction = IN */ - -#define USBMSC_MAXCDBLEN (16) /* Max length of SCSI Command Data Block */ - -/* Command Status Wrapper (CSW) */ - -#define USBMSC_CSW_SIZEOF (13) -#define USBMSC_CSW_SIGNATURE (0x53425355) /* Little endian 'USBS' */ -#define USBMSC_CSWSTATUS_PASS (0) -#define USBMSC_CSWSTATUS_FAIL (1) -#define USBMSC_CSWSTATUS_PHASEERROR (2) - -/************************************************************************************ - * Public Types - ************************************************************************************/ - -/* Command Block Wrapper (CBW) */ - -struct usbmsc_cbw_s -{ - uint8_t signature[4]; /* 'USBC' = 0x43425355 */ - uint8_t tag[4]; /* Depends on command id */ - uint8_t datlen[4]; /* Number of bytes that host expects to transfer */ - uint8_t flags; /* Bit 7: Direction=IN (other obsolete or reserved) */ - uint8_t lun; /* LUN (normally 0) */ - uint8_t cdblen; /* len of cdb[] */ - uint8_t cdb[USBMSC_MAXCDBLEN]; /* Command Data Block */ -}; - -/* Command Status Wrapper (CSW) */ - -struct usbmsc_csw_s -{ - uint8_t signature[4]; /* 'USBS' = 0x53425355 */ - uint8_t tag[4]; /* Same tag as original command */ - uint8_t residue[4]; /* Amount not transferred */ - uint8_t status; /* Status of transfer */ -}; - -/************************************************************************************ - * Public Data - ************************************************************************************/ - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -#endif /* __INCLUDE_NUTTX_USB_STORAGE_H */ diff --git a/nuttx/include/nuttx/usb/usb.h b/nuttx/include/nuttx/usb/usb.h deleted file mode 100644 index 74b1f6a95..000000000 --- a/nuttx/include/nuttx/usb/usb.h +++ /dev/null @@ -1,416 +0,0 @@ -/************************************************************************************ - * include/nuttx/usb/usb.h - * - * Copyright (C) 2008, 2009-2010, 2012 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_NUTTX_USB_USB_H -#define __INCLUDE_NUTTX_USB_USB_H - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include - -#include - -/************************************************************************************ - * Preprocessor Definitions - ************************************************************************************/ -/* A packet identifier (PID) immediately follows the SYNC field of every USB packet. - * A PID consists of a four-bit packet type field followed by a four-bit check field - * USB Tokens (See Table 8-1 in the USB specification) - */ - -#define USB_PID_OUT_TOKEN (0x01) /* Tokens */ -#define USB_PID_IN_TOKEN (0x09) -#define USB_PID_SOF_TOKEN (0x05) -#define USB_PID_SETUP_TOKEN (0x0d) - -#define USB_PID_DATA0 (0x03) /* Data */ -#define USB_PID_DATA1 (0x0b) -#define USB_PID_DATA2 (0x07) -#define USB_PID_MDATA (0x0f) - -#define USB_PID_ACK (0x02) /* Handshake */ -#define USB_PID_NAK (0x0a) -#define USB_PID_STALL (0x0e) -#define USB_PID_NYET (0x06) - -#define USB_PID_PRE_TOKEN (0x0c) /* Special */ -#define USB_PID_ERR (0x0c) -#define USB_PID_SPLIT_TOKEN (0x08) -#define USB_PID_PING_TOKEN (0x04) -#define USB_PID_RESERVED (0x00) - -/* All 16-bit values must be little-endian */ - -#define MSBYTE(u16) ((u16) >> 8) /* Get MS byte from uint16_t */ -#define LSBYTE(u16) ((u16) & 0xff) /* Get LS byte from uint16_t */ - -#define GETUINT16(p) (((uint16_t)p[1]<<8)|(uint16_t)p[0]) -#define GETUINT32(p) (((uint32_t)p[3]<<24)|((uint32_t)p[2]<<16)|\ - ((uint32_t)p[1]<<8)|(uint32_t)p[0]) - -/* USB directions (in endpoint addresses) */ - -#define USB_DIR_MASK (0x80) -#define USB_EPNO_MASK (0x7f) -#define USB_DIR_OUT (0x00) /* host-to-device */ -#define USB_DIR_IN (0x80) /* device-to-host */ - -#define USB_EPNO(addr) ((addr) & USB_EPNO_MASK) -#define USB_EPOUT(addr) ((addr) | USB_DIR_OUT) -#define USB_EPIN(addr) ((addr) | USB_DIR_IN) -#define USB_ISEPIN(addr) (((addr) & USB_DIR_MASK) == USB_DIR_IN) -#define USB_ISEPOUT(addr) (((addr) & USB_DIR_MASK) == USB_DIR_OUT) - -/* Control Setup Packet. Byte 0 = Request type */ - -#define USB_REQ_DIR_MASK (1 << 7) /* Bit 7=1: Direction bit */ -#define USB_REQ_DIR_IN (1 << 7) /* Bit 7=1: Device-to-host */ -#define USB_REQ_DIR_OUT (0 << 7) /* Bit 7=0: Host-to-device */ - -#define USB_REQ_ISIN(type) (((type) & USB_REQ_DIR_MASK) != 0) -#define USB_REQ_ISOUT(type) (((type) & USB_REQ_DIR_MASK) == 0) - -#define USB_REQ_TYPE_SHIFT (5) /* Bits 5:6: Request type */ -# define USB_REQ_TYPE_MASK (3 << USB_REQ_TYPE_SHIFT) -# define USB_REQ_TYPE_STANDARD (0 << USB_REQ_TYPE_SHIFT) -# define USB_REQ_TYPE_CLASS (1 << USB_REQ_TYPE_SHIFT) -# define USB_REQ_TYPE_VENDOR (2 << USB_REQ_TYPE_SHIFT) - -#define USB_REQ_RECIPIENT_SHIFT (0) /* Bits 0:4: Recipient */ -#define USB_REQ_RECIPIENT_MASK (0x1f << USB_REQ_RECIPIENT_SHIFT) -# define USB_REQ_RECIPIENT_DEVICE (0 << USB_REQ_RECIPIENT_SHIFT) -# define USB_REQ_RECIPIENT_INTERFACE (1 << USB_REQ_RECIPIENT_SHIFT) -# define USB_REQ_RECIPIENT_ENDPOINT (2 << USB_REQ_RECIPIENT_SHIFT) -# define USB_REQ_RECIPIENT_OTHER (3 << USB_REQ_RECIPIENT_SHIFT) - -/* Control Setup Packet. Byte 1 = Standard Request Codes */ - -#define USB_REQ_GETSTATUS (0x00) -#define USB_REQ_CLEARFEATURE (0x01) -#define USB_REQ_SETFEATURE (0x03) -#define USB_REQ_SETADDRESS (0x05) -#define USB_REQ_GETDESCRIPTOR (0x06) -#define USB_REQ_SETDESCRIPTOR (0x07) -#define USB_REQ_GETCONFIGURATION (0x08) -#define USB_REQ_SETCONFIGURATION (0x09) -#define USB_REQ_GETINTERFACE (0x0a) -#define USB_REQ_SETINTERFACE (0x0b) -#define USB_REQ_SYNCHFRAME (0x0c) - -#define USB_REQ_SETENCRYPTION (0x0d) /* Wireless USB */ -#define USB_REQ_GETENCRYPTION (0x0e) -#define USB_REQ_SETHANDSHAKE (0x0f) -#define USB_REQ_GETHANDSHAKE (0x10) -#define USB_REQ_SETCONNECTION (0x11) -#define USB_REQ_SETSECURITYDATA (0x12) -#define USB_REQ_GETSECURITYDATA (0x13) -#define USB_REQ_SETWUSBDATA (0x14) -#define USB_REQ_LOOPBACKDATAWRITE (0x15) -#define USB_REQ_LOOPBACKDATAREAD (0x16) -#define USB_REQ_SETINTERFACEDS (0x17) - -/* USB feature values */ - -#define USB_FEATURE_ENDPOINTHALT 0 -#define USB_FEATURE_SELFPOWERED 0 -#define USB_FEATURE_REMOTEWAKEUP 1 -#define USB_FEATURE_TESTMODE 2 -#define USB_FEATURE_BATTERY 2 -#define USB_FEATURE_BHNPENABLE 3 -#define USB_FEATURE_WUSBDEVICE 3 -#define USB_FEATURE_AHNPSUPPORT 4 -#define USB_FEATURE_AALTHNPSUPPORT 5 -#define USB_FEATURE_DEBUGMODE 6 - -/* Generic descriptor header offsets */ - -#define USB_DESC_DESCLENOFFSET 0 -#define USB_DESC_DESCTYPEOFFSET 1 - -/* Descriptor types */ - -#define USB_DESC_TYPE_DEVICE (0x01) -#define USB_DESC_TYPE_CONFIG (0x02) -#define USB_DESC_TYPE_STRING (0x03) -#define USB_DESC_TYPE_INTERFACE (0x04) -#define USB_DESC_TYPE_ENDPOINT (0x05) -#define USB_DESC_TYPE_DEVICEQUALIFIER (0x06) -#define USB_DESC_TYPE_OTHERSPEEDCONFIG (0x07) -#define USB_DESC_TYPE_INTERFACEPOWER (0x08) -#define USB_DESC_TYPE_OTG (0x09) -#define USB_DESC_TYPE_DEBUG (0x0a) -#define USB_DESC_TYPE_INTERFACEASSOCIATION (0x0b) -#define USB_DESC_TYPE_SECURITY (0x0c) -#define USB_DESC_TYPE_KEY (0x0d) -#define USB_DESC_TYPE_ENCRYPTION_TYPE (0x0e) -#define USB_DESC_TYPE_BOS (0x0f) -#define USB_DESC_TYPE_DEVICECAPABILITY (0x10) -#define USB_DESC_TYPE_WIRELESS_ENDPOINTCOMP (0x11) -#define USB_DESC_TYPE_CSDEVICE (0x21) -#define USB_DESC_TYPE_CSCONFIG (0x22) -#define USB_DESC_TYPE_CSSTRING (0x23) -#define USB_DESC_TYPE_CSINTERFACE (0x24) -#define USB_DESC_TYPE_CSENDPOINT (0x25) - -/* Device and interface descriptor class codes */ - -#define USB_CLASS_PER_INTERFACE (0x00) -#define USB_CLASS_AUDIO (0x01) -#define USB_CLASS_CDC (0x02) -#define USB_CLASS_HID (0x03) -#define USB_CLASS_PHYSICAL (0x05) -#define USB_CLASS_STILL_IMAGE (0x06) -#define USB_CLASS_PRINTER (0x07) -#define USB_CLASS_MASS_STORAGE (0x08) -#define USB_CLASS_HUB (0x09) -#define USB_CLASS_CDC_DATA (0x0a) -#define USB_CLASS_CSCID (0x0b) -#define USB_CLASS_CONTENT_SEC (0x0d) -#define USB_CLASS_VIDEO (0x0e) -#define USB_CLASS_WIRELESS_CONTROLLER (0xe0) -#define USB_CLASS_MISC (0xef) -#define USB_CLASS_APP_SPEC (0xfe) -#define USB_CLASS_VENDOR_SPEC (0xff) - -/* Values for configuration descriptor attributes */ - -#define USB_CONFIG_ATTR_BATTERY (0x10) /* Battery powered */ -#define USB_CONFIG_ATTR_WAKEUP (0x20) /* Remote wakeup */ -#define USB_CONFIG_ATTR_SELFPOWER (0x40) /* Self-powered */ -#define USB_CONFIG_ATTR_ONE (0x80) /* Must be one */ - -/* Endpoint descriptor address */ - -#define USB_EP_ADDR_NUMBER_MASK (0x0f) -#define USB_EP_ADDR_DIR_MASK (0x80) - -/* Endpoint descriptor attributes */ - -#define USB_EP_ATTR_XFERTYPE_SHIFT (0) -#define USB_EP_ATTR_XFERTYPE_MASK (3 << USB_EP_ATTR_XFERTYPE_SHIFT) -# define USB_EP_ATTR_XFER_CONTROL (0 << USB_EP_ATTR_XFERTYPE_SHIFT) -# define USB_EP_ATTR_XFER_ISOC (1 << USB_EP_ATTR_XFERTYPE_SHIFT) -# define USB_EP_ATTR_XFER_BULK (2 << USB_EP_ATTR_XFERTYPE_SHIFT) -# define USB_EP_ATTR_XFER_INT (3 << USB_EP_ATTR_XFERTYPE_SHIFT) -#define USB_EP_ATTR_SYNC_SHIFT (2) -#define USB_EP_ATTR_SYNC_MASK (3 << USB_EP_ATTR_SYNC_SHIFT) -# define USB_EP_ATTR_NO_SYNC (0 << USB_EP_ATTR_SYNC_SHIFT) -# define USB_EP_ATTR_ASYNC (1 << USB_EP_ATTR_SYNC_SHIFT) -# define USB_EP_ATTR_ADAPTIVE (2 << USB_EP_ATTR_SYNC_SHIFT) -# define USB_EP_ATTR_SYNC (3 << USB_EP_ATTR_SYNC_SHIFT) -#define USB_EP_ATTR_USAGE_SHIFT (4) -#define USB_EP_ATTR_USAGE_MASK (3 << USB_EP_ATTR_USAGE_SHIFT) -# define USB_EP_ATTR_USAGE_DATA (0 << USB_EP_ATTR_USAGE_SHIFT) -# define USB_EP_ATTR_USAGE_FEEDBACK (1 << USB_EP_ATTR_USAGE_SHIFT) -# define USB_EP_ATTR_USAGE_IMPLICIT (2 << USB_EP_ATTR_USAGE_SHIFT) -#define USB_EP_ATTR_MAX_ADJUSTABLE (1 << 7) - -/* OTG Definitions */ - -/* OTG SET FEATURE Constants */ - -#define USBOTG_FEATURE_B_HNP_ENABLE 3 /* Enable B device to perform HNP */ -#define USBOTG_FEATURE_A_HNP_SUPPORT 4 /* A device supports HNP */ -#define USBOTG_FEATURE_A_ALT_HNP_SUPPORT 5 /* Another port on the A device supports HNP */ - -/************************************************************************************ - * Public Types - ************************************************************************************/ - -/* This structure is used to send control requests to a USB device. */ - -struct usb_ctrlreq_s -{ - uint8_t type; /* Matches request type */ - uint8_t req; /* Matches request field */ - uint8_t value[2]; - uint8_t index[2]; - uint8_t len[2]; -}; -#define USB_SIZEOF_CTRLREQ 8 - -/* Generic descriptor */ - -struct usb_desc_s -{ - uint8_t len; /* Descriptor length */ - uint8_t type; /* Descriptor type */ -}; - -/* Device descriptor */ - -struct usb_devdesc_s -{ - uint8_t len; /* Descriptor length */ - uint8_t type; /* Descriptor type */ - uint8_t usb[2]; /* USB version */ - uint8_t classid; /* Device class */ - uint8_t subclass; /* Device sub-class */ - uint8_t protocol; /* Device protocol */ - uint8_t mxpacketsize; /* Max packet size (ep0) */ - uint8_t vendor[2]; /* Vendor ID */ - uint8_t product[2]; /* Product ID */ - uint8_t device[2]; /* Device ID */ - uint8_t imfgr; /* Manufacturer */ - uint8_t iproduct; /* Product */ - uint8_t serno; /* Serial number */ - uint8_t nconfigs; /* Number of configurations */ -}; -#define USB_SIZEOF_DEVDESC 18 - -/* Configuration descriptor */ - -struct usb_cfgdesc_s -{ - uint8_t len; /* Descriptor length */ - uint8_t type; /* Descriptor type */ - uint8_t totallen[2]; /* Total length */ - uint8_t ninterfaces; /* Number of interfaces */ - uint8_t cfgvalue; /* Configuration value */ - uint8_t icfg; /* Configuration */ - uint8_t attr; /* Attributes */ - uint8_t mxpower; /* Max power (mA/2) */ -}; -#define USB_SIZEOF_CFGDESC 9 - -struct usb_otherspeedconfigdesc_s -{ - uint8_t len; /* Descriptor length */ - uint8_t type; /* Descriptor type */ - uint8_t totallen[2]; /* Total length */ - uint8_t ninterfaces; /* Number of interfaces */ - uint8_t cfgvalue; /* Configuration value */ - uint8_t icfg; /* Configuration */ - uint8_t attr; /* Attributes */ - uint8_t mxpower; /* Max power (mA/2) */ -}; -#define USB_SIZEOF_OTHERSPEEDCONFIGDESC 9 - -/* String descriptor */ - -struct usb_strdesc_s -{ - uint8_t len; /* Descriptor length */ - uint8_t type; /* Descriptor type */ - uint8_t data[2]; -}; - -/* Interface descriptor */ - -struct usb_ifdesc_s -{ - uint8_t len; /* Descriptor length */ - uint8_t type; /* Descriptor type */ - uint8_t ifno; /* Interface number */ - uint8_t alt; /* Alternate setting */ - uint8_t neps; /* Number of endpoints */ - uint8_t classid; /* Interface class */ - uint8_t subclass; /* Interface sub-class */ - uint8_t protocol; /* Interface protocol */ - uint8_t iif; /* iInterface */ -}; -#define USB_SIZEOF_IFDESC 9 - -/* Endpoint descriptor */ - -struct usb_epdesc_s -{ - uint8_t len; /* Descriptor length */ - uint8_t type; /* Descriptor type */ - uint8_t addr; /* Endpoint address */ - uint8_t attr; /* Endpoint attributes */ - uint8_t mxpacketsize[2]; /* Maximum packet size */ - uint8_t interval; /* Interval */ -}; -#define USB_SIZEOF_EPDESC 7 - -struct usb_audioepdesc_s -{ - struct usb_epdesc_s ep; - uint8_t refresh; - uint8_t synchaddr; -}; -#define USB_SIZEOF_AUDIOEPDESC 9 - -/* Device qualifier descriptor */ - -struct usb_qualdesc_s -{ - uint8_t len; /* Descriptor length */ - uint8_t type; /* Descriptor type */ - uint8_t usb[2]; /* USB version */ - uint8_t classid; /* Qualifier class */ - uint8_t subclass; /* Qualifier sub-class */ - uint8_t protocol; /* Qualifier protocol */ - uint8_t mxpacketsize; /* Max packet size (ep0) */ - uint8_t nconfigs; /* Number of configurations */ - uint8_t reserved; -}; -#define USB_SIZEOF_QUALDESC 10 - -/* Interface association descriptor - * - * The Universal Serial Bus Specification, revision 2.0, does not support grouping - * more than one interface of a composite device within a single function. However, - * the USB Device Working Group (DWG) created USB device classes that allow for - * functions with multiple interfaces, and the USB Implementor's Forum issued an - * Engineering Change Notification (ECN) that defines a mechanism for grouping - * interfaces. - */ - -struct usb_iaddesc_s -{ - uint8_t len; /* Descriptor length */ - uint8_t type; /* Descriptor type */ - uint8_t firstif; /* Number of first interface of the function */ - uint8_t nifs; /* Number of interfaces associated with the function */ - uint8_t classid; /* Class code */ - uint8_t subclass; /* Sub-class code */ - uint8_t protocol; /* Protocol code */ - uint8_t ifunction; /* Index to string identifying the function */ -}; -#define USB_SIZEOF_IADDESC 8 - -/************************************************************************************ - * Public Data - ************************************************************************************/ - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -#endif // __INCLUDE_NUTTX_USB_USB_H diff --git a/nuttx/include/nuttx/usb/usbdev.h b/nuttx/include/nuttx/usb/usbdev.h deleted file mode 100644 index 1270fe13a..000000000 --- a/nuttx/include/nuttx/usb/usbdev.h +++ /dev/null @@ -1,393 +0,0 @@ -/************************************************************************************ - * include/nuttx/usb/usbdev.h - * - * Copyright (C) 2008-2010, 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * NOTE: This interface was inspired by the Linux gadget interface by - * David Brownell. That work was very helpful in determining a usable - * partitioning of functionality between standard class drivers and various - * implementations of USB controller drivers. This work, however, does - * not derive directly from that work and is licensed differently. - * - * 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_NUTTX_USB_USBDEV_H -#define _INCLUDE_NUTTX_USB_USBDEV_H - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include - -#include -#include -#include - -#include -#include -#include -#include - -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - -/* Endpoint helpers *****************************************************************/ - -/* Configure endpoint, making it usable. The class driver may deallocate or re-use - * the 'desc' structure after returning: - * - * ep - the struct usbdev_ep_s instance obtained from allocep() - * desc - A struct usb_epdesc_s instance describing the endpoint - * last - true if this this last endpoint to be configured. Some hardware needs - * to take special action when all of the endpoints have been configured. - */ - -#define EP_CONFIGURE(ep,desc,last) (ep)->ops->configure(ep,desc,last) - -/* The endpoint will no longer be used */ - -#define EP_DISABLE(ep) (ep)->ops->disable(ep) - -/* Allocate/free I/O requests. Should not be called from interrupt processing! */ - -#define EP_ALLOCREQ(ep) (ep)->ops->allocreq(ep) -#define EP_FREEREQ(ep,req) (ep)->ops->freereq(ep,req) - -/* Allocate/free an I/O buffer. Should not be called from interrupt processing! */ - -#ifdef CONFIG_USBDEV_DMA -# define EP_ALLOCBUFFER(ep,nb) (ep)->ops->alloc(ep,nb) -# define EP_FREEBUFFER(ep,buff) (ep)->ops->free(ep,buf) -#else -# define EP_ALLOCBUFFER(ep,nb) malloc(nb) -# define EP_FREEBUFFER(ep,buf) free(buf) -#endif - -/* Submit an I/O request to the endpoint */ - -#define EP_SUBMIT(ep,req) (ep)->ops->submit(ep,req) - -/* Cancel an I/O request previously sent to an endpoint */ - -#define EP_CANCEL(ep,req) (ep)->ops->cancel(ep,req) - -/* Stall or resume an endpoint */ - -#define EP_STALL(ep) (ep)->ops->stall(ep,false) -#define EP_RESUME(ep) (ep)->ops->stall(ep,true) - -/* USB Device Driver Helpers ********************************************************/ - -/* Allocate an endpoint: - * - * ep - 7-bit logical endpoint number (direction bit ignored). Zero means - * that any endpoint matching the other requirements will suffice. The - * assigned endpoint can be found in the eplog field. - * in - true: IN (device-to-host) endpoint requested - * eptype - Endpoint type. One of {USB_EP_ATTR_XFER_ISOC, USB_EP_ATTR_XFER_BULK, - * USB_EP_ATTR_XFER_INT} - */ - -#define DEV_ALLOCEP(dev,ep,in,type) (dev)->ops->allocep(dev,ep,in,type) - -/* Release an endpoint */ - -#define DEV_FREEEP(dev,ep) (dev)->ops->freeep(dev,ep) - -/* Returns the current frame number */ - -#define DEV_GETFRAME(dev) (dev)->ops->getframe(dev) - -/* Tries to wake up the host connected to this device */ - -#define DEV_WAKEUP(dev) (dev)->ops->wakeup(dev) - -/* Sets the device selfpowered feature */ - -#define DEV_SETSELFPOWERED(dev) (dev)->ops->selfpowered(dev,true) - -/* Clears the device selfpowered feature */ - -#define DEV_CLRSELFPOWERED(dev) (dev)->ops->selfpowered(dev, false) - -/* Software-controlled connect to USB host. All USB class drivers need to call - * DEV_CONNECT() when they are ready to be enumerated. That is, (1) initially when - * bound to the USB driver, and (2) after a USB reset. - */ - -#define DEV_CONNECT(dev) (dev)->ops->pullup ? (dev)->ops->pullup(dev,true) : -EOPNOTSUPP - -/* Software-controlled disconnect from USB host */ - -#define DEV_DISCONNECT(dev) (dev)->ops->pullup ? (dev)->ops->pullup(dev,false) : -EOPNOTSUPP - -/* USB Class Driver Helpers *********************************************************/ -/* All may be called from interupt handling logic except bind() and unbind() */ - -/* Invoked when the driver is bound to a USB device driver. */ - -#define CLASS_BIND(drvr,dev) (drvr)->ops->bind(drvr,dev) - -/* Invoked when the driver is unbound from a USB device driver */ - -#define CLASS_UNBIND(drvr,dev) (drvr)->ops->unbind(drvr,dev) - -/* Invoked after all transfers have been stopped, when the host is disconnected. */ - -#define CLASS_DISCONNECT(drvr,dev) (drvr)->ops->disconnect(drvr,dev) - -/* Invoked for ep0 control requests */ - -#define CLASS_SETUP(drvr,dev,ctrl,dataout,outlen) \ - (drvr)->ops->setup(drvr,dev,ctrl,dataout,outlen) - -/* Invoked on USB suspend. */ - -#define CLASS_SUSPEND(drvr,dev) \ - do { if ((drvr)->ops->suspend) (drvr)->ops->suspend(drvr,dev); } while (0) - -/* Invoked on USB resume */ - -#define CLASS_RESUME(drvr,dev) \ - do { if ((drvr)->ops->resume) (drvr)->ops->resume(drvr,dev); } while (0) - -/* Device speeds */ - -#define USB_SPEED_UNKNOWN 0 /* Transfer rate not yet set */ -#define USB_SPEED_LOW 1 /* USB 1.1 */ -#define USB_SPEED_FULL 2 /* USB 1.1 */ -#define USB_SPEED_HIGH 3 /* USB 2.0 */ -#define USB_SPEED_VARIABLE 4 /* Wireless USB 2.5 */ - -/* Request flags */ - -#define USBDEV_REQFLAGS_NULLPKT 1 /* Bit 0: Terminate w/short packet; null packet if necessary */ - /* Bits 1-7: Available */ - -/************************************************************************************ - * Public Types - ************************************************************************************/ - -/* USB Controller Structures ********************************************************/ - -/* struct usbdev_req_s - describes one i/o request */ - -struct usbdev_ep_s; -struct usbdev_req_s -{ - uint8_t *buf; /* Call: Buffer used for data; Return: Unchanged */ - uint8_t flags; /* See USBDEV_REQFLAGS_* definitions */ - uint16_t len; /* Call: Total length of data in buf; Return: Unchanged */ - uint16_t xfrd; /* Call: zero; Return: Bytes transferred so far */ - int16_t result; /* Call: zero; Return: Result of transfer (O or -errno) */ - - /* Callback when the transfer completes */ - - void (*callback)(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req); - void *priv; /* Used only by callee */ -}; - -/* Endpoint-specific interface to USB controller hardware. */ - -struct usbdev_epops_s -{ - /* Configure/enable and disable endpoint */ - - int (*configure)(FAR struct usbdev_ep_s *ep, FAR const struct usb_epdesc_s *desc, - bool last); - int (*disable)(FAR struct usbdev_ep_s *ep); - - /* Allocate and free I/O requests */ - - FAR struct usbdev_req_s *(*allocreq)(FAR struct usbdev_ep_s *ep); - void (*freereq)(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req); - - /* Allocate and free I/O buffers */ - -#ifdef CONFIG_USBDEV_DMA - FAR void *(*allocbuffer)(FAR struct usbdev_ep_s *ep, uint16_t nbytes); - void (*freebuffer)(FAR struct usbdev_ep_s *ep, FAR void *buf); -#endif - - /* Submit and cancel I/O requests */ - - int (*submit)(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req); - int (*cancel)(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req); - - /* Stall or resume an endpoint */ - - int (*stall)(FAR struct usbdev_ep_s *ep, bool resume); -}; - -/* Representation of one USB endpoint */ - -struct usbdev_ep_s -{ - const struct usbdev_epops_s *ops; /* Endpoint operations */ - uint8_t eplog; /* Logical endpoint address */ - uint16_t maxpacket; /* Maximum packet size for this endpoint */ - void *priv; /* For use by class driver */ -}; - -/* struct usbdev_s represents a usb device */ - -struct usbdev_s; -struct usbdev_ops_s -{ - /* Allocate and free endpoints */ - - FAR struct usbdev_ep_s *(*allocep)(FAR struct usbdev_s *dev, uint8_t epphy, - bool in, uint8_t eptype); - void (*freeep)(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep); - - /* Get the frame number from the last SOF */ - - int (*getframe)(FAR struct usbdev_s *dev); - - /* Hardware specific features */ - - int (*wakeup)(FAR struct usbdev_s *dev); - int (*selfpowered)(FAR struct usbdev_s *dev, bool selfpowered); - int (*pullup)(FAR struct usbdev_s *dev, bool enable); - - /* Device-specific I/O command support */ - - int (*ioctl)(FAR struct usbdev_s *dev, unsigned code, unsigned long param); -}; - -struct usbdev_s -{ - const struct usbdev_ops_s *ops; /* Access to hardware specific features */ - struct usbdev_ep_s *ep0; /* Endpoint zero */ - uint8_t speed; /* Current speed of the host connection */ - uint8_t dualspeed:1; /* 1:supports high and full speed operation */ -}; - -/* USB Device Class Implementations *************************************************/ - -struct usbdevclass_driver_s; -struct usbdevclass_driverops_s -{ - int (*bind)(FAR struct usbdevclass_driver_s *driver, FAR struct usbdev_s *dev); - void (*unbind)(FAR struct usbdevclass_driver_s *driver, FAR struct usbdev_s *dev); - int (*setup)(FAR struct usbdevclass_driver_s *driver, FAR struct usbdev_s *dev, - FAR const struct usb_ctrlreq_s *ctrl, FAR uint8_t *dataout, size_t outlen); - void (*disconnect)(FAR struct usbdevclass_driver_s *driver, - FAR struct usbdev_s *dev); - void (*suspend)(FAR struct usbdevclass_driver_s *driver, FAR struct usbdev_s *dev); - void (*resume)(FAR struct usbdevclass_driver_s *driver, FAR struct usbdev_s *dev); -}; - -struct usbdevclass_driver_s -{ - const struct usbdevclass_driverops_s *ops; - uint8_t speed; /* Highest speed that the driver handles */ -}; - -/************************************************************************************ - * Public Data - ************************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -# define EXTERN extern "C" -extern "C" -{ -#else -# define EXTERN extern -#endif - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -/************************************************************************************ - * Name: usbdevclass_register - * - * Description: - * Register a USB device class driver. The class driver's bind() method will be - * called to bind it to a USB device driver. - * - ************************************************************************************/ - -EXTERN int usbdev_register(FAR struct usbdevclass_driver_s *driver); - -/************************************************************************************ - * Name: usbdev_unregister - * - * Description: - * Un-register usbdev class driver.If the USB device is connected to a USB host, - * it will first disconnect(). The driver is also requested to unbind() and clean - * up any device state, before this procedure finally returns. - * - ************************************************************************************/ - -EXTERN int usbdev_unregister(FAR struct usbdevclass_driver_s *driver); - -/**************************************************************************** - * Name: usbdev_dma_alloc and usbdev_dma_free - * - * Description: - * The USB class driver allocates packet I/O buffers for data transfer by - * calling the driver allocbuffer() and freebuffer() methods. Those - * methods are only available if CONFIG_USBDEV_DMA is defined in the - * system configuration. - * - * If CONFIG_USBDEV_DMAMEMORY is also defined in the NuttX configuration, - * then the driver implementations of the allocbuffer() and freebuffer() - * methods may use board-specific usbdev_dma_alloc() and usbdev_dma_free(). - * If CONFIG_USBDEV_DMA and CONFIG_USBDEV_DMAMEMORY are both defined, - * then the board-specific logic must provide the functions - * usbdev_dma_alloc() and usbdev_dma_free() as prototyped below: - * usbdev_dma_alloc() will allocate DMA-capable memory of the specified - * size; usbdev_dma_free() is the corresponding function that will be - * called to free the DMA-capable memory. - * - * This functions may be simple wrappers around gran_alloc() and - * gran_free() (See nuttx/gran.h). Note that the gran_free() function - * does require the size of the allocation to be freed; that would need - * to be managed in the board-specific logic. - * - ****************************************************************************/ - -#if defined(CONFIG_USBDEV_DMA) && defined(CONFIG_USBDEV_DMAMEMORY) -EXTERN FAR void *usbdev_dma_alloc(size_t size); -EXTERN void usbdev_dma_free(FAR void *memory); -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* _INCLUDE_NUTTX_USB_USBDEV_H */ diff --git a/nuttx/include/nuttx/usb/usbdev_trace.h b/nuttx/include/nuttx/usb/usbdev_trace.h deleted file mode 100644 index 860f48983..000000000 --- a/nuttx/include/nuttx/usb/usbdev_trace.h +++ /dev/null @@ -1,500 +0,0 @@ -/**************************************************************************** - * include/nuttx/usb/usbdev_trace.h - * - * Copyright (C) 2008, 2009-2010, 2012 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_NUTTX_USB_USBDEV_TRACE_H -#define __INCLUDE_NUTTX_USB_USBDEV_TRACE_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include - -/**************************************************************************** - * Preprocessor definitions - ****************************************************************************/ - -/* Event encoding/decoding macros *******************************************/ - -#define TRACE_EVENT(id,data) ((uint16_t)(id)|(data)) -#define TRACE_ID(event) ((event)&0xff00) -#define TRACE_DATA(event) ((event)&0x00ff) - -/* Events ******************************************************************/ - -/* Event class IDs */ - -#define TRACE_INIT_ID (0x0000) /* Initialization events */ -#define TRACE_EP_ID (0x0100) /* Endpoint API calls */ -#define TRACE_DEV_ID (0x0200) /* USB device API calls */ -#define TRACE_CLASS_ID (0x0300) /* USB class driver API calls */ -#define TRACE_CLASSAPI_ID (0x0400) /* Other class driver system API calls */ -#define TRACE_CLASSSTATE_ID (0x0500) /* Track class driver state changes */ -#define TRACE_INTENTRY_ID (0x0600) /* Interrupt handler entry */ -#define TRACE_INTDECODE_ID (0x0700) /* Decoded interrupt event */ -#define TRACE_INTEXIT_ID (0x0800) /* Interrupt handler exit */ -#define TRACE_OUTREQQUEUED_ID (0x0900) /* Request queued for OUT endpoint */ -#define TRACE_INREQQUEUED_ID (0x0a00) /* Request queued for IN endpoint */ -#define TRACE_READ_ID (0x0b00) /* Read (OUT) action */ -#define TRACE_WRITE_ID (0x0c00) /* Write (IN) action */ -#define TRACE_COMPLETE_ID (0x0d00) /* Request completed */ -#define TRACE_DEVERROR_ID (0x0e00) /* USB controller driver error event */ -#define TRACE_CLSERROR_ID (0x0f00) /* USB class driver error event */ - -#define TRACE_NIDS 16 /* Cannot exceed bits in usbtrace_idset_t */ - -/* Bit settings for usbtrace_enable */ - -#define TRACE_ID2BIT(id) ((1) << ((id) >> 8)) -#define TRACE_INIT_BIT TRACE_ID2BIT(TRACE_INIT_ID) -#define TRACE_EP_BIT TRACE_ID2BIT(TRACE_EP_ID) -#define TRACE_DEV_BIT TRACE_ID2BIT(TRACE_DEV_ID) -#define TRACE_CLASS_BIT TRACE_ID2BIT(TRACE_CLASS_ID) -#define TRACE_CLASSAPI_BIT TRACE_ID2BIT(TRACE_CLASSAPI_ID) -#define TRACE_CLASSSTATE_BIT TRACE_ID2BIT(TRACE_CLASSSTATE_ID) -#define TRACE_INTENTRY_BIT TRACE_ID2BIT(TRACE_INTENTRY_ID) -#define TRACE_INTDECODE_BIT TRACE_ID2BIT(TRACE_INTDECODE_ID) -#define TRACE_INTEXIT_BIT TRACE_ID2BIT(TRACE_INTEXIT_ID) -#define TRACE_OUTREQQUEUED_BIT TRACE_ID2BIT(TRACE_OUTREQQUEUED_ID) -#define TRACE_INREQQUEUED_BIT TRACE_ID2BIT(TRACE_INREQQUEUED_ID) -#define TRACE_READ_BIT TRACE_ID2BIT(TRACE_READ_ID) -#define TRACE_WRITE_BIT TRACE_ID2BIT(TRACE_WRITE_ID) -#define TRACE_COMPLETE_BIT TRACE_ID2BIT(TRACE_COMPLETE_ID) -#define TRACE_DEVERROR_BIT TRACE_ID2BIT(TRACE_DEVERROR_ID) -#define TRACE_CLSERROR_BIT TRACE_ID2BIT(TRACE_CLSERROR_ID) -#define TRACE_ALLBITS ((usbtrace_idset_t)-1) - -/* Initialization events */ - -#define TRACE_DEVINIT TRACE_EVENT(TRACE_INIT_ID, 0x0001) -#define TRACE_DEVUNINIT TRACE_EVENT(TRACE_INIT_ID, 0x0002) -#define TRACE_DEVREGISTER TRACE_EVENT(TRACE_INIT_ID, 0x0003) -#define TRACE_DEVUNREGISTER TRACE_EVENT(TRACE_INIT_ID, 0x0004) -#define TRACE_DEVINIT_USER TRACE_EVENT(TRACE_INIT_ID, 0x0005) /* First user-defined */ - -/* API calls (see usbdev.h) */ - -#define TRACE_EPCONFIGURE TRACE_EVENT(TRACE_EP_ID, 0x0001) -#define TRACE_EPDISABLE TRACE_EVENT(TRACE_EP_ID, 0x0002) -#define TRACE_EPALLOCREQ TRACE_EVENT(TRACE_EP_ID, 0x0003) -#define TRACE_EPFREEREQ TRACE_EVENT(TRACE_EP_ID, 0x0004) -#define TRACE_EPALLOCBUFFER TRACE_EVENT(TRACE_EP_ID, 0x0005) -#define TRACE_EPFREEBUFFER TRACE_EVENT(TRACE_EP_ID, 0x0006) -#define TRACE_EPSUBMIT TRACE_EVENT(TRACE_EP_ID, 0x0007) -#define TRACE_EPCANCEL TRACE_EVENT(TRACE_EP_ID, 0x0008) -#define TRACE_EPSTALL TRACE_EVENT(TRACE_EP_ID, 0x0009) -#define TRACE_EPRESUME TRACE_EVENT(TRACE_EP_ID, 0x000a) -#define TRACE_EPAPI_USER TRACE_EVENT(TRACE_EP_ID, 0x000b) /* First user-defined */ - -#define TRACE_DEVALLOCEP TRACE_EVENT(TRACE_DEV_ID, 0x0001) -#define TRACE_DEVFREEEP TRACE_EVENT(TRACE_DEV_ID, 0x0002) -#define TRACE_DEVGETFRAME TRACE_EVENT(TRACE_DEV_ID, 0x0003) -#define TRACE_DEVWAKEUP TRACE_EVENT(TRACE_DEV_ID, 0x0004) -#define TRACE_DEVSELFPOWERED TRACE_EVENT(TRACE_DEV_ID, 0x0005) -#define TRACE_DEVPULLUP TRACE_EVENT(TRACE_DEV_ID, 0x0006) -#define TRACE_DEVAPI_USER TRACE_EVENT(TRACE_DEV_ID, 0x0007) /* First user-defined */ - -#define TRACE_CLASSBIND TRACE_EVENT(TRACE_CLASS_ID, 0x0001) -#define TRACE_CLASSUNBIND TRACE_EVENT(TRACE_CLASS_ID, 0x0002) -#define TRACE_CLASSDISCONNECT TRACE_EVENT(TRACE_CLASS_ID, 0x0003) -#define TRACE_CLASSSETUP TRACE_EVENT(TRACE_CLASS_ID, 0x0004) -#define TRACE_CLASSSUSPEND TRACE_EVENT(TRACE_CLASS_ID, 0x0005) -#define TRACE_CLASSRESUME TRACE_EVENT(TRACE_CLASS_ID, 0x0006) - -#define TRACE_CLASSRDCOMPLETE TRACE_EVENT(TRACE_CLASS_ID, 0x0007) -#define TRACE_CLASSWRCOMPLETE TRACE_EVENT(TRACE_CLASS_ID, 0x0008) - -#define TRACE_CLASSAPI_USER TRACE_EVENT(TRACE_CLASS_ID, 0x0009) /* First user-defined */ - -#define TRACE_CLASSAPI(id) TRACE_EVENT(TRACE_CLASSAPI_ID, id) - -#define TRACE_CLASSSTATE(id) TRACE_EVENT(TRACE_CLASSSTATE_ID, id) - -/* USB device controller interrupt events. The 'id' is specific to the driver. - * Particular values for 'id' are unique for a given implementation of a - * controller driver - */ - -#define TRACE_INTENTRY(id) TRACE_EVENT(TRACE_INTENTRY_ID, id) -#define TRACE_INTDECODE(id) TRACE_EVENT(TRACE_INTDECODE_ID, id) -#define TRACE_INTEXIT(id) TRACE_EVENT(TRACE_INTEXIT_ID, id) - -/* Controller data transfer */ - -#define TRACE_OUTREQQUEUED(ep) TRACE_EVENT(TRACE_OUTREQQUEUED_ID, ep) -#define TRACE_INREQQUEUED(ep) TRACE_EVENT(TRACE_INREQQUEUED_ID, ep) -#define TRACE_READ(ep) TRACE_EVENT(TRACE_READ_ID, ep) -#define TRACE_WRITE(ep) TRACE_EVENT(TRACE_WRITE_ID, ep) -#define TRACE_COMPLETE(ep) TRACE_EVENT(TRACE_COMPLETE_ID, ep) - -/* USB device controller error events. The 'id' is specific to the driver. - * Particular values for 'id' are unique for a given implementation of a - * controller driver - */ - -#define TRACE_DEVERROR(id) TRACE_EVENT(TRACE_DEVERROR_ID, id) - -/* USB class driver error events. The 'id' is specific to the class driver, - * but common to all driver controller instances. - */ - -#define TRACE_CLSERROR(id) TRACE_EVENT(TRACE_CLSERROR_ID, id) - -/* USB Serial driver class events *******************************************/ -/* Used by both the CDC/ACM and the PL2303 serial class drivers */ -/* UART interface API calls */ - -#define USBSER_TRACECLASSAPI_SETUP 0x0001 -#define USBSER_TRACECLASSAPI_SHUTDOWN 0x0002 -#define USBSER_TRACECLASSAPI_ATTACH 0x0003 -#define USBSER_TRACECLASSAPI_DETACH 0x0004 -#define USBSER_TRACECLASSAPI_IOCTL 0x0005 -#define USBSER_TRACECLASSAPI_RECEIVE 0x0006 -#define USBSER_TRACECLASSAPI_RXINT 0x0007 -#define USBSER_TRACECLASSAPI_RXAVAILABLE 0x0008 -#define USBSER_TRACECLASSAPI_SEND 0x0009 -#define USBSER_TRACECLASSAPI_TXINT 0x000a -#define USBSER_TRACECLASSAPI_TXREADY 0x000b -#define USBSER_TRACECLASSAPI_TXEMPTY 0x000c - -/* Values of the class error ID used by the USB serial driver */ - -#define USBSER_TRACEERR_ALLOCCTRLREQ 0x0001 -#define USBSER_TRACEERR_ALLOCDEVSTRUCT 0x0002 -#define USBSER_TRACEERR_ALREADYCLOSED 0x0003 -#define USBSER_TRACEERR_ALREADYCONFIGURED 0x0004 -#define USBSER_TRACEERR_CONFIGIDBAD 0x0005 -#define USBSER_TRACEERR_CONFIGNONE 0x0006 -#define USBSER_TRACEERR_CONSOLEREGISTER 0x0007 -#define USBSER_TRACEERR_DEVREGISTER 0x0008 -#define USBSER_TRACEERR_EPRESPQ 0x0009 -#define USBSER_TRACEERR_GETUNKNOWNDESC 0x000a -#define USBSER_TRACEERR_INVALIDARG 0x000b -#define USBSER_TRACEERR_EP0NOTBOUND 0x000c -#define USBSER_TRACEERR_EPBULKINALLOCFAIL 0x000d -#define USBSER_TRACEERR_EPBULKINCONFIGFAIL 0x000e -#define USBSER_TRACEERR_EPBULKOUTALLOCFAIL 0x000f -#define USBSER_TRACEERR_EPINTINALLOCFAIL 0x0010 -#define USBSER_TRACEERR_EPINTINCONFIGFAIL 0x0011 -#define USBSER_TRACEERR_EPBULKOUTCONFIGFAIL 0x0012 -#define USBSER_TRACEERR_RDALLOCREQ 0x0013 -#define USBSER_TRACEERR_RDSHUTDOWN 0x0014 -#define USBSER_TRACEERR_RDSUBMIT 0x0015 -#define USBSER_TRACEERR_RDUNEXPECTED 0x0016 -#define USBSER_TRACEERR_REQRESULT 0x0017 -#define USBSER_TRACEERR_RXOVERRUN 0x0018 -#define USBSER_TRACEERR_SETUPNOTCONNECTED 0x0019 -#define USBSER_TRACEERR_SUBMITFAIL 0x001a -#define USBSER_TRACEERR_UARTREGISTER 0x001b -#define USBSER_TRACEERR_UARTUNREGISTER 0x001c -#define USBSER_TRACEERR_UNSUPPORTEDCTRLREQ 0x001d -#define USBSER_TRACEERR_UNSUPPORTEDCLASSREQ 0x001e -#define USBSER_TRACEERR_UNSUPPORTEDSTDREQ 0x001f -#define USBSER_TRACEERR_UNSUPPORTEDTYPE 0x0020 -#define USBSER_TRACEERR_WRALLOCREQ 0x0021 -#define USBSER_TRACEERR_WRSHUTDOWN 0x0022 -#define USBSER_TRACEERR_WRUNEXPECTED 0x0023 - -/* USB Storage driver class events ******************************************/ - -#define USBCOMPOSITE_TRACEERR_REQRESULT 0x0001 -#define USBCOMPOSITE_TRACEERR_ALLOCCTRLREQ 0x0002 -#define USBCOMPOSITE_TRACEERR_INVALIDARG 0x0003 -#define USBCOMPOSITE_TRACEERR_EP0NOTBOUND 0x0004 -#define COMPOSITE_TRACEERR_SETUPINVALIDARGS 0x0005 -#define COMPOSITE_TRACEERR_EP0NOTBOUND2 0x0006 -#define COMPOSITE_TRACEERR_GETUNKNOWNDESC 0x0007 -#define COMPOSITE_TRACEERR_UNSUPPORTEDSTDREQ 0x0008 -#define COMPOSITE_TRACEERR_EPRESPQ 0x0009 -#define USBCOMPOSITE_TRACEERR_ALLOCDEVSTRUCT 0x000a -#define USBCOMPOSITE_TRACEERR_CLASSOBJECT 0x000b -#define USBCOMPOSITE_TRACEERR_DEVREGISTER 0x000c - -/* USB Storage driver class events ******************************************/ - -/* State transitions */ - -#define USBMSC_CLASSSTATE_IDLECMDPARSE 0x0001 -#define USBMSC_CLASSSTATE_CMDPARSECMDFINISH 0x0002 -#define USBMSC_CLASSSTATE_CMDPARSECMDREAD6 0x0003 -#define USBMSC_CLASSSTATE_CMDPARSECMDREAD10 0x0004 -#define USBMSC_CLASSSTATE_CMDPARSECMDREAD12 0x0005 -#define USBMSC_CLASSSTATE_CMDPARSECMDWRITE6 0x0006 -#define USBMSC_CLASSSTATE_CMDPARSECMDWRITE10 0x0007 -#define USBMSC_CLASSSTATE_CMDPARSECMDWRITE12 0x0008 -#define USBMSC_CLASSSTATE_CMDREAD 0x0009 -#define USBMSC_CLASSSTATE_CMDREADCMDFINISH 0x000a -#define USBMSC_CLASSSTATE_CMDWRITE 0x000b -#define USBMSC_CLASSSTATE_CMDWRITECMDFINISH 0x000c -#define USBMSC_CLASSSTATE_CMDFINISHCMDSTATUS 0x000d -#define USBMSC_CLASSSTATE_CMDSTATUSIDLE 0x000e - -/* Values of the class error ID used by the USB storage driver */ - -#define USBMSC_TRACEERR_ALLOCCTRLREQ 0x0001 -#define USBMSC_TRACEERR_ALLOCDEVSTRUCT 0x0002 -#define USBMSC_TRACEERR_ALLOCIOBUFFER 0x0003 -#define USBMSC_TRACEERR_ALREADYCONFIGURED 0x0004 -#define USBMSC_TRACEERR_ALREADYUNINIT 0x0005 -#define USBMSC_TRACEERR_BADREQUEST 0x0006 -#define USBMSC_TRACEERR_BINDLUNINVALIDARGS2 0x0007 -#define USBMSC_TRACEERR_BINDLUNINVALIDARGS3 0x0008 -#define USBMSC_TRACEERR_BINDLUNINVALIDARGS4 0x0009 -#define USBMSC_TRACEERR_BINLUNINVALIDARGS1 0x000a -#define USBMSC_TRACEERR_BLKDRVEOPEN 0x000b -#define USBMSC_TRACEERR_CMDBADLUN 0x000c -#define USBMSC_TRACEERR_CMDFINISHRESIDUE 0x000d -#define USBMSC_TRACEERR_CMDFINISHRQEMPTY 0x000e -#define USBMSC_TRACEERR_CMDFINISHSHORTPKT 0x000f -#define USBMSC_TRACEERR_CMDFINISHSUBMIT 0x0010 -#define USBMSC_TRACEERR_CMDFINSHDIR 0x0011 -#define USBMSC_TRACEERR_CMDFINSHSUBMIT 0x0012 -#define USBMSC_TRACEERR_CMDPARSEWRREQLISTEMPTY 0x0013 -#define USBMSC_TRACEERR_CMDREADREADFAIL 0x0014 -#define USBMSC_TRACEERR_CMDREADSUBMIT 0x0015 -#define USBMSC_TRACEERR_CMDREADWRRQEMPTY 0x0016 -#define USBMSC_TRACEERR_CMDSTATUSRDREQLISTEMPTY 0x0017 -#define USBMSC_TRACEERR_CMDUNEVIOLATION 0x0018 -#define USBMSC_TRACEERR_CMDWRITERDSUBMIT 0x0019 -#define USBMSC_TRACEERR_CMDWRITERDRQEMPTY 0x001a -#define USBMSC_TRACEERR_CMDWRITEWRITEFAIL 0x001b -#define USBMSC_TRACEERR_CONFIGIDBAD 0x001c -#define USBMSC_TRACEERR_CONFIGNONE 0x001d -#define USBMSC_TRACEERR_DEFERREDRESPINVALIDARGS 0x001e -#define USBMSC_TRACEERR_DEFERREDRESPSTALLED 0x001f -#define USBMSC_TRACEERR_DEFERREDRESPSUBMIT 0x0020 -#define USBMSC_TRACEERR_DEVREGISTER 0x0021 -#define USBMSC_TRACEERR_DISCONNECTINVALIDARGS 0x0022 -#define USBMSC_TRACEERR_EP0NOTBOUND1 0x0023 -#define USBMSC_TRACEERR_EP0NOTBOUND2 0x0024 -#define USBMSC_TRACEERR_EP0NOTBOUND3 0x0025 -#define USBMSC_TRACEERR_EPBULKINALLOCFAIL 0x0026 -#define USBMSC_TRACEERR_EPBULKINCONFIGFAIL 0x0027 -#define USBMSC_TRACEERR_EPBULKOUTALLOCFAIL 0x0028 -#define USBMSC_TRACEERR_EPBULKOUTCONFIGFAIL 0x0029 -#define USBMSC_TRACEERR_EPRESPQ 0x002a -#define USBMSC_TRACEERR_EXPORTLUNSINVALIDARGS 0x002b -#define USBMSC_TRACEERR_GETMAXLUNNDX 0x002c -#define USBMSC_TRACEERR_GETUNKNOWNDESC 0x002d -#define USBMSC_TRACEERR_IDLERDREQLISTEMPTY 0x002e -#define USBMSC_TRACEERR_IDLERDSUBMIT 0x002f -#define USBMSC_TRACEERR_INQUIRYFLAGS 0x0030 -#define USBMSC_TRACEERR_INTERNALCONFUSION1 0x0031 -#define USBMSC_TRACEERR_INTERNALCONFUSION2 0x0032 -#define USBMSC_TRACEERR_INVALIDCBWCONTENT 0x0033 -#define USBMSC_TRACEERR_INVALIDCBWSIGNATURE 0x0034 -#define USBMSC_TRACEERR_INVALIDSTATE 0x0035 -#define USBMSC_TRACEERR_LUNALREADYBOUND 0x0036 -#define USBMSC_TRACEERR_LUNNOTBOUND 0x0037 -#define USBMSC_TRACEERR_MODEPAGEFLAGS 0x0038 -#define USBMSC_TRACEERR_MODESENSE10FLAGS 0x0039 -#define USBMSC_TRACEERR_MODESENSE6FLAGS 0x003a -#define USBMSC_TRACEERR_MSRESETNDX 0x003b -#define USBMSC_TRACEERR_NOGEOMETRY 0x003c -#define USBMSC_TRACEERR_NOTCONFIGURED 0x003d -#define USBMSC_TRACEERR_NOTREMOVABLE 0x003e -#define USBMSC_TRACEERR_PCSAVED 0x003f -#define USBMSC_TRACEERR_PHASEERROR1 0x0040 -#define USBMSC_TRACEERR_PHASEERROR2 0x0041 -#define USBMSC_TRACEERR_PHASEERROR3 0x0042 -#define USBMSC_TRACEERR_PREVENTMEDIUMREMOVALPREVENT 0x0043 -#define USBMSC_TRACEERR_RDALLOCREQ 0x0044 -#define USBMSC_TRACEERR_RDCOMPLETEINVALIDARGS 0x0045 -#define USBMSC_TRACEERR_RDCOMPLETERDSUBMIT 0x0046 -#define USBMSC_TRACEERR_RDSHUTDOWN 0x0047 -#define USBMSC_TRACEERR_RDSUBMIT 0x0048 -#define USBMSC_TRACEERR_RDUNEXPECTED 0x0049 -#define USBMSC_TRACEERR_READ10FLAGS 0x004a -#define USBMSC_TRACEERR_READ10LBARANGE 0x004b -#define USBMSC_TRACEERR_READ10MEDIANOTPRESENT 0x004c -#define USBMSC_TRACEERR_READ12FLAGS 0x004d -#define USBMSC_TRACEERR_READ12LBARANGE 0x004e -#define USBMSC_TRACEERR_READ12MEDIANOTPRESENT 0x004f -#define USBMSC_TRACEERR_READ6LBARANGE 0x0050 -#define USBMSC_TRACEERR_READ6MEDIANOTPRESENT 0x0051 -#define USBMSC_TRACEERR_READCAPACITYFLAGS 0x0052 -#define USBMSC_TRACEERR_REALLOCIOBUFFER 0x0053 -#define USBMSC_TRACEERR_REQRESULT 0x0054 -#define USBMSC_TRACEERR_SCSICMDCONTROL 0x0055 -#define USBMSC_TRACEERR_SETCONFIGINVALIDARGS 0x0056 -#define USBMSC_TRACEERR_SETUPINVALIDARGS 0x0057 -#define USBMSC_TRACEERR_SNDCSWFAIL 0x0058 -#define USBMSC_TRACEERR_SNDPHERROR 0x0059 -#define USBMSC_TRACEERR_SNDSTATUSSUBMIT 0x005a -#define USBMSC_TRACEERR_SYNCCACHEMEDIANOTPRESENT 0x005b -#define USBMSC_TRACEERR_THREADCREATE 0x005c -#define USBMSC_TRACEERR_TOOMANYLUNS 0x005d -#define USBMSC_TRACEERR_UNBINDINVALIDARGS 0x005e -#define USBMSC_TRACEERR_UNBINDLUNINVALIDARGS1 0x005f -#define USBMSC_TRACEERR_UNBINDLUNINVALIDARGS2 0x0060 -#define USBMSC_TRACEERR_UNINITIALIZEINVALIDARGS 0x0061 -#define USBMSC_TRACEERR_UNSUPPORTEDSTDREQ 0x0062 -#define USBMSC_TRACEERR_VERIFY10FLAGS 0x0063 -#define USBMSC_TRACEERR_VERIFY10LBARANGE 0x0064 -#define USBMSC_TRACEERR_VERIFY10MEDIANOTPRESENT 0x0065 -#define USBMSC_TRACEERR_VERIFY10NOBLOCKS 0x0066 -#define USBMSC_TRACEERR_VERIFY10READFAIL 0x0067 -#define USBMSC_TRACEERR_WRALLOCREQ 0x0068 -#define USBMSC_TRACEERR_SNDPHERROR 0x0069 -#define USBMSC_TRACEERR_WRCOMPLETEINVALIDARGS 0x006a -#define USBMSC_TRACEERR_WRITE10FLAGS 0x006b -#define USBMSC_TRACEERR_WRITE10LBARANGE 0x006c -#define USBMSC_TRACEERR_WRITE10MEDIANOTPRESENT 0x006d -#define USBMSC_TRACEERR_WRITE10READONLY 0x006e -#define USBMSC_TRACEERR_WRITE12FLAGS 0x006f -#define USBMSC_TRACEERR_WRITE12LBARANGE 0x0070 -#define USBMSC_TRACEERR_WRITE12MEDIANOTPRESENT 0x0071 -#define USBMSC_TRACEERR_WRITE12READONLY 0x0072 -#define USBMSC_TRACEERR_WRITE6LBARANGE 0x0073 -#define USBMSC_TRACEERR_WRITE6MEDIANOTPRESENT 0x0074 -#define USBMSC_TRACEERR_WRITE6READONLY 0x0075 -#define USBMSC_TRACEERR_WRSHUTDOWN 0x0076 -#define USBMSC_TRACEERR_WRUNEXPECTED 0x0077 -#define USBMSC_TRACEERR_UNSUPPORTEDTYPE 0x0078 - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* The reported trace information */ - -struct usbtrace_s -{ - uint16_t event; - uint16_t value; -}; - -/* Enumeration callback function signature */ - -typedef int (*trace_callback_t)(struct usbtrace_s *trace, void *arg); - -/* Bit mask input type for usbtrace_enable(). If TRACE_NIDS grows beyond - * 16, then this will have to be changed to uint32_t - */ - -typedef uint16_t usbtrace_idset_t; - -/* Print routine to use for usbdev_trprint() output */ - -typedef int (*trprintf_t)(const char *fmt, ...); - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -# define EXTERN extern "C" -extern "C" { -#else -# define EXTERN extern -#endif - -/******************************************************************************* - * Name: usbtrace_enable - * - * Description: - * Enable/disable tracing per trace ID. The initial state is all IDs enabled. - * - * Input Parameters: - * idset - The bitset of IDs to be masked. TRACE_ALLIDS enables all IDS; zero - * masks all IDs. - * - * Returned Value: - * The previous idset value. - * - * Assumptions: - * - May be called from an interrupt handler - * - *******************************************************************************/ - -#if defined(CONFIG_USBDEV_TRACE) || (defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_USB)) -EXTERN usbtrace_idset_t usbtrace_enable(usbtrace_idset_t idset); -#else -# define usbtrace_enable(idset) -#endif - -/******************************************************************************* - * Name: usbtrace - * - * Description: - * Record a USB event (tracing must be enabled) - * - * Assumptions: - * May be called from an interrupt handler - * - *******************************************************************************/ - -#if defined(CONFIG_USBDEV_TRACE) || (defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_USB)) -EXTERN void usbtrace(uint16_t event, uint16_t value); -#else -# define usbtrace(event, value) -#endif - -/******************************************************************************* - * Name: usbtrace_enumerate - * - * Description: - * Enumerate all buffer trace data (will temporarily disable tracing) - * - * Assumptions: - * NEVER called from an interrupt handler - * - *******************************************************************************/ - -#ifdef CONFIG_USBDEV_TRACE -EXTERN int usbtrace_enumerate(trace_callback_t callback, void *arg); -#else -# define usbtrace_enumerate(event) -#endif - -/******************************************************************************* - * Name: usbtrace_trprint - * - * Description: - * Print the trace record using the supplied printing function - * - *******************************************************************************/ - -EXTERN void usbtrace_trprintf(trprintf_t trprintf, uint16_t event, uint16_t value); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_USB_USBDEV_TRACE_H */ diff --git a/nuttx/include/nuttx/usb/usbhost.h b/nuttx/include/nuttx/usb/usbhost.h deleted file mode 100644 index acfe9a829..000000000 --- a/nuttx/include/nuttx/usb/usbhost.h +++ /dev/null @@ -1,875 +0,0 @@ -/************************************************************************************ - * include/nuttx/usb/usbhost.h - * - * Copyright (C) 2010-2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * References: - * "Universal Serial Bus Mass Storage Class, Specification Overview," - * Revision 1.2, USB Implementer's Forum, June 23, 2003. - * - * "Universal Serial Bus Mass Storage Class, Bulk-Only Transport," - * Revision 1.0, USB Implementer's Forum, September 31, 1999. - * - * 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_NUTTX_USB_USBHOST_H -#define __INCLUDE_NUTTX_USB_USBHOST_H - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include - -#include -#include -#include - -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - -/************************************************************************************ - * Name: CLASS_CREATE - * - * Description: - * This macro will call the create() method of struct usbhost_registry_s. The create() - * method is a callback into the class implementation. It is used to (1) create - * a new instance of the USB host class state and to (2) bind a USB host driver - * "session" to the class instance. Use of this create() method will support - * environments where there may be multiple USB ports and multiple USB devices - * simultaneously connected. - * - * Input Parameters: - * reg - The USB host class registry entry previously obtained from a call to - * usbhost_findclass(). - * drvr - An instance of struct usbhost_driver_s that the class implementation will - * "bind" to its state structure and will subsequently use to communicate with - * the USB host driver. - * id - In the case where the device supports multiple base classes, subclasses, or - * protocols, this specifies which to configure for. - * - * Returned Values: - * On success, this function will return a non-NULL instance of struct - * usbhost_class_s that can be used by the USB host driver to communicate with the - * USB host class. NULL is returned on failure; this function will fail only if - * the drvr input parameter is NULL or if there are insufficient resources to - * create another USB host class instance. - * - * Assumptions: - * If this function is called from an interrupt handler, it will be unable to - * allocate memory and CONFIG_USBHOST_NPREALLOC should be defined to be a value - * greater than zero specify a number of pre-allocated class structures. - * - ************************************************************************************/ - -#define CLASS_CREATE(reg, drvr, id) ((reg)->create(drvr, id)) - -/************************************************************************************ - * Name: CLASS_CONNECT - * - * Description: - * This macro will call the connect() method of struct usbhost_class_s. This - * method is a callback into the class implementation. It is used to provide the - * device's configuration descriptor to the class so that the class may initialize - * properly - * - * Input Parameters: - * class - The USB host class entry previously obtained from a call to create(). - * configdesc - A pointer to a uint8_t buffer container the configuration descripor. - * desclen - The length in bytes of the configuration descriptor. - * funcaddr - The USB address of the function containing the endpoint that EP0 - * controls - * - * Returned Values: - * On success, zero (OK) is returned. On a failure, a negated errno value is - * returned indicating the nature of the failure - * - * NOTE that the class instance remains valid upon return with a failure. It is - * the responsibility of the higher level enumeration logic to call - * CLASS_DISCONNECTED to free up the class driver resources. - * - * Assumptions: - * - This function is probably called on the same thread that called the driver - * enumerate() method. This function will *not* be called from an interrupt - * handler. - * - If this function returns an error, the USB host controller driver - * must call to DISCONNECTED method to recover from the error - * - ************************************************************************************/ - -#define CLASS_CONNECT(class,configdesc,desclen,funcaddr) \ - ((class)->connect(class,configdesc,desclen, funcaddr)) - -/************************************************************************************ - * Name: CLASS_DISCONNECTED - * - * Description: - * This macro will call the disconnected() method of struct usbhost_class_s. This - * method is a callback into the class implementation. It is used to inform the - * class that the USB device has been disconnected. - * - * Input Parameters: - * class - The USB host class entry previously obtained from a call to create(). - * - * Returned Values: - * On success, zero (OK) is returned. On a failure, a negated errno value is - * returned indicating the nature of the failure - * - * Assumptions: - * This function will *not* be called from an interrupt handler. - * - ************************************************************************************/ - -#define CLASS_DISCONNECTED(class) ((class)->disconnected(class)) - -/******************************************************************************* - * Name: DRVR_WAIT - * - * Description: - * Wait for a device to be connected or disconneced. - * - * Input Parameters: - * drvr - The USB host driver instance obtained as a parameter from the call to - * the class create() method. - * connected - TRUE: Wait for device to be connected; FALSE: wait for device to - * be disconnected - * - * Returned Values: - * Zero (OK) is returned when a device in connected. This function will not - * return until either (1) a device is connected or (2) some failure occurs. - * On a failure, a negated errno value is returned indicating the nature of - * the failure - * - * Assumptions: - * This function will *not* be called from an interrupt handler. - * - *******************************************************************************/ - -#define DRVR_WAIT(drvr, connected) ((drvr)->wait(drvr,connected)) - -/************************************************************************************ - * Name: DRVR_ENUMERATE - * - * Description: - * Enumerate the connected device. As part of this enumeration process, - * the driver will (1) get the device's configuration descriptor, (2) - * extract the class ID info from the configuration descriptor, (3) call - * usbhost_findclass() to find the class that supports this device, (4) - * call the create() method on the struct usbhost_registry_s interface - * to get a class instance, and finally (5) call the connect() method - * of the struct usbhost_class_s interface. After that, the class is in - * charge of the sequence of operations. - * - * Input Parameters: - * drvr - The USB host driver instance obtained as a parameter from the call to - * the class create() method. - * - * Returned Values: - * On success, zero (OK) is returned. On a failure, a negated errno value is - * returned indicating the nature of the failure - * - * Assumptions: - * This function will *not* be called from an interrupt handler. - * - ************************************************************************************/ - -#define DRVR_ENUMERATE(drvr) ((drvr)->enumerate(drvr)) - -/************************************************************************************ - * Name: DRVR_EP0CONFIGURE - * - * Description: - * Configure endpoint 0. This method is normally used internally by the - * enumerate() method but is made available at the interface to support - * an external implementation of the enumeration logic. - * - * Input Parameters: - * drvr - The USB host driver instance obtained as a parameter from the call to - * the class create() method. - * funcaddr - The USB address of the function containing the endpoint that EP0 - * controls - * mps (maxpacketsize) - The maximum number of bytes that can be sent to or - * received from the endpoint in a single data packet - * - * Returned Values: - * On success, zero (OK) is returned. On a failure, a negated errno value is - * returned indicating the nature of the failure - * - * Assumptions: - * This function will *not* be called from an interrupt handler. - * - ************************************************************************************/ - -#define DRVR_EP0CONFIGURE(drvr,funcaddr,mps) ((drvr)->ep0configure(drvr,funcaddr,mps)) - -/************************************************************************************ - * Name: DRVR_EPALLOC - * - * Description: - * Allocate and configure one endpoint. - * - * Input Parameters: - * drvr - The USB host driver instance obtained as a parameter from the call to - * the class create() method. - * epdesc - Describes the endpoint to be allocated. - * ep - A memory location provided by the caller in which to receive the - * allocated endpoint desciptor. - * - * Returned Values: - * On success, zero (OK) is returned. On a failure, a negated errno value is - * returned indicating the nature of the failure - * - * Assumptions: - * This function will *not* be called from an interrupt handler. - * - ************************************************************************************/ - -#define DRVR_EPALLOC(drvr,epdesc,ep) ((drvr)->epalloc(drvr,epdesc,ep)) - -/************************************************************************************ - * Name: DRVR_EPFREE - * - * Description: - * Free and endpoint previously allocated by DRVR_EPALLOC. - * - * Input Parameters: - * drvr - The USB host driver instance obtained as a parameter from the call to - * the class create() method. - * ep - The endpint to be freed. - * - * Returned Values: - * On success, zero (OK) is returned. On a failure, a negated errno value is - * returned indicating the nature of the failure - * - * Assumptions: - * This function will *not* be called from an interrupt handler. - * - ************************************************************************************/ - -#define DRVR_EPFREE(drvr,ep) ((drvr)->epfree(drvr,ep)) - -/************************************************************************************ - * Name: DRVR_ALLOC - * - * Description: - * Some hardware supports special memory in which request and descriptor data can - * be accessed more efficiently. This method provides a mechanism to allocate - * the request/descriptor memory. If the underlying hardware does not support - * such "special" memory, this functions may simply map to kmalloc. - * - * This interface was optimized under a particular assumption. It was assumed - * that the driver maintains a pool of small, pre-allocated buffers for descriptor - * traffic. NOTE that size is not an input, but an output: The size of the - * pre-allocated buffer is returned. - * - * Input Parameters: - * drvr - The USB host driver instance obtained as a parameter from the call to - * the class create() method. - * buffer - The address of a memory location provided by the caller in which to - * return the allocated buffer memory address. - * maxlen - The address of a memory location provided by the caller in which to - * return the maximum size of the allocated buffer memory. - * - * Returned Values: - * On success, zero (OK) is returned. On a failure, a negated errno value is - * returned indicating the nature of the failure - * - * Assumptions: - * This function will *not* be called from an interrupt handler. - * - ************************************************************************************/ - -#define DRVR_ALLOC(drvr,buffer,maxlen) ((drvr)->alloc(drvr,buffer,maxlen)) - -/************************************************************************************ - * Name: DRVR_FREE - * - * Description: - * Some hardware supports special memory in which request and descriptor data can - * be accessed more efficiently. This method provides a mechanism to free that - * request/descriptor memory. If the underlying hardware does not support - * such "special" memory, this functions may simply map to kfree(). - * - * Input Parameters: - * drvr - The USB host driver instance obtained as a parameter from the call to - * the class create() method. - * buffer - The address of the allocated buffer memory to be freed. - * - * Returned Values: - * On success, zero (OK) is returned. On a failure, a negated errno value is - * returned indicating the nature of the failure - * - * Assumptions: - * This function will *not* be called from an interrupt handler. - * - ************************************************************************************/ - -#define DRVR_FREE(drvr,buffer) ((drvr)->free(drvr,buffer)) - -/************************************************************************************ - * Name: DRVR_IOALLOC - * - * Description: - * Some hardware supports special memory in which larger IO buffers can - * be accessed more efficiently. This method provides a mechanism to allocate - * the request/descriptor memory. If the underlying hardware does not support - * such "special" memory, this functions may simply map to kmalloc. - * - * This interface differs from DRVR_ALLOC in that the buffers are variable-sized. - * - * Input Parameters: - * drvr - The USB host driver instance obtained as a parameter from the call to - * the class create() method. - * buffer - The address of a memory location provided by the caller in which to - * return the allocated buffer memory address. - * buflen - The size of the buffer required. - * - * Returned Values: - * On success, zero (OK) is returned. On a failure, a negated errno value is - * returned indicating the nature of the failure - * - * Assumptions: - * This function will *not* be called from an interrupt handler. - * - ************************************************************************************/ - -#define DRVR_IOALLOC(drvr,buffer,buflen) ((drvr)->ioalloc(drvr,buffer,buflen)) - -/************************************************************************************ - * Name: DRVR_IOFREE - * - * Description: - * Some hardware supports special memory in which IO data can be accessed more - * efficiently. This method provides a mechanism to free that IO buffer - * memory. If the underlying hardware does not support such "special" memory, - * this functions may simply map to kfree(). - * - * Input Parameters: - * drvr - The USB host driver instance obtained as a parameter from the call to - * the class create() method. - * buffer - The address of the allocated buffer memory to be freed. - * - * Returned Values: - * On success, zero (OK) is returned. On a failure, a negated errno value is - * returned indicating the nature of the failure - * - * Assumptions: - * This function will *not* be called from an interrupt handler. - * - ************************************************************************************/ - -#define DRVR_IOFREE(drvr,buffer) ((drvr)->iofree(drvr,buffer)) - -/************************************************************************************ - * Name: DRVR_CTRLIN and DRVR_CTRLOUT - * - * Description: - * Process a IN or OUT request on the control endpoint. These methods - * will enqueue the request and wait for it to complete. Only one transfer may be - * queued; Neither these methods nor the transfer() method can be called again - * until the control transfer functions returns. - * - * These are blocking methods; these functions will not return until the - * control transfer has completed. - * - * Input Parameters: - * drvr - The USB host driver instance obtained as a parameter from the call to - * the class create() method. - * req - Describes the request to be sent. This request must lie in memory - * created by DRVR_ALLOC. - * buffer - A buffer used for sending the request and for returning any - * responses. This buffer must be large enough to hold the length value - * in the request description. buffer must have been allocated using DRVR_ALLOC. - * - * NOTE: On an IN transaction, req and buffer may refer to the same allocated - * memory. - * - * Returned Values: - * On success, zero (OK) is returned. On a failure, a negated errno value is - * returned indicating the nature of the failure - * - * Assumptions: - * This function will *not* be called from an interrupt handler. - * - ************************************************************************************/ - -#define DRVR_CTRLIN(drvr,req,buffer) ((drvr)->ctrlin(drvr,req,buffer)) -#define DRVR_CTRLOUT(drvr,req,buffer) ((drvr)->ctrlout(drvr,req,buffer)) - -/************************************************************************************ - * Name: DRVR_TRANSFER - * - * Description: - * Process a request to handle a transfer descriptor. This method will - * enqueue the transfer request and rwait for it to complete. Only one transfer may - * be queued; Neither this method nor the ctrlin or ctrlout methods can be called - * again until this function returns. - * - * This is a blocking method; this functions will not return until the - * transfer has completed. - * - * Input Parameters: - * drvr - The USB host driver instance obtained as a parameter from the call to - * the class create() method. - * ed - The IN or OUT endpoint descriptor for the device endpoint on which to - * perform the transfer. - * buffer - A buffer containing the data to be sent (OUT endpoint) or received - * (IN endpoint). buffer must have been allocated using DRVR_ALLOC - * buflen - The length of the data to be sent or received. - * - * Returned Values: - * On success, zero (OK) is returned. On a failure, a negated errno value is - * returned indicating the nature of the failure: - * - * EAGAIN - If devices NAKs the transfer (or NYET or other error where - * it may be appropriate to restart the entire transaction). - * EPERM - If the endpoint stalls - * EIO - On a TX or data toggle error - * EPIPE - Overrun errors - * - * Assumptions: - * This function will *not* be called from an interrupt handler. - * - ************************************************************************************/ - -#define DRVR_TRANSFER(drvr,ed,buffer,buflen) ((drvr)->transfer(drvr,ed,buffer,buflen)) - -/************************************************************************************ - * Name: DRVR_DISCONNECT - * - * Description: - * Called by the class when an error occurs and driver has been disconnected. - * The USB host driver should discard the handle to the class instance (it is - * stale) and not attempt any further interaction with the class driver instance - * (until a new instance is received from the create() method). The driver - * should not called the class' disconnected() method. - * - * Input Parameters: - * drvr - The USB host driver instance obtained as a parameter from the call to - * the class create() method. - * - * Returned Values: - * None - * - * Assumptions: - * This function will *not* be called from an interrupt handler. - * - ************************************************************************************/ - -#define DRVR_DISCONNECT(drvr) ((drvr)->disconnect(drvr)) - -/************************************************************************************ - * Public Types - ************************************************************************************/ - -/* This struct contains all of the information that is needed to associate a device - * this is connected via a USB port to a class. - */ - -struct usbhost_id_s -{ - uint8_t base; /* Base device class code (see USB_CLASS_* defines in usb.h) */ - uint8_t subclass; /* Sub-class, depends on base class. Eg., See USBMSC_SUBCLASS_* */ - uint8_t proto; /* Protocol, depends on base class. Eg., See USBMSC_PROTO_* */ - uint16_t vid; /* Vendor ID (for vendor/product specific devices) */ - uint16_t pid; /* Product ID (for vendor/product specific devices) */ -}; - -/* The struct usbhost_registry_s type describes information that is kept in the the - * USB host registry. USB host class implementations register this information so - * that USB host drivers can later find the class that matches the device that is - * connected to the USB port. - */ - -struct usbhost_driver_s; /* Forward reference to the driver state structure */ -struct usbhost_class_s; /* Forward reference to the class state structure */ -struct usbhost_registry_s -{ - /* This field is used to implement a singly-link registry structure. Because of - * the presence of this link, provides of structy usbhost_registry_s instances must - * provide those instances in write-able memory (RAM). - */ - - struct usbhost_registry_s *flink; - - /* This is a callback into the class implementation. It is used to (1) create - * a new instance of the USB host class state and to (2) bind a USB host driver - * "session" to the class instance. Use of this create() method will support - * environments where there may be multiple USB ports and multiple USB devices - * simultaneously connected (see the CLASS_CREATE() macro above). - */ - - FAR struct usbhost_class_s *(*create)(FAR struct usbhost_driver_s *drvr, - FAR const struct usbhost_id_s *id); - - /* This information uniquely identifies the USB host class implementation that - * goes with a specific USB device. - */ - - uint8_t nids; /* Number of IDs in the id[] array */ - FAR const struct usbhost_id_s *id; /* An array of ID info. Actual dimension is nids */ -}; - -/* struct usbhost_class_s provides access from the USB host driver to the USB host - * class implementation. - */ - -struct usbhost_class_s -{ - /* Provides the configuration descriptor to the class. The configuration - * descriptor contains critical information needed by the class in order to - * initialize properly (such as endpoint selections). - */ - - int (*connect)(FAR struct usbhost_class_s *class, FAR const uint8_t *configdesc, - int desclen, uint8_t funcaddr); - - /* This method informs the class that the USB device has been disconnected. */ - - int (*disconnected)(FAR struct usbhost_class_s *class); -}; - -/* This structure describes one endpoint. It is used as an input to the - * epalloc() method. Most of this information comes from the endpoint - * descriptor. - */ - -struct usbhost_epdesc_s -{ - uint8_t addr; /* Endpoint address */ - bool in; /* Direction: true->IN */ - uint8_t funcaddr; /* USB address of function containing endpoint */ - uint8_t xfrtype; /* Transfer type. See USB_EP_ATTR_XFER_* in usb.h */ - uint8_t interval; /* Polling interval */ - uint16_t mxpacketsize; /* Max packetsize */ -}; - -/* This type represents one endpoint configured by the epalloc() method. - * The actual form is know only internally to the USB host controller - * (for example, for an OHCI driver, this would probably be a pointer - * to an endpoint descriptor). - */ - -typedef FAR void *usbhost_ep_t; - -/* struct usbhost_driver_s provides access to the USB host driver from the - * USB host class implementation. - */ - -struct usbhost_driver_s -{ - /* Wait for a device to connect or disconnect. */ - - int (*wait)(FAR struct usbhost_driver_s *drvr, bool connected); - - /* Enumerate the connected device. As part of this enumeration process, - * the driver will (1) get the device's configuration descriptor, (2) - * extract the class ID info from the configuration descriptor, (3) call - * usbhost_findclass() to find the class that supports this device, (4) - * call the create() method on the struct usbhost_registry_s interface - * to get a class instance, and finally (5) call the connect() method - * of the struct usbhost_class_s interface. After that, the class is in - * charge of the sequence of operations. - */ - - int (*enumerate)(FAR struct usbhost_driver_s *drvr); - - /* Configure endpoint 0. This method is normally used internally by the - * enumerate() method but is made available at the interface to support - * an external implementation of the enumeration logic. - */ - - int (*ep0configure)(FAR struct usbhost_driver_s *drvr, uint8_t funcaddr, - uint16_t maxpacketsize); - - /* Allocate and configure an endpoint. */ - - int (*epalloc)(FAR struct usbhost_driver_s *drvr, - const FAR struct usbhost_epdesc_s *epdesc, usbhost_ep_t *ep); - int (*epfree)(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep); - - /* Some hardware supports special memory in which transfer descriptors can - * be accessed more efficiently. The following methods provide a mechanism - * to allocate and free the transfer descriptor memory. If the underlying - * hardware does not support such "special" memory, these functions may - * simply map to kmalloc and kfree. - * - * This interface was optimized under a particular assumption. It was assumed - * that the driver maintains a pool of small, pre-allocated buffers for descriptor - * traffic. NOTE that size is not an input, but an output: The size of the - * pre-allocated buffer is returned. - */ - - int (*alloc)(FAR struct usbhost_driver_s *drvr, - FAR uint8_t **buffer, FAR size_t *maxlen); - int (*free)(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer); - - /* Some hardware supports special memory in which larger IO buffers can - * be accessed more efficiently. This method provides a mechanism to allocate - * the request/descriptor memory. If the underlying hardware does not support - * such "special" memory, this functions may simply map to kmalloc. - * - * This interface differs from DRVR_ALLOC in that the buffers are variable-sized. - */ - - int (*ioalloc)(FAR struct usbhost_driver_s *drvr, - FAR uint8_t **buffer, size_t buflen); - int (*iofree)(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer); - - /* Process a IN or OUT request on the control endpoint. These methods - * will enqueue the request and wait for it to complete. Only one transfer may - * be queued; Neither these methods nor the transfer() method can be called again - * until the control transfer functions returns. - * - * These are blocking methods; these functions will not return until the - * control transfer has completed. - */ - - int (*ctrlin)(FAR struct usbhost_driver_s *drvr, - FAR const struct usb_ctrlreq_s *req, - FAR uint8_t *buffer); - int (*ctrlout)(FAR struct usbhost_driver_s *drvr, - FAR const struct usb_ctrlreq_s *req, - FAR const uint8_t *buffer); - - /* Process a request to handle a transfer descriptor. This method will - * enqueue the transfer request and wait for it to complete. Only one transfer may - * be queued; Neither this method nor the ctrlin or ctrlout methods can be called - * again until this function returns. - * - * This is a blocking method; this functions will not return until the - * transfer has completed. - */ - - int (*transfer)(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep, - FAR uint8_t *buffer, size_t buflen); - - /* Called by the class when an error occurs and driver has been disconnected. - * The USB host driver should discard the handle to the class instance (it is - * stale) and not attempt any further interaction with the class driver instance - * (until a new instance is received from the create() method). - */ - - void (*disconnect)(FAR struct usbhost_driver_s *drvr); -}; - -/************************************************************************************ - * Public Data - ************************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -/************************************************************************************ - * Name: usbhost_registerclass - * - * Description: - * Register a USB host class implementation. The caller provides an instance of - * struct usbhost_registry_s that contains all of the information that will be - * needed later to (1) associate the USB host class implementation with a connected - * USB device, and (2) to obtain and bind a struct usbhost_class_s instance for - * the device. - * - * Input Parameters: - * class - An write-able instance of struct usbhost_registry_s that will be - * maintained in a registry. - * - * Returned Values: - * On success, this function will return zero (OK). Otherwise, a negated errno - * value is returned. - * - ************************************************************************************/ - -EXTERN int usbhost_registerclass(struct usbhost_registry_s *class); - -/************************************************************************************ - * Name: usbhost_findclass - * - * Description: - * Find a USB host class implementation previously registered by - * usbhost_registerclass(). On success, an instance of struct usbhost_registry_s - * will be returned. That instance will contain all of the information that will - * be needed to obtain and bind a struct usbhost_class_s instance for the device. - * - * Input Parameters: - * id - Identifies the USB device class that has connect to the USB host. - * - * Returned Values: - * On success this function will return a non-NULL instance of struct - * usbhost_registry_s. NULL will be returned on failure. This function can only - * fail if (1) id is NULL, or (2) no USB host class is registered that matches the - * device class ID. - * - ************************************************************************************/ - -EXTERN const struct usbhost_registry_s *usbhost_findclass(const struct usbhost_id_s *id); - -/**************************************************************************** - * Name: usbhost_storageinit - * - * Description: - * Initialize the USB host storage class. This function should be called - * be platform-specific code in order to initialize and register support - * for the USB host storage class. - * - * Input Parameters: - * None - * - * Returned Values: - * On success this function will return zero (OK); A negated errno value - * will be returned on failure. - * - ****************************************************************************/ - -EXTERN int usbhost_storageinit(void); - -/**************************************************************************** - * Name: usbhost_kbdinit - * - * Description: - * Initialize the USB storage HID keyboard class driver. This function - * should be called be platform-specific code in order to initialize and - * register support for the USB host HID keyboard class device. - * - * Input Parameters: - * None - * - * Returned Values: - * On success this function will return zero (OK); A negated errno value - * will be returned on failure. - * - ****************************************************************************/ - -EXTERN int usbhost_kbdinit(void); - -/**************************************************************************** - * Name: usbhost_wlaninit - * - * Description: - * Initialize the USB WLAN class driver. This function should be called - * be platform-specific code in order to initialize and register support - * for the USB host class device. - * - * Input Parameters: - * None - * - * Returned Values: - * On success this function will return zero (OK); A negated errno value - * will be returned on failure. - * - ****************************************************************************/ - -EXTERN int usbhost_wlaninit(void); - -/******************************************************************************* - * Name: usbhost_initialize - * - * Description: - * Initialize USB host device controller hardware. - * - * Input Parameters: - * controller -- If the device supports more than USB host controller, then - * this identifies which controller is being intialized. Normally, this - * is just zero. - * - * Returned Value: - * And instance of the USB host interface. The controlling task should - * use this interface to (1) call the wait() method to wait for a device - * to be connected, and (2) call the enumerate() method to bind the device - * to a class driver. - * - * Assumptions: - * - This function should called in the initialization sequence in order - * to initialize the USB device functionality. - * - Class drivers should be initialized prior to calling this function. - * Otherwise, there is a race condition if the device is already connected. - * - *******************************************************************************/ - -EXTERN FAR struct usbhost_driver_s *usbhost_initialize(int controller); - -/******************************************************************************* - * Name: usbhost_enumerate - * - * Description: - * This is a share-able implementation of most of the logic required by the - * driver enumerate() method. This logic within this method should be common - * to all USB host drivers. - * - * Enumerate the connected device. As part of this enumeration process, - * the driver will (1) get the device's configuration descriptor, (2) - * extract the class ID info from the configuration descriptor, (3) call - * usbhost_findclass() to find the class that supports this device, (4) - * call the create() method on the struct usbhost_registry_s interface - * to get a class instance, and finally (5) call the configdesc() method - * of the struct usbhost_class_s interface. After that, the class is in - * charge of the sequence of operations. - * - * Input Parameters: - * drvr - The USB host driver instance obtained as a parameter from the call to - * the class create() method. - * funcaddr - The USB address of the function containing the endpoint that EP0 - * controls - * class - If the class driver for the device is successful located - * and bound to the driver, the allocated class instance is returned into - * this caller-provided memory location. - * - * Returned Values: - * On success, zero (OK) is returned. On a failure, a negated errno value is - * returned indicating the nature of the failure - * - * Assumptions: - * - Only a single class bound to a single device is supported. - * - Called from a single thread so no mutual exclusion is required. - * - Never called from an interrupt handler. - * - *******************************************************************************/ - -EXTERN int usbhost_enumerate(FAR struct usbhost_driver_s *drvr, - uint8_t funcaddr, - FAR struct usbhost_class_s **class); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_USB_USBHOST_H */ diff --git a/nuttx/include/nuttx/usb/usbhost_trace.h b/nuttx/include/nuttx/usb/usbhost_trace.h deleted file mode 100644 index db263c40d..000000000 --- a/nuttx/include/nuttx/usb/usbhost_trace.h +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** - * include/nuttx/usb/usbhost_trace.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 __INCLUDE_NUTTX_USB_USBHOST_TRACE_H -#define __INCLUDE_NUTTX_USB_USBHOST_TRACE_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/* NOTE: Trace debug capability has not been implemented for USB host. It - * should be a simple port of the USB device trace logic. But that has not - * yet been done. - */ - -/**************************************************************************** - * Preprocessor definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -# define EXTERN extern "C" -extern "C" { -#else -# define EXTERN extern -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_USB_USBHOST_TRACE_H */ diff --git a/nuttx/include/nuttx/usb/usbmsc.h b/nuttx/include/nuttx/usb/usbmsc.h deleted file mode 100644 index 325c665c5..000000000 --- a/nuttx/include/nuttx/usb/usbmsc.h +++ /dev/null @@ -1,259 +0,0 @@ -/************************************************************************************ - * include/nuttx/usb/usbmsc.h - * - * Copyright (C) 2008-2010, 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * NOTE: This interface was inspired by the Linux gadget interface by - * David Brownell. That work was very helpful in determining a usable - * partitioning of functionality between standard class drivers and various - * implementations of USB controller drivers. This work, however, does - * not derive directly from that work and is licensed differently. - * - * 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_NUTTX_USB_USBMSC_H -#define _INCLUDE_NUTTX_USB_USBMSC_H - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include - -#include -#include -#include - -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - -/************************************************************************************ - * Public Types - ************************************************************************************/ - - /************************************************************************************ - * Public Data - ************************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -# define EXTERN extern "C" -extern "C" -{ -#else -# define EXTERN extern -#endif - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -/************************************************************************************ - * Name: board_mscclassobject - * - * Description: - * If the mass storage class driver is part of composite device, then - * its instantiation and configuration is a multi-step, board-specific, - * process (See comments for usbmsc_configure below). In this case, - * board-specific logic must provide board_mscclassobject(). - * - * board_mscclassobject() is called from the composite driver. It must - * encapsulate the instantiation and configuration of the mass storage - * class and the return the mass storage device's class driver instance - * to the composite dirver. - * - * Input Parameters: - * classdev - The location to return the mass storage class' device - * instance. - * - * Returned Value: - * 0 on success; a negated errno on failure - * - ************************************************************************************/ - -#if defined(CONFIG_USBDEV_COMPOSITE) && defined(CONFIG_USBMSC_COMPOSITE) -struct usbdevclass_driver_s; -EXTERN int board_mscclassobject(FAR struct usbdevclass_driver_s **classdev); -#endif - -/**************************************************************************** - * Name: board_mscuninitialize - * - * Description: - * Un-initialize the USB storage class driver. This is just an application- - * specific wrapper aboutn usbmsc_unitialize() that is called form the composite - * device logic. - * - * Input Parameters: - * classdev - The class driver instrance previously give to the composite - * driver by board_mscclassobject(). - * - * Returned Value: - * None - * - ****************************************************************************/ - -#if defined(CONFIG_USBDEV_COMPOSITE) && defined(CONFIG_USBMSC_COMPOSITE) -struct usbdevclass_driver_s; -EXTERN void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev); -#endif - -/************************************************************************************ - * Name: usbmsc_configure - * - * Description: - * One-time initialization of the USB storage driver. The initialization - * sequence is as follows: - * - * 1. Call usbmsc_configure to perform one-time initialization specifying - * the number of luns. - * 2. Call usbmsc_bindlun to configure each supported LUN - * 3. Call usbmsc_exportluns when all LUNs are configured - * - * Input Parameters: - * nluns - the number of LUNs that will be registered - * handle - Location to return a handle that is used in other API calls. - * - * Returned Value: - * 0 on success; a negated errno on failure. The returned handle value is - * an untyped equivalent to the usbmsc_classobject() or board_mscclassobject(). - * - ************************************************************************************/ - -EXTERN int usbmsc_configure(unsigned int nluns, void **handle); - -/************************************************************************************ - * Name: usbmsc_bindlun - * - * Description: - * Bind the block driver specified by drvrpath to a USB storage LUN. - * - * Input Parameters: - * handle - The handle returned by a previous call to usbmsc_configure(). - * drvrpath - the full path to the block driver - * startsector - A sector offset into the block driver to the start of the - * partition on drvrpath (0 if no partitions) - * nsectors - The number of sectors in the partition (if 0, all sectors - * to the end of the media will be exported). - * lunno - the LUN to bind to - * - * Returned Value: - * 0 on success; a negated errno on failure. - * - ************************************************************************************/ - -EXTERN int usbmsc_bindlun(FAR void *handle, FAR const char *drvrpath, - unsigned int lunno, off_t startsector, size_t nsectors, - bool readonly); - -/************************************************************************************ - * Name: usbmsc_unbindlun - * - * Description: - * Un-bind the block driver for the specified LUN - * - * Input Parameters: - * handle - The handle returned by a previous call to usbmsc_configure(). - * lun - the LUN to unbind from - * - * Returned Value: - * 0 on success; a negated errno on failure. - * - ************************************************************************************/ - -EXTERN int usbmsc_unbindlun(FAR void *handle, unsigned int lunno); - -/************************************************************************************ - * Name: usbmsc_exportluns - * - * Description: - * After all of the LUNs have been bound, this function may be called in order to - * export those LUNs in the USB storage device. - * - * Input Parameters: - * handle - The handle returned by a previous call to usbmsc_configure(). - * - * Returned Value: - * 0 on success; a negated errno on failure - * - ************************************************************************************/ - -#if !defined(CONFIG_USBDEV_COMPOSITE) || !defined(CONFIG_USBMSC_COMPOSITE) -EXTERN int usbmsc_exportluns(FAR void *handle); -#endif - -/************************************************************************************ - * Name: usbmsc_classobject - * - * Description: - * Register USB mass storage device and return the class object. - * - * Input Parameters: - * classdev - The location to return the CDC serial class' device - * instance. - * - * Returned Value: - * 0 on success; a negated errno on failure - - * - ************************************************************************************/ - -#if defined(CONFIG_USBDEV_COMPOSITE) && defined(CONFIG_USBMSC_COMPOSITE) -struct usbdevclass_driver_s; -EXTERN int usbmsc_classobject(FAR void *handle, FAR struct usbdevclass_driver_s **classdev); -#endif - -/************************************************************************************ - * Name: usbmsc_uninitialize - * - * Description: - * Un-initialize the USB storage class driver. The handle is the USB MSC - * class' device object. This is the same value as returned by usbmsc_classobject - * (typed) or by usbmsc_configure (untyped). - * - * Input Parameters: - * handle - The handle returned by a previous call to usbmsc_configure() - * (or usbmsc_classobject()). - * - * Returned Value: - * None - * - ***********************************************************************************/ - -EXTERN void usbmsc_uninitialize(FAR void *handle); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* _INCLUDE_NUTTX_USB_USBMSC_H */ diff --git a/nuttx/include/nuttx/vt100.h b/nuttx/include/nuttx/vt100.h deleted file mode 100644 index 32344a1de..000000000 --- a/nuttx/include/nuttx/vt100.h +++ /dev/null @@ -1,250 +0,0 @@ -/******************************************************************************************** - * include/nuttx/vt100.h - * VT100 Escape Sequences - * - * Copyright (C) 2012 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_NUTTX_VT100_H -#define __INCLUDE_NUTTX_VT100_H - -/******************************************************************************************** - * Included Files - ********************************************************************************************/ - -#include - -/******************************************************************************************** - * Pre-Processor Definitions - ********************************************************************************************/ - -#define VT100_SETNL {ASCII_ESC, '[', '2', '0', 'h'} /* Set new line mode */ -#define VT100_SETAPPL {ASCII_ESC, '[', '?', '1', 'h'} /* Set cursor key to application */ -#define VT100_SETCOL {ASCII_ESC, '[', '?', '3', 'h'} /* Set number of columns to 132 */ -#define VT100_SETSMOOTH {ASCII_ESC, '[', '?', '4', 'h'} /* Set smooth scrolling */ -#define VT100_SETREVSCRN {ASCII_ESC, '[', '?', '5', 'h'} /* Set reverse video on screen */ -#define VT100_SETORGREL {ASCII_ESC, '[', '?', '6', 'h'} /* Set origin to relative */ -#define VT100_SETWRAP {ASCII_ESC, '[', '?', '7', 'h'} /* Set auto-wrap mode */ -#define VT100_SETREP {ASCII_ESC, '[', '?', '8', 'h'} /* Set auto-repeat mode */ -#define VT100_SETINTER {ASCII_ESC, '[', '?', '9', 'h'} /* Set interlacing mode */ - -#define VT100_SETLF {ASCII_ESC, '[', '2', '0', 'l'} /* Set line feed mode */ -#define VT100_SETCURSOR {ASCII_ESC, '[', '?', '1', 'l'} /* Set cursor key to cursor */ -#define VT100_SETVT52 {ASCII_ESC, '[', '?', '2', 'l'} /* Set VT52 (versus ANSI) */ -#define VT100_RESETCOL {ASCII_ESC, '[', '?', '3', 'l'} /* Set number of columns to 80 */ -#define VT100_SETJUMP {ASCII_ESC, '[', '?', '4', 'l'} /* Set jump scrolling */ -#define VT100_SETNORMSCRN {ASCII_ESC, '[', '?', '5', 'l'} /* Set normal video on screen */ -#define VT100_SETORGABS {ASCII_ESC, '[', '?', '6', 'l'} /* Set origin to absolute */ -#define VT100_RESETWRAP {ASCII_ESC, '[', '?', '7', 'l'} /* Reset auto-wrap mode */ -#define VT100_RESETREP {ASCII_ESC, '[', '?', '8', 'l'} /* Reset auto-repeat mode */ -#define VT100_RESETINTER {ASCII_ESC, '[', '?', '9', 'l'} /* Reset interlacing mode */ - -#define VT100_ALTKEYPAD {ASCII_ESC, '='} /* Set alternate keypad mode */ -#define VT100_NUMKEYPAD {ASCII_ESC, '>'} /* Set numeric keypad mode */ - -#define VT100_SETUKG0 {ASCII_ESC, '(', 'A'} /* Set United Kingdom G0 character set */ -#define VT100_SETUKG1 {ASCII_ESC, ')', 'A'} /* Set United Kingdom G1 character set */ -#define VT100_SETUSG0 {ASCII_ESC, '(', 'B'} /* Set United States G0 character set */ -#define VT100_SETUSG1 {ASCII_ESC, ')', 'B'} /* Set United States G1 character set */ -#define VT100_SETSPECG0 {ASCII_ESC, '(', '0'} /* Set G0 special chars. & line set */ -#define VT100_SETSPECG1 {ASCII_ESC, ')', '0'} /* Set G1 special chars. & line set */ -#define VT100_SETALTG0 {ASCII_ESC, '(', '1'} /* Set G0 alternate character ROM */ -#define VT100_SETALTG1 {ASCII_ESC, ')', '1'} /* Set G1 alternate character ROM */ -#define VT100_SETALTSPECG0 {ASCII_ESC, '(', '2'} /* Set G0 alt char ROM and spec. graphics */ -#define VT100_SETALTSPECG1 {ASCII_ESC, ')', '2'} /* Set G1 alt char ROM and spec. graphics */ - -#define VT100_SETSS2 {ASCII_ESC, 'N'} /* Set single shift 2 */ -#define VT100_SETSS3 {ASCII_ESC, 'O'} /* Set single shift 3 */ - -#define VT100_MODESOFF {ASCII_ESC, '[', 'm'} /* Turn off character attributes */ -#define VT100_MODESOFF_ {ASCII_ESC, '[', '0', 'm'} /* Turn off character attributes */ -#define VT100_BOLD {ASCII_ESC, '[', '1', 'm'} /* Turn bold mode on */ -#define VT100_LOWINT {ASCII_ESC, '[', '2', 'm'} /* Turn low intensity mode on */ -#define VT100_UNDERLINE {ASCII_ESC, '[', '4', 'm'} /* Turn underline mode on */ -#define VT100_BLINK {ASCII_ESC, '[', '5', 'm'} /* Turn blinking mode on */ -#define VT100_REVERSE {ASCII_ESC, '[', '7', 'm'} /* Turn reverse video on */ -#define VT100_INVISIBLE {ASCII_ESC, '[', '8', 'm'} /* Turn invisible text mode on */ - -#define VT100_SETWIN(t,b) {ASCII_ESC, '[', (t), ';', (b), 'r'} /* Set top and bottom line#s of a window */ - -#define VT100_CURSORUP(n) {ASCII_ESC, '[', (n), 'A'} /* Move cursor up n lines */ -#define VT100_CURSORDN(n) {ASCII_ESC, '[', (n), 'B'} /* Move cursor down n lines */ -#define VT100_CURSORRT(n) {ASCII_ESC, '[', (n), 'C'} /* Move cursor right n lines */ -#define VT100_CURSORLF(n) {ASCII_ESC, '[', (n), 'D'} /* Move cursor left n lines */ -#define VT100_CURSORHOME {ASCII_ESC, '[', 'H'} /* Move cursor to upper left corner */ -#define VT100_CURSORHOME_ {ASCII_ESC, '[', ';', 'H'} /* Move cursor to upper left corner */ -#define VT100_CURSORPOS(v,h) {ASCII_ESC, '[', (v), ';', (h), 'H'} /* Move cursor to screen location v,h */ - -#define VT100_HVHOME {ASCII_ESC, '[', 'f'} /* Move cursor to upper left corner */ -#define VT100_HVHOME_ {ASCII_ESC, '[', ';', 'f'} /* Move cursor to upper left corner */ -#define VT100_HVPOS(v,h) {ASCII_ESC, '[', (v), ';', (h), 'f'} /* Move cursor to screen location v,h */ -#define VT100_INDEX {ASCII_ESC, 'D'} /* Move/scroll window up one line */ -#define VT100_REVINDEX {ASCII_ESC, 'M'} /* Move/scroll window down one line */ -#define VT100_NEXTLINE {ASCII_ESC, 'E'} /* Move to next line */ -#define VT100_SAVECURSOR {ASCII_ESC, '7'} /* Save cursor position and attributes */ -#define VT100_RESTORECURSOR {ASCII_ESC, '8'} /* Restore cursor position and attribute */ - -#define VT100_TABSET {ASCII_ESC, 'H'} /* Set a tab at the current column */ -#define VT100_TABCLR {ASCII_ESC, '[', 'g'} /* Clear a tab at the current column */ -#define VT100_TABCLR_ {ASCII_ESC, '[', '0', 'g'} /* Clear a tab at the current column */ -#define VT100_TABCLRALL {ASCII_ESC, '[', '3', 'g'} /* Clear all tabs */ - -#define VT100_DHTOP {ASCII_ESC, '#', '3'} /* Double-height letters, top half */ -#define VT100_DHBOT {ASCII_ESC, '#', '4'} /* Double-height letters, bottom hal */ -#define VT100_SWSH {ASCII_ESC, '#', '5'} /* Single width, single height letters */ -#define VT100_DWSH {ASCII_ESC, '#', '6'} /* Double width, single height letters */ - -#define VT100_CLEAREOL {ASCII_ESC, '[', 'K'} /* Clear line from cursor right */ -#define VT100_CLEAREOL_ {ASCII_ESC, '[', '0', 'K'} /* Clear line from cursor right */ -#define VT100_CLEARBOL {ASCII_ESC, '[', '1', 'K'} /* Clear line from cursor left */ -#define VT100_CLEARLINE {ASCII_ESC, '[', '2', 'K'} /* Clear entire line */ - -#define VT100_CLEAREOS {ASCII_ESC, '[', 'J'} /* Clear screen from cursor down */ -#define VT100_CLEAREOS_ {ASCII_ESC, '[', '0', 'J'} /* Clear screen from cursor down */ -#define VT100_CLEARBOS {ASCII_ESC, '[', '1', 'J'} /* Clear screen from cursor up */ -#define VT100_CLEARSCREEN {ASCII_ESC, '[', '2', 'J'} /* Clear entire screen */ - -#define VT100_DEVSTAT {ASCII_ESC, '5', 'n'} /* Device status report */ -#define VT100_TERMOK {ASCII_ESC, '0', 'n'} /* Response: terminal is OK */ -#define VT100_TERMNOK {ASCII_ESC, '3', 'n'} /* Response: terminal is not OK */ - -#define VT100_GETCURSOR {ASCII_ESC, '6', 'n'} /* Get cursor position */ -#define VT100_CURSORPOSAT {ASCII_ESC, (v), ';', (h), 'R'} /* Response: cursor is at v,h */ - -#define VT100_IDENT {ASCII_ESC, '[', 'c'} /* Identify what terminal type */ -#define VT100_IDENT_ {ASCII_ESC, '[', '0', 'c'} /* Identify what terminal type */ -#define VT100_GETTYPE {ASCII_ESC, '[', '?', '1', ';', (n), '0', 'c'} /* Response: terminal type code n */ - -#define VT100_RESET RIS {ASCII_ESC, 'c'} /* Reset terminal to initial state */ - -#define VT100_ALIGN {ASCII_ESC, '#', '8'} /* Screen alignment display */ -#define VT100_TESTPU {ASCII_ESC, '[', '2', ';', '1', 'y'} /* Confidence power up test */ -#define VT100_TESTLB {ASCII_ESC, '[', '2', ';', '2', 'y'} /* Confidence loopback test */ -#define VT100_TESTPUREP {ASCII_ESC, '[', '2', ';', '9', 'y'} /* Repeat power up test */ -#define VT100_TESTLBREP {ASCII_ESC, '[', '2', ';', '1', '0', 'y'} /* Repeat loopback test */ - -#define VT100_LEDSOFF {ASCII_ESC, '[', '0', 'q'} /* Turn off all four leds */ -#define VT100_LED1 {ASCII_ESC, '[', '1', 'q'} /* Turn on LED #1 */ -#define VT100_LED2 {ASCII_ESC, '[', '2', 'q'} /* Turn on LED #2 */ -#define VT100_LED3 {ASCII_ESC, '[', '3', 'q'} /* Turn on LED #3 */ -#define VT100_LED4 {ASCII_ESC, '[', '4', 'q'} /* Turn on LED #4 */ - -/* All codes below are for use in VT52 compatibility mode. */ - -#define VT52_SETANSI {ASCII_ESC, '<'} /* Enter/exit ANSI mode */ - -#define VT52_ALTKEYPAD {ASCII_ESC, '='} /* Enter alternate keypad mode */ -#define VT52_NUMKEYPAD {ASCII_ESC, '>'} /* Exit alternate keypad mode */ - -#define VT52_SETGR {ASCII_ESC, 'F'} /* Use special graphics character set */ -#define VT52_RESETGR {ASCII_ESC, 'G'} /* Use normal US/UK character set */ - -#define VT52_CURSORUP {ASCII_ESC, 'A'} /* Move cursor up one line */ -#define VT52_CURSORDN {ASCII_ESC, 'B'} /* Move cursor down one line */ -#define VT52_CURSORRT {ASCII_ESC, 'C'} /* Move cursor right one char */ -#define VT52_CURSORLF {ASCII_ESC, 'D'} /* Move cursor left one char */ -#define VT52_CURSORHOME {ASCII_ESC, 'H'} /* Move cursor to upper left corner */ -#define VT52_CURSORPOS(v,h) {ASCII_ESC, (v), (h)} /* Move cursor to v,h location */ -#define VT52_REVINDEX {ASCII_ESC, 'I'} /* Generate a reverse line-feed */ - -#define VT52_CLEAREOL {ASCII_ESC, 'K'} /* Erase to end of current line */ -#define VT52_CLEAREOS {ASCII_ESC, 'J'} /* Erase to end of screen */ - -#define VT52_IDENT {ASCII_ESC, 'Z'} /* Identify what the terminal is */ -#define VT52_IDENTRESP {ASCII_ESC, '/', 'Z'} /* Correct response to ident */ - -/* VT100 Special Key Codes - * - * These are sent from the terminal back to the computer when the particular - * key is pressed. Note that the numeric keypad keys send different codes - * in numeric mode than in alternate mode. - */ - -/* Function Keys */ - -#define VT100_PF1 {ASCII_ESC, 'O', 'P'} -#define VT100_PF2 {ASCII_ESC, 'O', 'Q'} -#define VT100_PF3 {ASCII_ESC, 'O', 'R'} -#define VT100_PF4 {ASCII_ESC, 'O', 'S'} - - -/* Arrow keys */ - -#define VT100_UP_RESET {ASCII_ESC, 'A'} -#define VT100_UP_SET {ASCII_ESC, 'O', 'A'} -#define VT100_DOWN_RESET {ASCII_ESC, 'B'} -#define VT100_DOWN_SET {ASCII_ESC, 'O', 'B'} -#define VT100_RIGHT_RESET {ASCII_ESC, 'C'} -#define VT100_RIGHT_SET {ASCII_ESC, 'O', 'C'} -#define VT100_LEFT_RESET {ASCII_ESC, 'D'} -#define VT100_LEFT_SET {ASCII_ESC, 'O', 'D'} - -/* Numeric Keypad Keys */ - -#define VT100_NUMERIC_0 {'0'} -#define VT100_ALT_0 {ASCII_ESC, 'O', 'p'} -#define VT100_NUMERIC_1 {'1'} -#define VT100_ALT_1 {ASCII_ESC, 'O', 'q'} -#define VT100_NUMERIC_2 {'2'} -#define VT100_ALT_2 {ASCII_ESC, 'O', 'r'} -#define VT100_NUMERIC_3 {'3'} -#define VT100_ALT_3 {ASCII_ESC, 'O', 's'} -#define VT100_NUMERIC_4 {'4'} -#define VT100_ALT_4 {ASCII_ESC, 'O', 't'} -#define VT100_NUMERIC_5 {'5'} -#define VT100_ALT_5 {ASCII_ESC, 'O', 'u'} -#define VT100_NUMERIC_6 {'6'} -#define VT100_ALT_6 {ASCII_ESC, 'O', 'v'} -#define VT100_NUMERIC_7 {'7'} -#define VT100_ALT_7 {ASCII_ESC, 'O', 'w'} -#define VT100_NUMERIC_8 {'8'} -#define VT100_ALT_8 {ASCII_ESC, 'O', 'x'} -#define VT100_NUMERIC_9 {'9', -#define VT100_ALT_9 {ASCII_ESC, 'O', 'y'} -#define VT100_NUMERIC_MINUS {'-'} -#define VT100_ALT_MINUS {ASCII_ESC, 'O', 'm'} -#define VT100_NUMERIC_COMMA {','} -#define VT100_ALT_COMMA {ASCII_ESC, 'O', 'l'} -#define VT100_NUMERIC_PERIOD {'.'} -#define VT100_ALT_PERIOD {ASCII_ESC, 'O', 'n'} -#define VT100_NUMERIC_ENTER {ASCII_CR} -#define VT100_ALT_ENTER {ASCII_ESC, 'O', 'M'} - -/******************************************************************************************** - * Public Data - ********************************************************************************************/ - -/******************************************************************************************** - * Public Function Prototypes - ********************************************************************************************/ - -#endif /* __INCLUDE_NUTTX_VT100_H */ diff --git a/nuttx/include/nuttx/watchdog.h b/nuttx/include/nuttx/watchdog.h deleted file mode 100644 index bcf8b1522..000000000 --- a/nuttx/include/nuttx/watchdog.h +++ /dev/null @@ -1,293 +0,0 @@ -/**************************************************************************** - * include/nuttx/watchdog.h - * - * Copyright (C) 2012 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_NUTTX_WATCHDOG_H -#define __INCLUDE_NUTTX_WATCHDOG_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include -#include -#include - -#ifdef CONFIG_WATCHDOG - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ -/* IOCTL Commands ***********************************************************/ -/* The watchdog driver uses a standard character driver framework. However, - * since the watchdog driver is a device control interface and not a data - * transfer interface, the majority of the functionality is implemented in - * driver ioctl calls. The watchdog ioctl commands are lised below: - * - * These are detected and handled by the "upper half" watchdog timer driver. - * - * WDIOC_START - Start the watchdog timer - * Argument: Ignored - * WDIOC_STOP - Stop the watchdog timer - * Argument: Ignored - * WDIOC_GETSTATUS - Get the status of the watchdog timer. - * Argument: A writeable pointer to struct watchdog_status_s. - * WDIOC_SETTIMEOUT - Reset the watchdog timeout to this value - * Argument: A 32-bit timeout value in milliseconds. - * WDIOC_CAPTURE - Do not reset. Instead, called this handler. - * Argument: A pointer to struct watchdog_capture_s. - * WDIOC_KEEPALIVE - Reset the watchdog timer ("ping", "pet the dog"); - * Argument: Ignored - * - * These may be supported by certain "lower half" drivers - * - * WDIOC_MINTIME - Set the minimum ping time. If two keepalive ioctls - * are received within this time, a reset event will - * be generated. This feature should assume to be - * disabled after WDIOC_SETTIMEOUT. - * Argument: A 32-bit time value in milliseconds. - */ - -#define WDIOC_START _WDIOC(0x001) -#define WDIOC_STOP _WDIOC(0x002) -#define WDIOC_GETSTATUS _WDIOC(0x003) -#define WDIOC_SETTIMEOUT _WDIOC(0x004) -#define WDIOC_CAPTURE _WDIOC(0x005) -#define WDIOC_KEEPALIVE _WDIOC(0x006) - -#define WDIOC_MINTIME _WDIOC(0x080) - -/* Bit Settings *************************************************************/ -/* Bit settings for the struct watchdog_status_s flags field */ - -#define WDFLAGS_ACTIVE (1 << 0) /* 1=The watchdog timer is running */ -#define WDFLAGS_RESET (1 << 1) /* 1=Reset when the watchog timer expires */ -#define WDFLAGS_CAPTURE (1 << 2) /* 1=Call the user function when the - * watchdog timer expires */ - -/**************************************************************************** - * Public Types - ****************************************************************************/ -/* This is the type of the argument passed to the WDIOC_CAPTURE ioctl */ - -struct watchdog_capture_s -{ - CODE xcpt_t newhandler; /* The new watchdog capture handler */ - CODE xcpt_t oldhandler; /* The previous watchdog capture handler (if any) */ -}; - -/* This is the type of the argument passed to the WDIOC_GETSTATUS ioctl and - * and returned by the "lower half" getstatus() method. - */ - -struct watchdog_status_s -{ - uint32_t flags; /* See WDFLAGS_* definitions above */ - uint32_t timeout; /* The current timeout setting (in milliseconds) */ - uint32_t timeleft; /* Time left until the watchdog expiration - * (in milliseconds) */ -}; - -/* This structure provides the "lower-half" driver operations available to - * the "upper-half" driver. - */ - -struct watchdog_lowerhalf_s; -struct watchdog_ops_s -{ - /* Required methods ********************************************************/ - /* Start the watchdog timer, resetting the time to the current timeout */ - - CODE int (*start)(FAR struct watchdog_lowerhalf_s *lower); - - /* Stop the watchdog timer */ - - CODE int (*stop)(FAR struct watchdog_lowerhalf_s *lower); - - /* Optional methods ********************************************************/ - /* Reset the watchdog timer to the current timeout value, prevent any - * imminent watchdog timeouts. This is sometimes referred as "pinging" the - * watchdog timer or "petting the dog". - */ - - CODE int (*keepalive)(FAR struct watchdog_lowerhalf_s *lower); - - /* Get the current watchdog timer status */ - - CODE int (*getstatus)(FAR struct watchdog_lowerhalf_s *lower, - FAR struct watchdog_status_s *status); - - /* Set a new timeout value (and reset the watchdog timer) */ - - CODE int (*settimeout)(FAR struct watchdog_lowerhalf_s *lower, - uint32_t timeout); - - /* Don't reset on watchdog timer timeout; instead, call this user provider - * timeout handler. NOTE: Providing handler==NULL will restore the reset - * behavior. - */ - - CODE xcpt_t (*capture)(FAR struct watchdog_lowerhalf_s *lower, - CODE xcpt_t handler); - - /* Any ioctl commands that are not recognized by the "upper-half" driver - * are forwarded to the lower half driver through this method. - */ - - CODE int (*ioctl)(FAR struct watchdog_lowerhalf_s *lower, int cmd, - unsigned long arg); -}; - -/* This structure provides the publicly visible representation of the - * "lower-half" driver state structure. "lower half" drivers will have an - * internal structure definition that will be cast-compatible with this - * structure definitions. - */ - -struct watchdog_lowerhalf_s -{ - /* Publicly visible portion of the "lower-half" driver state structure. */ - - FAR const struct watchdog_ops_s *ops; /* Lower half operations */ - - /* The remainder of the structure is used by the "lower-half" driver - * for whatever state storage that it may need. - */ -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * "Upper-Half" Watchdog Driver Interfaces - ****************************************************************************/ -/**************************************************************************** - * Name: watchdog_register - * - * Description: - * This function binds an instance of a "lower half" watchdog driver with the - * "upper half" watchdog device and registers that device so that can be used - * by application code. - * - * When this function is called, the "lower half" driver should be in the - * disabled state (as if the stop() method had already been called). - * - * NOTE: Normally, this function would not be called by application code. - * Rather it is called indirectly through the architecture-specific - * interface up_wdginitialize() described below. - * - * Input parameters: - * dev path - The full path to the driver to be registers in the NuttX - * pseudo-filesystem. The recommended convention is to name all watchdog - * drivers as "/dev/watchdog0", "/dev/watchdog1", etc. where the driver - * path differs only in the "minor" number at the end of the device name. - * lower - A pointer to an instance of lower half watchdog driver. This - * instance is bound to the watchdog driver and must persists as long as - * the driver persists. - * - * Returned Value: - * On success, a non-NULL handle is returned to the caller. In the event - * of any failure, a NULL value is returned. - * - ****************************************************************************/ - -EXTERN FAR void *watchdog_register(FAR const char *path, - FAR struct watchdog_lowerhalf_s *lower); - -/**************************************************************************** - * Name: watchdog_unregister - * - * Description: - * This function can be called to disable and unregister the watchdog - * device driver. - * - * Input parameters: - * handle - This is the handle that was returned by watchdog_register() - * - * Returned Value: - * None - * - ****************************************************************************/ - -EXTERN void watchdog_unregister(FAR void *handle); - -/**************************************************************************** - * Platform-Independent "Lower-Half" Watchdog Driver Interfaces - ****************************************************************************/ - -/**************************************************************************** - * Architecture-specific Application Interfaces - ****************************************************************************/ - -/**************************************************************************** - * Name: up_wdginitialize() - * - * Description: - * Perform architecture-specific initialization of the Watchdog hardware. - * This interface should be provided by all configurations using - * to avoid exposed platform-dependent logic. - * - * At a minimum, this function should all watchdog_register() which is - * described above. - * - * Input parameters: - * None - * - * Returned Value: - * Zero on success; a negated errno value on failure. - * - ****************************************************************************/ - -EXTERN int up_wdginitialize(void); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_WATCHDOG */ -#endif /* __INCLUDE_NUTTX_WATCHDOG_H */ diff --git a/nuttx/include/nuttx/wireless/cc1101.h b/nuttx/include/nuttx/wireless/cc1101.h deleted file mode 100644 index 9d6b2a673..000000000 --- a/nuttx/include/nuttx/wireless/cc1101.h +++ /dev/null @@ -1,464 +0,0 @@ -/**************************************************************************** - * include/nuttx/wireless/cc1101.h - * - * Copyright (C) 2011 Uros Platise. All rights reserved. - * - * Authors: 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. - * - ****************************************************************************/ - -/** \file - * \author Uros Platise - * \brief Chipcon CC1101 Device Driver - **/ - -#ifndef __INCLUDE_NUTTX_WIRELESS_CC1101_H -#define __INCLUDE_NUTTX_WIRELESS_CC1101_H - -#include -#include - -#include -#include - -/**************************************************************************** - * Pre-Processor Declarations - ****************************************************************************/ - -/* Present maximum packet length */ - -#define CC1101_PACKET_MAXTOTALLEN 63 -#define CC1101_PACKET_MAXDATALEN 61 - -/* - * General Purpose, Test Output Pin Options - */ - -/* CC1101 General Purpose Pins */ - -#define CC1101_PIN_GDO0 2 -#define CC1101_PIN_GDO1 1 -#define CC1101_PIN_GDO2 0 - -/* Associated to the RX FIFO: Asserts when RX FIFO is filled at or above - * the RX FIFO threshold. De-asserts when RX FIFO is drained below the - * same threshold. */ -#define CC1101_GDO_RXFIFO_THR 0x00 - -/* Associated to the RX FIFO: Asserts when RX FIFO is filled at or above - * the RX FIFO threshold or the end of packet is reached. De-asserts when - * the RX FIFO is empty. */ -#define CC1101_GDO_RXFIFO_THREND 0x01 - -/* Associated to the TX FIFO: Asserts when the TX FIFO is filled at or - * above the TX FIFO threshold. De-asserts when the TX FIFO is below the - * same threshold. */ -#define CC1101_GDO_TXFIFO_THR 0x02 - -/* Associated to the TX FIFO: Asserts when TX FIFO is full. De-asserts - * when the TX FIFO is drained below theTX FIFO threshold. */ -#define CC1101_GDO_TXFIFO_FULL 0x03 - -/* Asserts when the RX FIFO has overflowed. De-asserts when the FIFO has - * been flushed. */ -#define CC1101_GDO_RXFIFO_OVR 0x04 - -/* Asserts when the TX FIFO has underflowed. De-asserts when the FIFO is - * flushed. */ -#define CC1101_GDO_TXFIFO_UNR 0x05 - -/* Asserts when sync word has been sent / received, and de-asserts at the - * end of the packet. In RX, the pin will de-assert when the optional - * address check fails or the RX FIFO overflows. In TX the pin will - * de-assert if the TX FIFO underflows. */ -#define CC1101_GDO_SYNC 0x06 - -/* Asserts when a packet has been received with CRC OK. De-asserts when - * the first byte is read from the RX FIFO. */ -#define CC1101_GDO_PKTRCV_CRCOK 0x07 - -/* Preamble Quality Reached. Asserts when the PQI is above the programmed - * PQT value. */ -#define CC1101_GDO_PREAMBLE 0x08 - -/* Clear channel assessment. High when RSSI level is below threshold - * (dependent on the current CCA_MODE setting). */ -#define CC1101_GDO_CHCLEAR 0x09 - -/* Lock detector output. The PLL is in lock if the lock detector output - * has a positive transition or is constantly logic high. To check for - * PLL lock the lock detector output should be used as an interrupt for - * the MCU. */ -#define CC1101_GDO_LOCK 0x0A - -/* Serial Clock. Synchronous to the data in synchronous serial mode. - * In RX mode, data is set up on the falling edge by CC1101 when GDOx_INV=0. - * In TX mode, data is sampled by CC1101 on the rising edge of the serial - * clock when GDOx_INV=0. */ -#define CC1101_GDO_SSCLK 0x0B - -/* Serial Synchronous Data Output. Used for synchronous serial mode. */ -#define CC1101_GDO_SSDO 0x0C - -/* Serial Data Output. Used for asynchronous serial mode. */ -#define CC1101_GDO_ASDO 0x0D - -/* Carrier sense. High if RSSI level is above threshold. */ -#define CC1101_GDO_CARRIER 0x0E - -/* CRC_OK. The last CRC comparison matched. Cleared when entering or - * restarting RX mode. */ -#define CC1101_GDO_CRCOK 0x0F - -/* RX_HARD_DATA[1]. Can be used together with RX_SYMBOL_TICK for - * alternative serial RX output. */ -#define CC1101_GDO_RXOUT1 0x16 - -/* RX_HARD_DATA[0]. Can be used together with RX_SYMBOL_TICK for - * alternative serial RX output. */ -#define CC1101_GDO_RXOUT0 0x17 - -/* PA_PD. Note: PA_PD will have the same signal level in SLEEP and TX - * states. To control an external PA or RX/TX switch in applications - * where the SLEEP state is used it is recommended to use GDOx_CFGx=0x2F - * instead. */ -#define CC1101_GDO_PA_PD 0x1B - -/* LNA_PD. Note: LNA_PD will have the same signal level in SLEEP and RX - * states. To control an external LNA or RX/TX switch in applications - * where the SLEEP state is used it is recommended to use GDOx_CFGx=0x2F - * instead. */ -#define CC1101_GDO_LNA_PD 0x1C - -/* RX_SYMBOL_TICK. Can be used together with RX_HARD_DATA for alternative - * serial RX output. */ -#define CC1101_GDO_RXSYMTICK 0x1D - -#define CC1101_GDO_WOR_EVNT0 0x24 -#define CC1101_GDO_WOR_EVNT1 0x25 -#define CC1101_GDO_CLK32K 0x27 -#define CC1101_GDO_CHIP_RDYn 0x29 -#define CC1101_GDO_XOSC_STABLE 0x2B - -/* GDO0_Z_EN_N. When this output is 0, GDO0 is configured as input - * (for serial TX data). */ -#define CC1101_GDO_GDO0_Z_EN_N 0x2D - -/* High impedance (3-state). */ -#define CC1101_GDO_HIZ 0x2E - -/* HW to 0 (HW1 achieved by setting GDOx_INV=1). Can be used to control - * an external LNA/PA or RX/TX switch. */ -#define CC1101_GDO_HW 0x2F - -/* There are 3 GDO pins, but only one CLK_XOSC/n can be selected as an - * output at any time. If CLK_XOSC/n is to be monitored on one of the - * GDO pins, the other two GDO pins must be configured to values less - * than 0x30. The GDO0 default value is CLK_XOSC/192. To optimize RF - * performance, these signals should not be used while the radio is - * in RX or TX mode. */ -#define CC1101_GDO_CLK_XOSC1 0x30 -#define CC1101_GDO_CLK_XOSC1_5 0x31 -#define CC1101_GDO_CLK_XOSC2 0x32 -#define CC1101_GDO_CLK_XOSC3 0x33 -#define CC1101_GDO_CLK_XOSC4 0x34 -#define CC1101_GDO_CLK_XOSC6 0x35 -#define CC1101_GDO_CLK_XOSC8 0x36 -#define CC1101_GDO_CLK_XOSC12 0x37 -#define CC1101_GDO_CLK_XOSC16 0x38 -#define CC1101_GDO_CLK_XOSC24 0x39 -#define CC1101_GDO_CLK_XOSC32 0x3A -#define CC1101_GDO_CLK_XOSC48 0x3B -#define CC1101_GDO_CLK_XOSC64 0x3C -#define CC1101_GDO_CLK_XOSC96 0x3D -#define CC1101_GDO_CLK_XOSC128 0x3E -#define CC1101_GDO_CLK_XOSC192 0x3F - - -#ifndef __ASSEMBLY__ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Data Types - ****************************************************************************/ - -struct cc1101_dev_s; - -/** The RF Settings includes only those fields required to configure - * the RF radio. Other configuration fields depended on this driver - * are configured by the cc1101_init(). - */ -struct c1101_rfsettings_s { - uint8_t FSCTRL1; /* Frequency synthesizer control. */ - uint8_t FSCTRL0; /* Frequency synthesizer control. */ - - uint8_t FREQ2; /* Frequency control word, high byte. */ - uint8_t FREQ1; /* Frequency control word, middle byte. */ - uint8_t FREQ0; /* Frequency control word, low byte. */ - - uint8_t MDMCFG4; /* Modem configuration. */ - uint8_t MDMCFG3; /* Modem configuration. */ - uint8_t MDMCFG2; /* Modem configuration. */ - uint8_t MDMCFG1; /* Modem configuration. */ - uint8_t MDMCFG0; /* Modem configuration. */ - - uint8_t DEVIATN; /* Modem deviation setting (when FSK modulation is enabled). */ - - /* GAP */ - - uint8_t FOCCFG; /* Frequency Offset Compensation Configuration. */ - - uint8_t BSCFG; /* Bit synchronization Configuration. */ - - uint8_t AGCCTRL2; /* AGC control. */ - uint8_t AGCCTRL1; /* AGC control. */ - uint8_t AGCCTRL0; /* AGC control. */ - - /* GAP */ - - uint8_t FREND1; /* Front end RX configuration. */ - uint8_t FREND0; /* Front end RX configuration. */ - - uint8_t FSCAL3; /* Frequency synthesizer calibration. */ - uint8_t FSCAL2; /* Frequency synthesizer calibration. */ - uint8_t FSCAL1; /* Frequency synthesizer calibration. */ - uint8_t FSCAL0; /* Frequency synthesizer calibration. */ - - /* REGULATORY LIMITS */ - - uint8_t CHMIN; /* Channel Range defintion MIN .. */ - uint8_t CHMAX; /* .. and MAX */ - uint8_t PAMAX; /* at given maximum output power */ - - /* Power Table, for ramp-up/down and ASK modulation defined for - * output power values as: - * PA = {-30, -20, -15, -10, -5, 0, 5, 10} [dBm] - */ - uint8_t PA[8]; -}; - - -/**************************************************************************** - * RF Configuration Database - ****************************************************************************/ - -EXTERN const struct c1101_rfsettings_s - -// \todo Recalculate ERP in maximum power level - -/* 868 MHz, GFSK, 100 kbps, ISM Region 1 (Europe only) - * - * ISM Region 1 (Europe) only, Band 868–870 MHz - * - * Frequency bands for non-specific short range devices in Europe: - * - * Frequency ERP Duty Cycle Bandwidth Remarks - * 868 – 868.6 MHz +14 dBm < 1% No limits - * 868.7 – 869.2 MHz +14 dBm < 0.1% No limits - * 869.3 – 869.4 MHz +10 dBm No limits < 25 kHz Appropriate access protocol required - * 869.4 – 869.65 MHz +27 dBm < 10% < 25 kHz Channels may be combined to one high speed channel - * 869.7 -870 MHz +7 dBm No limits No limits - * - * Frequency Band For License-Free Specific Applications in Europe - * - * Frequency Application ERP Duty Cycle Bandwidth - * 868.6 – 868.7 MHz Alarms +10 dBm < 0.1% 25 kHz(1) - * 869.2 – 869.25 MHz Social Alarms +10 dBm < 0.1% 25 kHz - * 869.25 – 869.3 MHz Alarms +10 dBm < 0.1% 25 kHz - * 869.65 -869.7 MHz Alarms +14 dBm < 10% 25 kHz - * 863 – 865 MHz Radio Microphones +10 dBm No limits 200 kHz - * 863 -865 MHz Wireless Audio Applications +10 dBm No limits 300 kHz - * - * Duty Cycle Limit Total On Time Maximum On Time of Minimum Off Time of - * Within One Hour One Transmission Two Transmission - * < 0.1% 3.6 seconds 0.72 seconds 0.72 seconds - * < 1% 36 seconds 3.6 seconds 1.8 seconds - * < 10% 360 seconds 36 seconds 3.6 seconds - * - * Reference: TI Application Report: swra048.pdf, May 2005 - * ISM-Band and Short Range Device Regulatory Compliance Overview - */ - cc1101_rfsettings_ISM1_868MHzGFSK100kbps, - - -/* 905 MHz, GFSK, 250 kbps, ISM Region 2 (America only) - * - * ISM Region 2 (America) only, Band 902–928 MHz - * - * Cordless phones 1 W - * Microwave ovens 750 W - * Industrial heaters 100 kW - * Military radar 1000 kW - */ - cc1101_rfsettings_ISM2_905MHzGFSK250kbps; - - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/** Initialize Chipcon CC1101 Chip. - * After initialization CC1101 is ready to listen, receive and transmit - * messages on the default channel 0 at given RF configuration. - * - * \param spi SPI Device Structure - * \param isrpin Select the CC1101_PIN_GDOx used to signal interrupts - * \param rfsettings Pointer to default RF Settings loaded at boot time. - * \return Pointer to newly allocated CC1101 structure or NULL on error with errno set. - * - * Possible errno as set by this function on error: - * - ENODEV: When device addressed is not compatible or it is not a CC1101 - * - EFAULT: When there is no device - * - ENOMEM: Out of kernel memory to allocate the device - * - EBUSY: When device is already addressed by other device driver (not yet supported by low-level driver) - **/ -EXTERN struct cc1101_dev_s * cc1101_init(struct spi_dev_s * spi, uint8_t isrpin, - uint32_t pinset, const struct c1101_rfsettings_s * rfsettings); - - -/** Deinitialize Chipcon CC1101 Chip - * - * \param dev Device to CC1101 device structure, as returned by the cc1101_init() - * \return OK On success - * - **/ -EXTERN int cc1101_deinit(struct cc1101_dev_s * dev); - - -/** Power up device, start conversion. \return Zero on success. */ -EXTERN int cc1101_powerup(struct cc1101_dev_s * dev); - -/** Power down device, stop conversion. \return Zero on success. */ -EXTERN int cc1101_powerdown(struct cc1101_dev_s * dev); - -/** Set Multi Purpose Output Function. \return Zero on success. */ -EXTERN int cc1101_setgdo(struct cc1101_dev_s * dev, uint8_t pin, uint8_t function); - -/** Set RF settings. Use one from the database above. */ -EXTERN int cc1101_setrf(struct cc1101_dev_s * dev, const struct c1101_rfsettings_s *settings); - -/** Set Channel. - * Note that regulatory check is made and sending may be prohibited. - * - * \retval 0 On success, sending and receiving is allowed. - * \retval 1 Only receive mode is allowed. - * \retval <0 On error. - */ -EXTERN int cc1101_setchannel(struct cc1101_dev_s * dev, uint8_t channel); - - -/** Set Output Power - * - * \param power Value from 0 - 8, where 0 means power off, and values - * from 1 .. 8 denote the following output power in dBm: - * {-30, -20, -15, -10, -5, 0, 5, 10} [dBm] - * - * If power is above the regulatory limit (defined by the RF settings) - * it is limited. - * - * \return Actual output power in range from 0..8. - */ -EXTERN uint8_t cc1101_setpower(struct cc1101_dev_s * dev, uint8_t power); - - -/** Convert RSSI as obtained from CC1101 to [dBm] */ -EXTERN int cc1101_calcRSSIdBm(int rssi); - - -/** Enter receive mode and wait for a packet. - * If transmission is in progress, receive mode is entered upon its - * completion. As long cc1101_idle() is not called, each transmission - * returns to receive mode. - * - * \param dev Device to CC1101 structure - * \return Zero on success. - */ -EXTERN int cc1101_receive(struct cc1101_dev_s * dev); - - -/** Read received packet - * - * If size of buffer is too small then the remaining part of data can - * be discarded by the driver. - * - * Packet contains raw data, including the two bytes: - * - RSSI and - * - LQI - * appended at the end of the message. - * - * To inquery about the data pending size you the following: - * - pass buf=NULL and size > 0, returns pending data packet size - * - pass buf=NULL and size = 0, returns maximum data packet size - * - * NOTE: messages length are typically defined by the MAC, transmit/ - * receive windows at some rate. - */ -EXTERN int cc1101_read(struct cc1101_dev_s * dev, uint8_t * buf, size_t size); - - -/** Write data to be send, using the cc1101_send() - * - * \param dev Device to CC1101 structure - * \param buf Pointer to data. - * \param size Size must be within limits, otherwise data is truncated. - * Present driver limitation supports a single cc1101_write() - * prioer cc1101_send() is called. - */ -EXTERN int cc1101_write(struct cc1101_dev_s * dev, const uint8_t * buf, size_t size); - - -/** Send data previously writtenusing cc1101_write() - * - * \param dev Device to CC1101 structure - * \return Zero on success. - */ -EXTERN int cc1101_send(struct cc1101_dev_s * dev); - - -/** Enter idle state (after reception and transmission completes). - * - * \return Zero on success. - */ -EXTERN int cc1101_idle(struct cc1101_dev_s * dev); - - -#undef EXTERN -#if defined(__cplusplus) -} -#endif -#endif /* __ASSEMBLY__ */ -#endif /* __INCLUDE_NUTTX_WIRELESS_CC1101_H */ diff --git a/nuttx/include/nuttx/wqueue.h b/nuttx/include/nuttx/wqueue.h deleted file mode 100644 index d56901d89..000000000 --- a/nuttx/include/nuttx/wqueue.h +++ /dev/null @@ -1,271 +0,0 @@ -/**************************************************************************** - * include/nuttx/wqueue.h - * - * Copyright (C) 2009, 2011-2012 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_NUTTX_WQUEUE_H -#define __INCLUDE_NUTTX_WQUEUE_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* CONFIG_SCHED_WORKQUEUE. Create a dedicated "worker" thread to - * handle delayed processing from interrupt handlers. This feature - * is required for some drivers but, if there are not complaints, - * can be safely disabled. The worker thread also performs - * garbage collection -- completing any delayed memory deallocations - * from interrupt handlers. If the worker thread is disabled, - * then that clean will be performed by the IDLE thread instead - * (which runs at the lowest of priority and may not be appropriate - * if memory reclamation is of high priority). If CONFIG_SCHED_WORKQUEUE - * is enabled, then the following options can also be used: - * CONFIG_SCHED_WORKPRIORITY - The execution priority of the worker - * thread. Default: 192 - * CONFIG_SCHED_WORKPERIOD - How often the worker thread checks for - * work in units of microseconds. Default: 50*1000 (50 MS). - * CONFIG_SCHED_WORKSTACKSIZE - The stack size allocated for the worker - * thread. Default: CONFIG_IDLETHREAD_STACKSIZE. - * CONFIG_SIG_SIGWORK - The signal number that will be used to wake-up - * the worker thread. Default: 17 - * - * CONFIG_SCHED_LPWORK. If CONFIG_SCHED_WORKQUEUE is defined, then a single - * work queue is created by default. If CONFIG_SCHED_LPWORK is also defined - * then an additional, lower-priority work queue will also be created. This - * lower priority work queue is better suited for more extended processing - * (such as file system clean-up operations) - * CONFIG_SCHED_LPWORKPRIORITY - The execution priority of the lower priority - * worker thread. Default: 50 - * CONFIG_SCHED_LPWORKPERIOD - How often the lower priority worker thread - * checks for work in units of microseconds. Default: 50*1000 (50 MS). - * CONFIG_SCHED_LPWORKSTACKSIZE - The stack size allocated for the lower - * priority worker thread. Default: CONFIG_IDLETHREAD_STACKSIZE. - */ - -#ifndef CONFIG_SCHED_WORKPRIORITY -# define CONFIG_SCHED_WORKPRIORITY 192 -#endif - -#ifndef CONFIG_SCHED_WORKPERIOD -# define CONFIG_SCHED_WORKPERIOD (50*1000) /* 50 milliseconds */ -#endif - -#ifndef CONFIG_SCHED_WORKSTACKSIZE -# define CONFIG_SCHED_WORKSTACKSIZE CONFIG_IDLETHREAD_STACKSIZE -#endif - -#ifdef CONFIG_SCHED_LPWORK -# ifndef CONFIG_SCHED_LPWORKPRIORITY -# define CONFIG_SCHED_LPWORKPRIORITY 50 -# endif - -# ifndef CONFIG_SCHED_LPWORKPERIOD -# define CONFIG_SCHED_LPWORKPERIOD (50*1000) /* 50 milliseconds */ -# endif - -# ifndef CONFIG_SCHED_LPWORKSTACKSIZE -# define CONFIG_SCHED_LPWORKSTACKSIZE CONFIG_IDLETHREAD_STACKSIZE -# endif -#endif - -/* Work queue IDs (indices): - * - * Kernel Work Queues: - * HPWORK: This ID of the high priority work queue that should only be used for - * hi-priority, time-critical, driver bottom-half functions. - * - * LPWORK: This is the ID of the low priority work queue that can be used for any - * purpose. if CONFIG_SCHED_LPWORK is not defined, then there is only one kernel - * work queue and LPWORK == HPWORK. - * - * User Work Queue: - * USRWORK: CONFIG_NUTTX_KERNEL and CONFIG_SCHED_USRWORK are defined, then NuttX - * will also support a user-accessible work queue. Otherwise, USRWORK == LPWORK. - */ - -#define HPWORK 0 -#ifdef CONFIG_SCHED_LPWORK -# define LPWORK (HPWORK+1) -#else -# define LPWORK HPWORK -#endif - -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_SCHED_USRWORK) -# warning "Feature not implemented" -# define USRWORK (LPWORK+1) -#else -# define USRWORK LPWORK -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -#ifndef __ASSEMBLY__ - -/* Defines the work callback */ - -typedef void (*worker_t)(FAR void *arg); - -/* Defines one entry in the work queue. The user only needs this structure - * in order to declare instances of the work structure. Handling of all - * fields is performed by the work APIs - */ - -struct work_s -{ - struct dq_entry_s dq; /* Implements a doubly linked list */ - worker_t worker; /* Work callback */ - FAR void *arg; /* Callback argument */ - uint32_t qtime; /* Time work queued */ - uint32_t delay; /* Delay until work performed */ -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Name: work_queue - * - * Description: - * Queue work to be performed at a later time. All queued work will be - * performed on the worker thread of of execution (not the caller's). - * - * The work structure is allocated by caller, but completely managed by - * the work queue logic. The caller should never modify the contents of - * the work queue structure; the caller should not call work_queue() - * again until either (1) the previous work has been performed and removed - * from the queue, or (2) work_cancel() has been called to cancel the work - * and remove it from the work queue. - * - * Input parameters: - * qid - The work queue ID - * work - The work structure to queue - * worker - The worker callback to be invoked. The callback will invoked - * on the worker thread of execution. - * arg - The argument that will be passed to the workder callback when - * int is invoked. - * delay - Delay (in clock ticks) from the time queue until the worker - * is invoked. Zero means to perform the work immediately. - * - * Returned Value: - * Zero on success, a negated errno on failure - * - ****************************************************************************/ - -EXTERN int work_queue(int qid, FAR struct work_s *work, worker_t worker, - FAR void *arg, uint32_t delay); - -/**************************************************************************** - * Name: work_cancel - * - * Description: - * Cancel previously queued work. This removes work from the work queue. - * After work has been canceled, it may be re-queue by calling work_queue() - * again. - * - * Input parameters: - * qid - The work queue ID - * work - The previously queue work structure to cancel - * - * Returned Value: - * Zero on success, a negated errno on failure - * - ****************************************************************************/ - -EXTERN int work_cancel(int qid, FAR struct work_s *work); - -/**************************************************************************** - * Name: work_signal - * - * Description: - * Signal the worker thread to process the work queue now. This function - * is used internally by the work logic but could also be used by the - * user to force an immediate re-assessment of pending work. - * - * Input parameters: - * qid - The work queue ID - * - * Returned Value: - * Zero on success, a negated errno on failure - * - ****************************************************************************/ - -EXTERN int work_signal(int qid); - -/**************************************************************************** - * Name: work_available - * - * Description: - * Check if the work structure is available. - * - * Input parameters: - * None - * - * Returned Value: - * true if available; false if busy (i.e., there is still pending work). - * - ****************************************************************************/ - -#define work_available(work) ((work)->worker == NULL) - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __ASSEMBLY__ */ -#endif /* __INCLUDE_NUTTX_WQUEUE_H */ diff --git a/nuttx/include/nxflat.h b/nuttx/include/nxflat.h deleted file mode 100644 index 82e667897..000000000 --- a/nuttx/include/nxflat.h +++ /dev/null @@ -1,204 +0,0 @@ -/**************************************************************************** - * include/nxflat.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 __INCLUDE_NXFLAT_H -#define __INCLUDE_NXFLAT_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define NXFLAT_MAX_STRING_SIZE 64 /* Largest size of string (w/zterminator) */ -#define NXFLAT_MAGIC "NxFT" /* NXFLAT magic number */ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * The NXFLAT file header - * - * The elements within this structure are stored in network order (i.e., - * ntohs() and ntohl() should be used to access fields within the - * header. - ****************************************************************************/ - -struct nxflat_hdr_s -{ - /* The "magic number" identifying the file type. This field should contain - * "NxFT". NOTE that there is no other versioning information other than - * this magic number. - */ - - char h_magic[4]; - - /* The following fields provide the memory map for the nxflat binary. - * - * h_entry - Offset to the first executable insruction from - * the beginning of the file. - * h_datastart - Offset to the beginning of the data segment from - * the beginning of the file. This field can also - * interpreted as the size of the ISpace segment. - * h_dataend - Offset to the end of the data segment from the - * beginning of the file. - * h_bssend - Offset to the end of bss segment from the beginning - * of the file. - * - * The text segment can be considered to be the contiguous (unrelocated) - * address space range from address zero through (but not including) - * h_datastart. - * - * The size of the data/bss segment includes (as a minimum) the data - * and bss regions (bss_end - data_start) as well as the size of the - * stack. At run time, this region will also include program arguments - * and environement variables. - * - * The bss segment is data_end through bss_end. - */ - - uint32_t h_entry; - uint32_t h_datastart; - uint32_t h_dataend; - uint32_t h_bssend; - - /* Size of stack, in bytes */ - - uint32_t h_stacksize; - - /* Relocation entries: - * - * h_relocstart - Offset to the beginning of an array of relocation - * records (struct nxflat_reloc). The offset is - * relative to the start of the file - */ - - uint32_t h_relocstart; /* Offset of relocation records */ - - /* Imported symbol table (NOTE no symbols are exported): - * - * h_importsymbols - Offset to the beginning of an array of imported - * symbol structures (struct nxflat_import_s). The - * h_importsymbols offset is relative to the - * beginning of the file. Each entry of the - * array contains an uint32_t offset (again from - * the beginning of the file) to the name of - * a symbol string. This string is null-terminated. - */ - - uint32_t h_importsymbols; /* Offset to list of imported symbols */ - - /* 16-bit counts - * - * h_reloccount - The number of relocation records in the arry - * h_importcount - The number of records in the h_importsymbols array. - */ - - uint16_t h_reloccount; /* Number of relocation records */ - uint16_t h_importcount; /* Number of imported symbols */ -}; - -/**************************************************************************** - * NXFLAT Relocation types. - * - * The relocation records are an array of the following type. - ****************************************************************************/ - -struct nxflat_reloc_s -{ - uint32_t r_info; /* Bit-encoded relocation info */ -}; - -/* Pack the type and the offset into one 32-bit value */ - -#define NXFLAT_RELOC(t,o) (((uint32_t)((t) & 3) << 30) | ((o) & 0x3fffffff)) - -/* The top three bits of the relocation info is the relocation type (see the - * NXFLAT_RELOC_TYPE_* definitions below. This is an unsigned value. - */ - -#define NXFLAT_RELOC_TYPE(r) ((uint32_t)(r) >> 30) - -/* The bottom 28 bits of the relocation info is the (non-negative) offset into - * the D-Space that needs the fixup. - */ - -#define NXFLAT_RELOC_OFFSET(r) ((uint32_t)(r) & 0x3fffffff) - -/* These are possible values for the relocation type: - * - * NXFLAT_RELOC_TYPE_REL32I Meaning: Object file contains a 32-bit offset - * into I-Space at the offset. - * Fixup: Add mapped I-Space address to the offset. - * NXFLAT_RELOC_TYPE_REL32D Meaning: Object file contains a 32-bit offset - * into D-Space at the offset. - * Fixup: Add allocated D-Space address to the - * offset. - * NXFLAT_RELOC_TYPE_REL32ID Meaning: Object file contains a 32-bit offset - * into I-Space at the offset that will - * unfortunately be references relative - * to the GOT - * Fixup: Add allocated the mapped I-Space - * address MINUS the allocated D-Space - * address to the offset. - */ - -#define NXFLAT_RELOC_TYPE_REL32I 0 -#define NXFLAT_RELOC_TYPE_REL32D 1 -#undef NXFLAT_RELOC_TYPE_REL32ID /* May not need */ -#define NXFLAT_RELOC_TYPE_NUM 2 /* Number of relocation types */ - -/**************************************************************************** - * NXFLAT Imported symbol type - * - * The imported symbols are an array of the following type. The fields - * in each element are stored in native machine order. - ****************************************************************************/ - -struct nxflat_import_s -{ - uint32_t i_funcname; /* Offset to name of imported function */ - uint32_t i_funcaddress; /* Resolved address of imported function */ -}; - -#endif /* __INCLUDE_NXFLAT_H */ diff --git a/nuttx/include/poll.h b/nuttx/include/poll.h deleted file mode 100644 index 3bf4c4bad..000000000 --- a/nuttx/include/poll.h +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** - * include/poll.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 __INCLUDE_POLL_H -#define __INCLUDE_POLL_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Poll event definitions: - * - * POLLIN - * Data other than high-priority data may be read without blocking. - * POLLRDNORM - * Normal data may be read without blocking. - * POLLRDBAND - * Priority data may be read without blocking. - * POLLPRI - * High priority data may be read without blocking. - * POLLOUT - * Normal data may be written without blocking. - * POLLWRNORM - * Equivalent to POLLOUT. - * POLLWRBAND - * Priority data may be written. - * POLLERR - * An error has occurred (revents only). - * POLLHUP - * Device has been disconnected (revents only). - * POLLNVAL - * Invalid fd member (revents only). - */ - -#define POLLIN (0x01) /* NuttX does not make priority distinctions */ -#define POLLRDNORM (0x01) -#define POLLRDBAND (0x01) -#define POLLPRI (0x01) - -#define POLLOUT (0x02) /* NuttX does not make priority distinctions */ -#define POLLWRNORM (0x02) -#define POLLWRBAND (0x02) - -#define POLLERR (0x04) -#define POLLHUP (0x08) -#define POLLNVAL (0x10) - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/* The number of poll descriptors (required by poll() specification */ - -typedef unsigned int nfds_t; - -/* In the standard poll() definition, the size of the event set is 'short'. - * Here we pick the smallest storage element that will contain all of the - * poll events. - */ - -typedef uint8_t pollevent_t; - -/* This is the Nuttx variant of the standard pollfd structure. */ - -struct pollfd -{ - int fd; /* The descriptor being polled */ - sem_t *sem; /* Pointer to semaphore used to post output event */ - pollevent_t events; /* The input event flags */ - pollevent_t revents; /* The output event flags */ - FAR void *priv; /* For use by drivers */ -}; - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -EXTERN int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_POLL_H */ diff --git a/nuttx/include/pthread.h b/nuttx/include/pthread.h deleted file mode 100644 index a98b9aaaa..000000000 --- a/nuttx/include/pthread.h +++ /dev/null @@ -1,411 +0,0 @@ -/******************************************************************************** - * include/pthread.h - * - * Copyright (C) 2007-2009, 2011-2012 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_PTHREAD_H -#define __INCLUDE_PTHREAD_H - -/******************************************************************************** - * Included Files - ********************************************************************************/ - -#include /* Default settings */ -#include /* Compiler settings, noreturn_function */ - -#include /* Needed for general types */ -#include /* Needed by pthread_[set|get]name_np */ - -#include /* C99 fixed width integer types */ -#include /* C99 boolean types */ -#include /* For getpid */ -#include /* Needed for sem_t */ -#include /* Needed for sigset_t */ -#include /* Needed for struct timespec */ - -/******************************************************************************** - * Compilation Switches - ********************************************************************************/ - -/* Standard POSIX switches */ - -#ifndef _POSIX_THREADS -# define _POSIX_THREADS -#endif - -#ifndef _POSIX_THREAD_ATTR_STACKSIZE -# define _POSIX_THREAD_ATTR_STACKSIZE -#endif - -/******************************************************************************** - * Definitions - ********************************************************************************/ - -/* Values for the process shared (pshared) attribute */ - -#define PTHREAD_PROCESS_PRIVATE 0 -#define PTHREAD_PROCESS_SHARED 1 - -/* Values for the mutext type attribute: - * - * PTHREAD_MUTEX_NORMAL: This type of mutex does not detect deadlock. A thread - * attempting to relock this mutex without first unlocking it will deadlock. - * Attempting to unlock a mutex locked by a different thread results in undefined - * behavior. Attempting to unlock an unlocked mutex results in undefined behavior. - * PTHREAD_MUTEX_ERRORCHECK - * This type of mutex provides error checking. A thread attempting to relock this - * mutex without first unlocking it will return with an error. A thread attempting - * to unlock a mutex which another thread has locked will return with an error. A - * thread attempting to unlock an unlocked mutex will return with an error. - * PTHREAD_MUTEX_RECURSIVE - * A thread attempting to relock this mutex without first unlocking it will succeed - * in locking the mutex. The relocking deadlock which can occur with mutexes of type - * PTHREAD_MUTEX_NORMAL cannot occur with this type of mutex. Multiple locks of this - * mutex require the same number of unlocks to release the mutex before another thread - * can acquire the mutex. A thread attempting to unlock a mutex which another thread - * has locked will return with an error. A thread attempting to unlock an unlocked - * mutex will return with an error. - * PTHREAD_MUTEX_DEFAULT - * An implementation is allowed to map this mutex to one of the other mutex types. - */ - -#ifdef CONFIG_MUTEX_TYPES -# define PTHREAD_MUTEX_NORMAL 0 -# define PTHREAD_MUTEX_ERRORCHECK 1 -# define PTHREAD_MUTEX_RECURSIVE 2 -# define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL -#endif - -/* Valid ranges for the pthread stacksize attribute */ - -#define PTHREAD_STACK_MIN CONFIG_PTHREAD_STACK_MIN -#define PTHREAD_STACK_DEFAULT CONFIG_PTHREAD_STACK_DEFAULT - -/* Values for the pthread inheritsched attribute */ - -#define PTHREAD_INHERIT_SCHED 0 -#define PTHREAD_EXPLICIT_SCHED 1 - -#define PTHREAD_PRIO_NONE 0 -#define PTHREAD_PRIO_INHERIT 1 -#define PTHREAD_PRIO_PROTECT 2 - -#define PTHREAD_DEFAULT_PRIORITY 100 - -/* Cancellation states returned by pthread_cancelstate() */ - -#define PTHREAD_CANCEL_ENABLE (0) -#define PTHREAD_CANCEL_DISABLE (1) - -/* Thread return value when a pthread is canceled */ - -#define PTHREAD_CANCELED ((FAR void*)ERROR) - -/* Used to initialize a pthread_once_t */ - -#define PTHREAD_ONCE_INIT (false) - -/* This is returned by pthread_wait. It must not match any errno in errno.h */ - -#define PTHREAD_BARRIER_SERIAL_THREAD 0x1000 - -/* Definitions to map some non-standard, BSD thread management interfaces to - * the non-standard Linux-like prctl() interface. Since these are simple - * mappings to prctl, they will return 0 sucess and -1 on failure with the - * err number in errno. This is an inconsistency with out pthread interfaces. - */ - -#define pthread_setname_np(thread, name) \ - prctl((int)PR_SET_NAME, (char*)name, (int)thread) - -#define pthread_getname_np(thread, name) \ - prctl((int)PR_GET_NAME, (char*)name, (int)thread) - -/******************************************************************************** - * Global Type Declarations - ********************************************************************************/ - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* pthread-specific types */ - -typedef int pthread_key_t; -typedef FAR void *pthread_addr_t; -typedef pthread_addr_t any_t; - -typedef pthread_addr_t (*pthread_startroutine_t)(pthread_addr_t); -typedef pthread_startroutine_t pthread_func_t; - -struct pthread_attr_s -{ - size_t stacksize; /* Size of the stack allocated for the pthead */ - int16_t priority; /* Priority of the pthread */ - uint8_t policy; /* Pthread scheduler policy */ - uint8_t inheritsched; /* Inherit parent prio/policy? */ -}; -typedef struct pthread_attr_s pthread_attr_t; - -typedef pid_t pthread_t; - -typedef int pthread_condattr_t; - -struct pthread_cond_s -{ - sem_t sem; -}; -typedef struct pthread_cond_s pthread_cond_t; -#define PTHREAD_COND_INITIALIZER {{0, 0xffff}} - -struct pthread_mutexattr_s -{ - uint8_t pshared; /* PTHREAD_PROCESS_PRIVATE or PTHREAD_PROCESS_SHARED */ -#ifdef CONFIG_MUTEX_TYPES - uint8_t type; /* Type of the mutex. See PTHREAD_MUTEX_* definitions */ -#endif -}; -typedef struct pthread_mutexattr_s pthread_mutexattr_t; - -struct pthread_mutex_s -{ - int pid; /* ID of the holder of the mutex */ - sem_t sem; /* Semaphore underlying the implementation of the mutex */ -#ifdef CONFIG_MUTEX_TYPES - uint8_t type; /* Type of the mutex. See PTHREAD_MUTEX_* definitions */ - int nlocks; /* The number of recursive locks held */ -#endif -}; -typedef struct pthread_mutex_s pthread_mutex_t; - -#ifdef CONFIG_MUTEX_TYPES -# define PTHREAD_MUTEX_INITIALIZER {0, SEM_INITIALIZER(1), PTHREAD_MUTEX_DEFAULT, 0} -#else -# define PTHREAD_MUTEX_INITIALIZER {0, SEM_INITIALIZER(1)} -#endif - -struct pthread_barrierattr_s -{ - int pshared; -}; -typedef struct pthread_barrierattr_s pthread_barrierattr_t; - -struct pthread_barrier_s -{ - sem_t sem; - unsigned int count; -}; -typedef struct pthread_barrier_s pthread_barrier_t; - -typedef bool pthread_once_t; - -/* Forware references */ - -struct sched_param; /* Defined in sched.h */ - -/******************************************************************************** - * Global Variables - ********************************************************************************/ - -/******************************************************************************** - * Global Function Prototypes - ********************************************************************************/ - -/* Initializes a thread attributes object (attr) with default values for all of - * the individual attributes used by a given implementation. - */ - -int pthread_attr_init(FAR pthread_attr_t *attr); - -/* An attributes object can be deleted when it is no longer needed. */ - -int pthread_attr_destroy(pthread_attr_t *attr); - -/* Set or obtain the default scheduling algorithm */ - -int pthread_attr_setschedpolicy(FAR pthread_attr_t *attr, int policy); -int pthread_attr_getschedpolicy(FAR pthread_attr_t *attr, int *policy); -int pthread_attr_setschedparam(FAR pthread_attr_t *attr, - FAR const struct sched_param *param); -int pthread_attr_getschedparam(FAR pthread_attr_t *attr, - FAR struct sched_param *param); -int pthread_attr_setinheritsched(FAR pthread_attr_t *attr, - int inheritsched); -int pthread_attr_getinheritsched(FAR const pthread_attr_t *attr, - FAR int *inheritsched); - -/* Set or obtain the default stack size */ - -int pthread_attr_setstacksize(FAR pthread_attr_t *attr, long stacksize); -int pthread_attr_getstacksize(FAR pthread_attr_t *attr, long *stackaddr); - -/* To create a thread object and runnable thread, a routine must be specified - * as the new thread's start routine. An argument may be passed to this - * routine, as an untyped address; an untyped address may also be returned as - * the routine's value. An attributes object may be used to specify details - * about the kind of thread being created. - */ - -int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr, - pthread_startroutine_t startroutine, pthread_addr_t arg); - -/* A thread object may be "detached" to specify that the return value and - * completion status will not be requested. - */ - -int pthread_detach(pthread_t thread); - -/* A thread may terminate it's own execution or the execution of another - * thread. - */ - -void pthread_exit(pthread_addr_t value) noreturn_function; -int pthread_cancel(pthread_t thread); -int pthread_setcancelstate(int state, FAR int *oldstate); -void pthread_testcancel(void); - -/* A thread can await termination of another thread and retrieve the return - * value of the thread. - */ - -int pthread_join(pthread_t thread, FAR pthread_addr_t *value); - -/* A thread may tell the scheduler that its processor can be made available. */ - -void pthread_yield(void); - -/* A thread may obtain a copy of its own thread handle. */ - -#define pthread_self() ((pthread_t)getpid()) - -/* Compare two thread IDs. */ - -#define pthread_equal(t1,t2) (t1 == t2) - -/* Thread scheduling parameters */ - -int pthread_getschedparam(pthread_t thread, FAR int *policy, - FAR struct sched_param *param); -int pthread_setschedparam(pthread_t thread, int policy, - FAR const struct sched_param *param); -int pthread_setschedprio(pthread_t thread, int prio); - -/* Thread-specific Data Interfaces */ - -int pthread_key_create(FAR pthread_key_t *key, - CODE void (*destructor)(FAR void*)); -int pthread_setspecific(pthread_key_t key, FAR void *value); -FAR void *pthread_getspecific(pthread_key_t key); -int pthread_key_delete(pthread_key_t key); - -/* Create, operate on, and destroy mutex attributes. */ - -int pthread_mutexattr_init(FAR pthread_mutexattr_t *attr); -int pthread_mutexattr_destroy(FAR pthread_mutexattr_t *attr); -int pthread_mutexattr_getpshared(FAR pthread_mutexattr_t *attr, - FAR int *pshared); -int pthread_mutexattr_setpshared(FAR pthread_mutexattr_t *attr, - int pshared); -#ifdef CONFIG_MUTEX_TYPES -int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *type); -int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type); -#endif - -/* The following routines create, delete, lock and unlock mutexes. */ - -int pthread_mutex_init(FAR pthread_mutex_t *mutex, - FAR pthread_mutexattr_t *attr); -int pthread_mutex_destroy(FAR pthread_mutex_t *mutex); -int pthread_mutex_lock(FAR pthread_mutex_t *mutex); -int pthread_mutex_trylock(FAR pthread_mutex_t *mutex); -int pthread_mutex_unlock(FAR pthread_mutex_t *mutex); - -/* Operations on condition variables */ - -int pthread_condattr_init(FAR pthread_condattr_t *attr); -int pthread_condattr_destroy(FAR pthread_condattr_t *attr); - -/* A thread can create and delete condition variables. */ - -int pthread_cond_init(FAR pthread_cond_t *cond, FAR pthread_condattr_t *attr); -int pthread_cond_destroy(FAR pthread_cond_t *cond); - -/* A thread can signal to and broadcast on a condition variable. */ - -int pthread_cond_broadcast(FAR pthread_cond_t *cond); -int pthread_cond_signal(FAR pthread_cond_t *cond); - -/* A thread can wait for a condition variable to be signalled or broadcast. */ - -int pthread_cond_wait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex); - -/* A thread can perform a timed wait on a condition variable. */ - -int pthread_cond_timedwait(FAR pthread_cond_t *cond, - FAR pthread_mutex_t *mutex, - FAR const struct timespec *abstime); - -/* Barrier attributes */ - -int pthread_barrierattr_destroy(FAR pthread_barrierattr_t *attr); -int pthread_barrierattr_init(FAR pthread_barrierattr_t *attr); -int pthread_barrierattr_getpshared(FAR const pthread_barrierattr_t *attr, - FAR int *pshared); -int pthread_barrierattr_setpshared(FAR pthread_barrierattr_t *attr, - int pshared); - -/* Barriers */ - -int pthread_barrier_destroy(FAR pthread_barrier_t *barrier); -int pthread_barrier_init(FAR pthread_barrier_t *barrier, - FAR const pthread_barrierattr_t *attr, - unsigned int count); -int pthread_barrier_wait(FAR pthread_barrier_t *barrier); - -/* Pthread initialization */ - -int pthread_once(FAR pthread_once_t *once_control, - CODE void (*init_routine)(void)); - -/* Pthread signal management APIs */ - -int pthread_kill(pthread_t thread, int sig); -int pthread_sigmask(int how, FAR const sigset_t *set, FAR sigset_t *oset); - -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_PTHREAD_H */ - diff --git a/nuttx/include/queue.h b/nuttx/include/queue.h deleted file mode 100644 index b5aa23690..000000000 --- a/nuttx/include/queue.h +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************************ - * include/queue.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 __INCLUDE_QUEUE_H -#define __INCLUDE_QUEUE_H - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include - -/************************************************************************ - * Pre-processor Definitions - ************************************************************************/ - -#define sq_init(q) do { (q)->head = NULL; (q)->tail = NULL; } while (0) -#define dq_init(q) do { (q)->head = NULL; (q)->tail = NULL; } while (0) - -#define sq_next(p) ((p)->flink) -#define dq_next(p) ((p)->flink) -#define dq_prev(p) ((p)->blink) - -#define sq_empty(q) ((q)->head == NULL) -#define dq_empty(q) ((q)->head == NULL) - -#define sq_peek(q) ((q)->head) -#define dq_peek(q) ((q)->head) - -/************************************************************************ - * Global Type Declarations - ************************************************************************/ - -struct sq_entry_s -{ - FAR struct sq_entry_s *flink; -}; -typedef struct sq_entry_s sq_entry_t; - -struct dq_entry_s -{ - FAR struct dq_entry_s *flink; - FAR struct dq_entry_s *blink; -}; -typedef struct dq_entry_s dq_entry_t; - -struct sq_queue_s -{ - FAR sq_entry_t *head; - FAR sq_entry_t *tail; -}; -typedef struct sq_queue_s sq_queue_t; - -struct dq_queue_s -{ - FAR dq_entry_t *head; - FAR dq_entry_t *tail; -}; -typedef struct dq_queue_s dq_queue_t; - -/************************************************************************ - * Global Function Prototypes - ************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -EXTERN void sq_addfirst(FAR sq_entry_t *node, sq_queue_t *queue); -EXTERN void dq_addfirst(FAR dq_entry_t *node, dq_queue_t *queue); -EXTERN void sq_addlast(FAR sq_entry_t *node, sq_queue_t *queue); -EXTERN void dq_addlast(FAR dq_entry_t *node, dq_queue_t *queue); -EXTERN void sq_addafter(FAR sq_entry_t *prev, FAR sq_entry_t *node, - sq_queue_t *queue); -EXTERN void dq_addafter(FAR dq_entry_t *prev, FAR dq_entry_t *node, - dq_queue_t *queue); -EXTERN void dq_addbefore(FAR dq_entry_t *next, FAR dq_entry_t *node, - dq_queue_t *queue); - -EXTERN FAR sq_entry_t *sq_remafter(FAR sq_entry_t *node, sq_queue_t *queue); -EXTERN void sq_rem(FAR sq_entry_t *node, sq_queue_t *queue); -EXTERN void dq_rem(FAR dq_entry_t *node, dq_queue_t *queue); -EXTERN FAR sq_entry_t *sq_remlast(sq_queue_t *queue); -EXTERN FAR dq_entry_t *dq_remlast(dq_queue_t *queue); -EXTERN FAR sq_entry_t *sq_remfirst(sq_queue_t *queue); -EXTERN FAR dq_entry_t *dq_remfirst(dq_queue_t *queue); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_QUEUE_H_ */ - diff --git a/nuttx/include/sched.h b/nuttx/include/sched.h deleted file mode 100644 index 9ccbf57b2..000000000 --- a/nuttx/include/sched.h +++ /dev/null @@ -1,172 +0,0 @@ -/******************************************************************************** - * include/sched.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 __INCLUDE_SCHED_H -#define __INCLUDE_SCHED_H - -/******************************************************************************** - * Included Files - ********************************************************************************/ - -#include - -#include -#include -#include - -/******************************************************************************** - * Pre-processor Definitions - ********************************************************************************/ - -/* Task Management Definitions **************************************************/ - -/* POSIX-like scheduling policies */ - -#define SCHED_FIFO 1 /* FIFO per priority scheduling policy */ -#define SCHED_RR 2 /* Round robin scheduling policy */ -#define SCHED_SPORADIC 3 /* Not supported */ -#define SCHED_OTHER 4 /* Not supported */ - -/* Pthread definitions **********************************************************/ - -#define PTHREAD_KEYS_MAX CONFIG_NPTHREAD_KEYS - -/* Non-standard Helper **********************************************************/ -/* One processor family supported by NuttX has a single, fixed hardware stack. - * That is the 8051 family. So for that family only, there is a variant form - * of task_create() that does not take a stack size parameter. The following - * helper macros are provided to work around the ugliness of that exception. - */ - -#ifndef CONFIG_CUSTOM_STACK -# define TASK_INIT(t,n,p,m,s,e,a) task_init(t,n,p,m,s,e,a) -# define TASK_CREATE(n,p,s,e,a) task_create(n,p,s,e,a) -#else -# define TASK_INIT(t,n,p,m,s,e,a) task_init(t,n,p,e,a) -# define TASK_CREATE(n,p,s,e,a) task_create(n,p,e,a) -#endif - -/******************************************************************************** - * Public Type Definitions - ********************************************************************************/ - -/* This is the POSIX-like scheduling parameter structure */ - -struct sched_param -{ - int sched_priority; -}; - -/******************************************************************************** - * Public Data - ********************************************************************************/ - -#ifndef __ASSEMBLY__ -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" -{ -#else -#define EXTERN extern -#endif - -/******************************************************************************** - * Public Function Prototypes - ********************************************************************************/ - -/* Task Control Interfaces (non-standard) */ - -#ifndef CONFIG_CUSTOM_STACK -int task_init(FAR _TCB *tcb, const char *name, int priority, - FAR uint32_t *stack, uint32_t stack_size, main_t entry, - FAR const char *argv[]); -#else -int task_init(FAR _TCB *tcb, const char *name, int priority, main_t entry, - FAR const char *argv[]); -#endif -int task_activate(FAR _TCB *tcb); -#ifndef CONFIG_CUSTOM_STACK -int task_create(FAR const char *name, int priority, int stack_size, main_t entry, - FAR const char *argv[]); -#else -int task_create(FAR const char *name, int priority, main_t entry, - FAR const char *argv[]); -#endif -int task_delete(pid_t pid); -int task_restart(pid_t pid); - -/* Task Scheduling Interfaces (based on POSIX APIs) */ - -int sched_setparam(pid_t pid, const struct sched_param *param); -int sched_getparam(pid_t pid, struct sched_param *param); -int sched_setscheduler(pid_t pid, int policy, - FAR const struct sched_param *param); -int sched_getscheduler(pid_t pid); -int sched_yield(void); -int sched_get_priority_max(int policy); -int sched_get_priority_min(int policy); -int sched_rr_get_interval(pid_t pid, FAR struct timespec *interval); - -/* Task Switching Interfaces (non-standard) */ - -int sched_lock(void); -int sched_unlock(void); -int sched_lockcount(void); - -/* If instrumentation of the scheduler is enabled, then some outboard logic - * must provide the following interfaces. - */ - -#ifdef CONFIG_SCHED_INSTRUMENTATION - -void sched_note_start(FAR _TCB *tcb); -void sched_note_stop(FAR _TCB *tcb); -void sched_note_switch(FAR _TCB *pFromTcb, FAR _TCB *pToTcb); - -#else -# define sched_note_start(t) -# define sched_note_stop(t) -# define sched_note_switch(t1, t2) -#endif /* CONFIG_SCHED_INSTRUMENTATION */ - -#undef EXTERN -#if defined(__cplusplus) -} -#endif -#endif /* __ASSEMBLY__ */ - -#endif /* __INCLUDE_SCHED_H */ - diff --git a/nuttx/include/semaphore.h b/nuttx/include/semaphore.h deleted file mode 100644 index 203118bd6..000000000 --- a/nuttx/include/semaphore.h +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** - * include/semaphore.h - * - * Copyright (C) 2007-2009, 2012-2013 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_SEMAPHORE_H -#define __INCLUDE_SEMAPHORE_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Type Declarations - ****************************************************************************/ - -/* This structure contains information about the holder of a semaphore */ - -#ifdef CONFIG_PRIORITY_INHERITANCE -struct semholder_s -{ -#if CONFIG_SEM_PREALLOCHOLDERS > 0 - struct semholder_s *flink; /* Implements singly linked list */ -#endif - void *htcb; /* Holder TCB (actual type is _TCB) */ - int16_t counts; /* Number of counts owned by this holder */ -}; - -#if CONFIG_SEM_PREALLOCHOLDERS > 0 -# define SEMHOLDER_INITIALIZER {NULL, NULL, 0} -#else -# define SEMHOLDER_INITIALIZER {NULL, 0} -#endif -#endif /* CONFIG_PRIORITY_INHERITANCE */ - -/* This is the generic semaphore structure. */ - -struct sem_s -{ - int16_t semcount; /* >0 -> Num counts available */ - /* <0 -> Num tasks waiting for semaphore */ - /* If priority inheritance is enabled, then we have to keep track of which - * tasks hold references to the semaphore. - */ - -#ifdef CONFIG_PRIORITY_INHERITANCE -# if CONFIG_SEM_PREALLOCHOLDERS > 0 - FAR struct semholder_s *hhead; /* List of holders of semaphore counts */ -# else - struct semholder_s holder; /* Single holder */ -# endif -#endif -}; - -typedef struct sem_s sem_t; - -/* Initializers */ - -#ifdef CONFIG_PRIORITY_INHERITANCE -# if CONFIG_SEM_PREALLOCHOLDERS > 0 -# define SEM_INITIALIZER(c) {(c), NULL} /* semcount, hhead */ -# else -# define SEM_INITIALIZER(c) {(c), SEMHOLDER_INITIALIZER} /* semcount, holder */ -# endif -#else -# define SEM_INITIALIZER(c) {(c)} /* semcount */ -#endif - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ -/* Forward references needed by some prototypes */ - -struct timespec; /* Defined in time.h */ - -/* Counting Semaphore Interfaces (based on POSIX APIs) */ - -EXTERN int sem_init(FAR sem_t *sem, int pshared, unsigned int value); -EXTERN int sem_destroy(FAR sem_t *sem); -EXTERN FAR sem_t *sem_open(FAR const char *name, int oflag, ...); -EXTERN int sem_close(FAR sem_t *sem); -EXTERN int sem_unlink(FAR const char *name); -EXTERN int sem_wait(FAR sem_t *sem); -EXTERN int sem_timedwait(FAR sem_t *sem, - FAR const struct timespec *abstime); -EXTERN int sem_trywait(FAR sem_t *sem); -EXTERN int sem_post(FAR sem_t *sem); -EXTERN int sem_getvalue(FAR sem_t *sem, FAR int *sval); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_SEMAPHORE_H */ diff --git a/nuttx/include/signal.h b/nuttx/include/signal.h deleted file mode 100644 index a02170242..000000000 --- a/nuttx/include/signal.h +++ /dev/null @@ -1,265 +0,0 @@ -/******************************************************************************** - * include/signal.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 __INCLUDE_SIGNAL_H -#define __INCLUDE_SIGNAL_H - -/******************************************************************************** - * Included Files - ********************************************************************************/ - -#include -#include - -#include -#include - -/******************************************************************************** - * Pre-processor Definitions - ********************************************************************************/ - -/* Signal set management definitions and macros. */ - -#define NULL_SIGNAL_SET ((sigset_t)0x00000000) -#define ALL_SIGNAL_SET ((sigset_t)0xffffffff) -#define MIN_SIGNO 0 -#define MAX_SIGNO 31 -#define GOOD_SIGNO(s) ((((unsigned)(s))<=MAX_SIGNO)) -#define SIGNO2SET(s) ((sigset_t)1 << (s)) - -/* All signals are "real time" signals */ - -#define SIGRTMIN MIN_SIGNO /* First real time signal */ -#define SIGRTMAX MAX_SIGNO /* Last real time signal */ - -/* A few of the real time signals are used within the OS. They have - * default values that can be overridden from the configuration file. The - * rest are all user signals. - * - * The signal number zero is wasted for the most part. It is a valid - * signal number, but has special meaning at many interfaces (e.g., Kill()). - * - * These are the semi-standard signal definitions: - */ - -#ifndef CONFIG_SIG_SIGUSR1 -# define SIGUSR1 1 /* User signal 1 */ -#else -# define SIGUSR1 CONFIG_SIG_SIGUSR1 -#endif - -#ifndef CONFIG_SIG_SIGUSR2 -# define SIGUSR2 2 /* User signal 2 */ -#else -# define SIGUSR2 CONFIG_SIG_SIGUSR2 -#endif - -#ifndef CONFIG_SIG_SIGALARM -# define SIGALRM 3 /* Default signal used with POSIX timers (used only */ - /* no other signal is provided) */ -#else -# define SIGALRM CONFIG_SIG_SIGALARM -#endif - -#ifdef CONFIG_SCHED_HAVE_PARENT -# ifndef CONFIG_SIG_SIGCHLD -# define SIGCHLD 4 /* Used by child threads to signal parent thread */ -# else -# define SIGCHLD CONFIG_SIG_SIGCHLD -# endif -#endif - -/* The following are non-standard signal definitions */ - -#ifndef CONFIG_DISABLE_PTHREAD -# ifndef CONFIG_SIG_SIGCONDTIMEDOUT -# define SIGCONDTIMEDOUT 16 /* Used in the implementation of pthread_cond_timedwait */ -# else -# define SIGCONDTIMEDOUT CONFIG_SIG_SIGCONDTIMEDOUT -# endif -#endif - -/* SIGWORK is used to wake up various internal, NuttX worker thread */ - -#if defined(CONFIG_SCHED_WORKQUEUE) || defined(CONFIG_PAGING) -# ifndef CONFIG_SIG_SIGWORK -# define SIGWORK 17 /* Used to wake up the work queue */ -# else -# define SIGWORK CONFIG_SIG_SIGWORK -# endif -#endif - -/* sigprocmask() "how" definitions. Only one of the following can be specified: */ - -#define SIG_BLOCK 1 /* Block the given signals */ -#define SIG_UNBLOCK 2 /* Unblock the given signals */ -#define SIG_SETMASK 3 /* Set the signal mask to the current set */ - -/* struct sigaction flag values */ - -#define SA_NOCLDSTOP (1 << 0) /* Do not generate SIGCHILD when - * children stop (ignored) */ -#define SA_SIGINFO (1 << 1) /* Invoke the signal-catching function - * with 3 args instead of 1 - * (always assumed) */ -#define SA_NOCLDWAIT (1 << 2) /* If signo=SIGCHLD, exit status of child - * processes will be discarded */ - -/* These are the possible values of the signfo si_code field */ - -#define SI_USER 0 /* Signal sent from kill, raise, or abort */ -#define SI_QUEUE 1 /* Signal sent from sigqueue */ -#define SI_TIMER 2 /* Signal is result of timer expiration */ -#define SI_ASYNCIO 3 /* Signal is the result of asynch IO completion */ -#define SI_MESGQ 4 /* Signal generated by arrival of a message on an */ - /* empty message queue */ -#define CLD_EXITED 5 /* Child has exited (SIGCHLD only) */ -#define CLD_KILLED 6 /* Child was killed (SIGCHLD only) */ -#define CLD_DUMPED 7 /* Child terminated abnormally (SIGCHLD only) */ -#define CLD_TRAPPED 8 /* Traced child has trapped (SIGCHLD only) */ -#define CLD_STOPPED 9 /* Child has stopped (SIGCHLD only) */ -#define CLD_CONTINUED 10 /* Stopped child had continued (SIGCHLD only) */ - -/* Values for the sigev_notify field of struct sigevent */ - -#define SIGEV_NONE 0 /* No notification desired */ -#define SIGEV_SIGNAL 1 /* Notify via signal */ - -/* Special values of sigaction (all treated like NULL) */ - -#define SIG_ERR ((CODE void*)-1) -#define SIG_DFL ((CODE void*)0) -#define SIG_IGN ((CODE void*)0) - -/******************************************************************************** - * Global Type Declarations - ********************************************************************************/ - -/* This defines a set of 32 signals (numbered 0 through 31). */ - -typedef uint32_t sigset_t; /* Bit set of 32 signals */ - -/* This defines the type of the siginfo si_value field */ - -union sigval -{ - int sival_int; /* Integer value */ - FAR void *sival_ptr; /* Pointer value */ -}; - -/* This structure contains elements that define a queue signal. The following is - * used to attach a signal to a message queue to notify a task when a message is - * available on a queue - */ - -struct sigevent -{ - uint8_t sigev_notify; /* Notification method: SIGEV_SIGNAL or SIGEV_NONE */ - uint8_t sigev_signo; /* Notification signal */ - union sigval sigev_value; /* Data passed with notification */ -}; - -/* The following types is used to pass parameters to/from signal handlers */ - -struct siginfo -{ - uint8_t si_signo; /* Identifies signal */ - uint8_t si_code; /* Source: SI_USER, SI_QUEUE, SI_TIMER, SI_ASYNCIO, or SI_MESGQ */ - union sigval si_value; /* Data passed with signal */ -#ifdef CONFIG_SCHED_HAVE_PARENT - pid_t si_pid; /* Sending task ID */ - int si_status; /* Exit value or signal (SIGCHLD only). */ -#endif -}; - -typedef struct siginfo siginfo_t; - -/* The following structure defines the action to take for given signal */ - -struct sigaction -{ - union - { - CODE void (*_sa_handler)(int); - CODE void (*_sa_sigaction)(int, FAR siginfo_t *, FAR void *); - } sa_u; - sigset_t sa_mask; - int sa_flags; -}; - -#define sa_handler sa_u._sa_handler -#define sa_sigaction sa_u._sa_sigaction - -/******************************************************************************** - * Global Variables - ********************************************************************************/ - -/******************************************************************************** - * Global Function Prototypes - ********************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -EXTERN int kill(pid_t, int); -EXTERN int sigemptyset(FAR sigset_t *set); -EXTERN int sigfillset(FAR sigset_t *set); -EXTERN int sigaddset(FAR sigset_t *set, int signo); -EXTERN int sigdelset(FAR sigset_t *set, int signo); -EXTERN int sigismember(FAR const sigset_t *set, int signo); -EXTERN int sigaction(int sig, FAR const struct sigaction *act, FAR struct sigaction *oact); -EXTERN int sigprocmask(int how, FAR const sigset_t *set, FAR sigset_t *oset); -EXTERN int sigpending(FAR sigset_t *set); -EXTERN int sigsuspend(FAR const sigset_t *sigmask); -EXTERN int sigwaitinfo(FAR const sigset_t *set, FAR struct siginfo *value); -EXTERN int sigtimedwait(FAR const sigset_t *set, FAR struct siginfo *value, - FAR const struct timespec *timeout); -#ifdef CONFIG_CAN_PASS_STRUCTS -EXTERN int sigqueue(int pid, int signo, union sigval value); -#else -EXTERN int sigqueue(int pid, int signo, FAR void *sival_ptr); -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_SIGNAL_H */ - diff --git a/nuttx/include/spawn.h b/nuttx/include/spawn.h deleted file mode 100644 index 5e0ce3416..000000000 --- a/nuttx/include/spawn.h +++ /dev/null @@ -1,198 +0,0 @@ -/**************************************************************************** - * include/spawn.h - * - * Copyright (C) 2013 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_SPAWN_H -#define __INCLUDE_SPAWN_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include - -#include -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* "The spawn.h header shall define the flags that may be set in a - * posix_spawnattr_t object using the posix_spawnattr_setflags() function:" - */ - -#define POSIX_SPAWN_RESETIDS (1 << 0) /* 1: Reset effective user ID */ -#define POSIX_SPAWN_SETPGROUP (1 << 1) /* 1: Set process group */ -#define POSIX_SPAWN_SETSCHEDPARAM (1 << 2) /* 1: Set task's priority */ -#define POSIX_SPAWN_SETSCHEDULER (1 << 3) /* 1: Set task's scheduler policy */ -#define POSIX_SPAWN_SETSIGDEF (1 << 4) /* 1: Set default signal actions */ -#define POSIX_SPAWN_SETSIGMASK (1 << 5) /* 1: Set sigmask */ - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ -/* "The spawn.h header shall define the posix_spawnattr_t and - * posix_spawn_file_actions_t types used in performing spawn operations. - * - * The internal structure underlying the posix_spawnattr_t is exposed here - * because the user will be required to allocate this memory. - */ - -struct posix_spawnattr_s -{ - uint8_t flags; - uint8_t priority; - uint8_t policy; -#ifndef CONFIG_DISABLE_SIGNALS - sigset_t sigmask; -#endif -}; - -typedef struct posix_spawnattr_s posix_spawnattr_t; - -/* posix_spawn_file_actions_addclose(), posix_spawn_file_actions_adddup2(), - * and posix_spawn_file_actions_addopen() will allocate memory and append - * a new file action to an instance of posix_spawn_file_actions_t. The - * internal representation of these structures is not exposed to the user. - * The user need only know that the size sizeof(posix_spawn_file_actions_t) - * will hold a pointer to data. - */ - -typedef FAR void *posix_spawn_file_actions_t; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ -/* "The following shall be declared as functions and may also be defined as - * macros. Function prototypes shall be provided." - */ - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* posix_spawn[p] interfaces ************************************************/ - -#ifdef CONFIG_BINFMT_EXEPATH -int posix_spawnp(FAR pid_t *pid, FAR const char *path, - FAR const posix_spawn_file_actions_t *file_actions, - FAR const posix_spawnattr_t *attr, - FAR char *const argv[], FAR char *const envp[]); -#define posix_spawn(pid,path,file_actions,attr,argv,envp) \ - posix_spawnp(pid,path,file_actions,attr,argv,envp) -#else -int posix_spawn(FAR pid_t *pid, FAR const char *path, - FAR const posix_spawn_file_actions_t *file_actions, - FAR const posix_spawnattr_t *attr, - FAR char *const argv[], FAR char *const envp[]); -#endif - -/* File action interfaces ***************************************************/ -/* File action initialization and destruction */ - -int posix_spawn_file_actions_init(FAR posix_spawn_file_actions_t *file_actions); -int posix_spawn_file_actions_destroy(FAR posix_spawn_file_actions_t *file_actions); - -/* Add file action interfaces */ - -int posix_spawn_file_actions_addclose(FAR posix_spawn_file_actions_t *file_actions, - int fd); -int posix_spawn_file_actions_adddup2(FAR posix_spawn_file_actions_t *file_actions, - int fd1, int fd2); -int posix_spawn_file_actions_addopen(FAR posix_spawn_file_actions_t *file_actions, - int fd, FAR const char *path, int oflags, mode_t mode); - -/* Spawn attributes interfaces **********************************************/ -/* Spawn attributes initialization and destruction */ - -int posix_spawnattr_init(FAR posix_spawnattr_t *attr); - -/* int posix_spawnattr_destroy(FAR posix_spawnattr_t *); */ -#ifdef CONFIG_DEBUG -# define posix_spawnattr_destroy(attr) (attr ? 0 : EINVAL) -#else -# define posix_spawnattr_destroy(attr) (0) -#endif - -/* Get spawn attributes interfaces */ - -int posix_spawnattr_getflags(FAR const posix_spawnattr_t *attr, FAR short *flags); -#define posix_spawnattr_getpgroup(attr,group) (ENOSYS) -int posix_spawnattr_getschedparam(FAR const posix_spawnattr_t *attr, - FAR struct sched_param *param); -int posix_spawnattr_getschedpolicy(FAR const posix_spawnattr_t *attr, - FAR int *policy); -#define posix_spawnattr_getsigdefault(attr,sigdefault) (ENOSYS) -#ifndef CONFIG_DISABLE_SIGNALS -int posix_spawnattr_getsigmask(FAR const posix_spawnattr_t *attr, - FAR sigset_t *sigmask); -#else -# define posix_spawnattr_getsigmask(attr,sigmask) (ENOSYS) -#endif - -/* Set spawn attributes interfaces */ - -int posix_spawnattr_setflags(FAR posix_spawnattr_t *attr, short flags); -#define posix_spawnattr_setpgroup(attr,group) (ENOSYS) -int posix_spawnattr_setschedparam(FAR posix_spawnattr_t *attr, - FAR const struct sched_param *param); -int posix_spawnattr_setschedpolicy(FAR posix_spawnattr_t *attr, int policy); -#define posix_spawnattr_setsigdefault(attr,sigdefault) (ENOSYS) -#ifndef CONFIG_DISABLE_SIGNALS -int posix_spawnattr_setsigmask(FAR posix_spawnattr_t *attr, - FAR const sigset_t *sigmask); -#else -# define posix_spawnattr_setsigmask(attr,sigmask) (ENOSYS) -#endif - -/* Non standard debug functions */ - -#ifdef CONFIG_DEBUG -void posix_spawn_file_actions_dump(FAR posix_spawn_file_actions_t *file_actions); -void posix_spawnattr_dump(FAR posix_spawnattr_t *attr); -#else -# define posix_spawn_file_actions_dump(fa) -# define posix_spawnattr_dump(a) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_SPAWN_H */ diff --git a/nuttx/include/stdbool.h b/nuttx/include/stdbool.h deleted file mode 100644 index 6c3302549..000000000 --- a/nuttx/include/stdbool.h +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** - * include/stdbool.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 __INCLUDE_STDBOOL_H -#define __INCLUDE_STDBOOL_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/* If CONFIG_ARCH_STDBOOL_H is set, then the archecture will provide its own - * stdbool.h file. In this case, this header file will simply re-direct to - * the architecture-specfiic stdbool.h header file. - */ - -#ifdef CONFIG_ARCH_STDBOOL_H -# include - -/* NuttX will insist that the sizeof(bool) is 8-bits. The sizeof of _Bool - * used by any specific compiler is implementation specific: It can vary from - * compiler-to-compiler and even vary between different versions of the same - * compiler. Compilers seems to be converging to sizeof(_Bool) == 1. If that - * is true for your compiler, you should define CONFIG_C99_BOOL8 in your NuttX - * configuration for better standards compatibility. - * - * CONFIG_C99_BOOL8 - Means (1) your C++ compiler has sizeof(_Bool) == 8, - * (2) your C compiler supports the C99 _Bool intrinsic type, and (2) that - * the C99 _Bool type also has size 1. - */ - -#else - - /* nuttx/compiler.h may also define or undefine CONFIG_C99_BOOL8 */ - -# include - -#if !defined(__cplusplus) || !defined(CONFIG_C99_BOOL8) -# include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* bool, true, and false must be provided as macros so that they can be - * redefined by the application if necessary. - * - * NOTE: Under C99 'bool' is required to be defined to be the intrinsic type - * _Bool. However, in this NuttX context, we need backward compatibility - * to pre-C99 standards where _Bool is not an intrinsic type. Hence, we - * use _Bool8 as the underlying type (unless CONFIG_C99_BOOL8 is defined) - */ - -#ifdef CONFIG_C99_BOOL8 -# define bool _Bool -#else -# define bool _Bool8 -#endif - -#define true (bool)1 -#define false (bool)0 - -#define __bool_true_false_are_defined 1 - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* A byte is the smallest address memory element (at least in architectures - * that do not support bit banding). The requirement is only that type _Bool - * be large enough to hold the values 0 and 1. We select uint8_t to minimize - * the RAM footprint of the executable. - * - * NOTE: We can't actually define the type _Bool here. Under C99 _Bool is - * an intrinsic type and cannot be the target of a typedef. However, in this - * NuttX context, we also need backward compatibility to pre-C99 standards - * where _Bool is not an intrinsic type. We work around this by using _Bool8 - * as the underlying type. - */ - -#ifndef CONFIG_C99_BOOL8 -typedef uint8_t _Bool8; -#endif - -#endif /* __cplusplus && CONFIG_C99_BOOL8 */ -#endif /* CONFIG_ARCH_STDBOOL_H */ -#endif /* __INCLUDE_STDBOOL_H */ diff --git a/nuttx/include/stddef.h b/nuttx/include/stddef.h deleted file mode 100644 index f08135bf7..000000000 --- a/nuttx/include/stddef.h +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** - * include/stddef.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 __INCLUDE_STDDEF_H -#define __INCLUDE_STDDEF_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ - -#endif /* __INCLUDE_STDDEF_H */ diff --git a/nuttx/include/stdint.h b/nuttx/include/stdint.h deleted file mode 100644 index 4c14d935e..000000000 --- a/nuttx/include/stdint.h +++ /dev/null @@ -1,305 +0,0 @@ -/**************************************************************************** - * include/stdint.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 __INCLUDE_STDINT_H -#define __INCLUDE_STDINT_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#ifdef CONFIG_ARCH_STDINT_H -# include -#else -# include -# include -# include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Limits of exact-width integer types */ - -#define INT8_MIN 0x80 -#define INT8_MAX 0x7f -#define UINT8_MAX 0xff - -#define INT16_MIN 0x8000 -#define INT16_MAX 0x7fff -#define UINT16_MAX 0xffff - -#ifdef __INT24_DEFINED -# define INT24_MIN 0x800000 -# define INT24_MAX 0x7fffff -# define UINT24_MAX 0xffffff -#endif - -#define INT32_MIN 0x80000000 -#define INT32_MAX 0x7fffffff -#define UINT32_MAX 0xffffffff - -#ifdef __INT64_DEFINED -# define INT64_MIN 0x8000000000000000 -# define INT64_MAX 0x7fffffffffffffff -# define UINT64_MAX 0xffffffffffffffff -#endif - -/* Limits of minimum-width integer types */ - -#define INT8_LEASTN_MIN 0x80 -#define INT8_LEASTN_MAX 0x7f -#define UINT8_LEASTN_MAX 0xff - -#define INT16_LEASTN_MIN 0x8000 -#define INT16_LEASTN_MAX 0x7fff -#define UINT16_LEASTN_MAX 0xffff - -#ifdef __INT24_DEFINED -# define INT24_LEASTN_MIN 0x800000 -# define INT24_LEASTN_MAX 0x7fffff -# define UINT24_LEASTN_MAX 0xffffff -#endif - -#define INT32_LEASTN_MIN 0x80000000 -#define INT32_LEASTN_MAX 0x7fffffff -#define UINT32_LEASTN_MAX 0xffffffff - -#ifdef __INT64_DEFINED -# define INT64_LEASTN_MIN 0x8000000000000000 -# define INT64_LEASTN_MAX 0x7fffffffffffffff -# define UINT64_LEASTN_MAX 0xffffffffffffffff -#endif - -/* Limits of fastest minimum-width integer types */ - -#define INT8_FASTN_MIN 0x80 -#define INT8_FASTN_MAX 0x7f -#define UINT8_FASTN_MAX 0xff - -#define INT16_FASTN_MIN 0x8000 -#define INT16_FASTN_MAX 0x7fff -#define UINT16_FASTN_MAX 0xffff - -#ifdef __INT24_DEFINED -# define INT24_FASTN_MIN 0x800000 -# define INT24_FASTN_MAX 0x7fffff -# define UINT24_FASTN_MAX 0xffffff -#endif - -#define INT32_FASTN_MIN 0x80000000 -#define INT32_FASTN_MAX 0x7fffffff -#define UINT32_FASTN_MAX 0xffffffff - -#ifdef __INT64_DEFINED -# define INT64_FASTN_MIN 0x8000000000000000 -# define INT64_FASTN_MAX 0x7fffffffffffffff -# define UINT64_FASTN_MAX 0xffffffffffffffff -#endif - -/* Limits of integer types capable of holding object pointers */ - -#define INTPTR_MIN PTR_MIN -#define INTPTR_MAX PTR_MIN -#define UINTPTR_MAX UPTR_MAX - -/* Limits of greatest-width integer types */ - -#ifdef __INT64_DEFINED -# define INTMAX_MIN INT64_MIN -# define INTMAX_MAX INT64_MAX - -# define UINTMAX_MIN UINT64_MIN -# define UINTMAX_MAX UINT64_MAX -#else -# define INTMAX_MIN INT32_MIN -# define INTMAX_MAX INT32_MAX - -# define UINTMAX_MIN UINT32_MIN -# define UINTMAX_MAX UINT32_MAX -#endif - -/* Macros for minimum-width integer constant expressions */ - -#if 0 /* REVISIT: Depends on architecture specific implementation */ -#define INT8_C(x) x -#define INT16_C(x) x -#define INT32_C(x) x ## L -#define INT64_C(x) x ## LL - -#define UINT8_C(x) x -#define UINT16_C(x) x -#define UINT32_C(x) x ## UL -#define UINT64_C(x) x ## ULL -#endif - -/* Macros for greatest-width integer constant expressions */ - -#ifdef CONFIG_HAVE_LONG_LONG -# define INTMAX_C(x) x ## LL -# define UINTMAX_C(x) x ## ULL -#else -# define INTMAX_C(x) x ## L -# define UINTMAX_C(x) x ## UL -#endif - -/* Limits of Other Integer Types */ - -#if 0 -# define PTRDIFF_MIN -# define PTRDIFF_MAX -#endif - -#ifdef CONFIG_SMALL_MEMORY -# define SIZE_MAX 0xffff -#else -# define SIZE_MAX 0xffffffff -#endif - -#if 0 -# define WCHAR_MIN -# define WCHAR_MAX - -# define WINT_MIN -# define WINT_MAX -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* Exact-width integer types. NOTE that these types are defined in - * architecture-specific logic with leading underscore character. This file - * typedef's these to the final name without the underscore character. This - * roundabout way of doings things allows the stdint.h to be removed from the - * include/ directory in the event that the user prefers to use the definitions - * provided by their toolchain header files. - */ - -typedef _int8_t int8_t; -typedef _uint8_t uint8_t; - -typedef _int16_t int16_t; -typedef _uint16_t uint16_t; - -#ifdef __INT24_DEFINED -typedef _int24_t int24_t; -typedef _uint24_t uint24_t; -#endif - -typedef _int32_t int32_t; -typedef _uint32_t uint32_t; - -#ifdef __INT64_DEFINED -typedef _int64_t int64_t; -typedef _uint64_t uint64_t; -#endif - -/* Minimum-width integer types */ - -typedef _int8_t int_least8_t; -typedef _uint8_t uint_least8_t; - -typedef _int16_t int_least16_t; -typedef _uint16_t uint_least16_t; - -#ifdef __INT24_DEFINED -typedef _int24_t int_least24_t; -typedef _uint24_t uint_least24_t; -#else -typedef _int32_t int_least24_t; -typedef _uint32_t uint_least24_t; -#endif - -typedef _int32_t int_least32_t; -typedef _uint32_t uint_least32_t; - -#ifdef __INT64_DEFINED -typedef _int64_t int_least64_t; -typedef _uint64_t uint_least64_t; -#endif - -/* Fastest minimum-width integer types */ - -typedef _int8_t int_fast8_t; -typedef _uint8_t uint_fast8_t; - -typedef int int_fast16_t; -typedef unsigned int uint_fast16_t; - -#ifdef __INT24_DEFINED -typedef _int24_t int_fast24_t; -typedef _uint24_t uint_fast24_t; -#else -typedef _int32_t int_fast24_t; -typedef _uint32_t uint_fast24_t; -#endif - -typedef _int32_t int_fast32_t; -typedef _uint32_t uint_fast32_t; - -#ifdef __INT64_DEFINED -typedef _int64_t int_fast64_t; -typedef _uint64_t uint_fast64_t; -#endif - -/* Integer types capable of holding object pointers */ - -typedef _intptr_t intptr_t; -typedef _uintptr_t uintptr_t; - -/* Some architectures support a FAR pointer which is larger then the normal - * (near) pointer - */ - -#ifdef CONFIG_HAVE_FARPOINTER -typedef _int_farptr_t int_farptr_t; -typedef _uint_farptr_t uint_farptr_t; -#endif - -/* Greatest-width integer types */ - -#ifdef __INT64_DEFINED -typedef _int64_t intmax_t; -typedef _uint64_t uintmax_t; -#else -typedef _int32_t intmax_t; -typedef _uint32_t uintmax_t; -#endif - -#endif /* CONFIG_ARCH_STDBOOL_H */ -#endif /* __INCLUDE_STDINT_H */ diff --git a/nuttx/include/stdio.h b/nuttx/include/stdio.h deleted file mode 100644 index 0441ea4b8..000000000 --- a/nuttx/include/stdio.h +++ /dev/null @@ -1,157 +0,0 @@ -/**************************************************************************** - * include/stdio.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 __INCLUDE_STDIO_H -#define __INCLUDE_STDIO_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include -#include -#include - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* File System Definitions **************************************************/ - -/* File system error values *************************************************/ - -#define EOF (-1) - -/* The first three _iob entries are reserved for standard I/O */ - -#define stdin (&sched_getstreams()->sl_streams[0]) -#define stdout (&sched_getstreams()->sl_streams[1]) -#define stderr (&sched_getstreams()->sl_streams[2]) - -/* These APIs are not implemented and/or can be synthesized from - * supported APIs. - */ - -#define putc(c,s) fputc((c),(s)) -#define putchar(c) fputc(c, stdout) -#define getc(s) fgetc(s) -#define getchar() fgetc(stdin) -#define rewind(s) ((void)fseek((s),0,SEEK_SET)) - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/* Streams */ - -typedef struct file_struct FILE; - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/* ANSI-like File System Interfaces */ - -/* Operations on streams (FILE) */ - -EXTERN void clearerr(register FILE *stream); -EXTERN int fclose(FAR FILE *stream); -EXTERN int fflush(FAR FILE *stream); -EXTERN int feof(FAR FILE *stream); -EXTERN int ferror(FAR FILE *stream); -EXTERN int fileno(FAR FILE *stream); -EXTERN int fgetc(FAR FILE *stream); -EXTERN int fgetpos(FAR FILE *stream, FAR fpos_t *pos); -EXTERN char *fgets(FAR char *s, int n, FAR FILE *stream); -EXTERN FAR FILE *fopen(FAR const char *path, FAR const char *type); -EXTERN int fprintf(FAR FILE *stream, FAR const char *format, ...); -EXTERN int fputc(int c, FAR FILE *stream); -EXTERN int fputs(FAR const char *s, FAR FILE *stream); -EXTERN size_t fread(FAR void *ptr, size_t size, size_t n_items, FAR FILE *stream); -EXTERN int fseek(FAR FILE *stream, long int offset, int whence); -EXTERN int fsetpos(FAR FILE *stream, FAR fpos_t *pos); -EXTERN long ftell(FAR FILE *stream); -EXTERN size_t fwrite(FAR const void *ptr, size_t size, size_t n_items, FAR FILE *stream); -EXTERN FAR char *gets(FAR char *s); -EXTERN int ungetc(int c, FAR FILE *stream); - -/* Operations on the stdout stream, buffers, paths, and the whole printf-family */ - -EXTERN int printf(const char *format, ...); -EXTERN int puts(FAR const char *s); -EXTERN int rename(FAR const char *oldpath, FAR const char *newpath); -EXTERN int sprintf(FAR char *buf, const char *format, ...); -EXTERN int asprintf (FAR char **ptr, const char *fmt, ...); -EXTERN int snprintf(FAR char *buf, size_t size, const char *format, ...); -EXTERN int sscanf(const char *buf, const char *fmt, ...); -EXTERN void perror(FAR const char *s); - -EXTERN int vprintf(FAR const char *format, va_list ap); -EXTERN int vfprintf(FAR FILE *stream, const char *format, va_list ap); -EXTERN int vdprintf(FAR int fd, const char *format, va_list ap); -EXTERN int vsprintf(FAR char *buf, const char *format, va_list ap); -EXTERN int avsprintf(FAR char **ptr, const char *fmt, va_list ap); -EXTERN int vsnprintf(FAR char *buf, size_t size, const char *format, va_list ap); -EXTERN int vsscanf(char *buf, const char *s, va_list ap); - -/* POSIX-like File System Interfaces */ - -EXTERN FAR FILE *fdopen(int fd, FAR const char *type); -EXTERN int statfs(FAR const char *path, FAR struct statfs *buf); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_STDIO_H */ diff --git a/nuttx/include/stdlib.h b/nuttx/include/stdlib.h deleted file mode 100644 index 27696e0fa..000000000 --- a/nuttx/include/stdlib.h +++ /dev/null @@ -1,192 +0,0 @@ -/**************************************************************************** - * include/stdlib.h - * - * Copyright (C) 2007-2012 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_STDLIB_H -#define __INCLUDE_STDLIB_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include -#include -#include - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* The C standard specifies two constants, EXIT_SUCCESS and - * EXIT_FAILURE, that may be passed to exit() to indicate - * successful or unsucessful termination, respectively. - */ - -#define EXIT_SUCCESS 0 -#define EXIT_FAILURE 1 - -/* The NULL pointer should be defined in this file but is currently defined - * in sys/types.h. - */ - -/* Maximum value returned by rand() */ - -#define MAX_RAND 32767 - -/* Integer expression whose value is the maximum number of bytes in a - * character specified by the current locale. - */ - -#define MB_CUR_MAX 1 - -/* The environ variable, normally 'extern char **environ;' is - * not implemented as a function call. However, get_environ_ptr() - * can be used in its place. - */ - -#ifndef CONFIG_DISABLE_ENIVRON -# define environ get_environ_ptr() -#endif - -/**************************************************************************** - * Global Type Definitions - ****************************************************************************/ - -struct mallinfo -{ - int arena; /* This is the total size of memory allocated - * for use by malloc in bytes. */ - int ordblks; /* This is the number of free (not in use) chunks */ - int mxordblk; /* Size of the largest free (not in use) chunk */ - int uordblks; /* This is the total size of memory occupied by - * chunks handed out by malloc. */ - int fordblks; /* This is the total size of memory occupied - * by free (not in use) chunks.*/ -}; - -/**************************************************************************** - * Global Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Global Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/* Random number generation */ - -EXTERN void srand(unsigned int seed); -EXTERN int rand(void); - -/* Environment variable support */ - -#ifndef CONFIG_DISABLE_ENIVRON -EXTERN FAR char **get_environ_ptr( void ); -EXTERN FAR char *getenv(FAR const char *name); -EXTERN int putenv(FAR const char *string); -EXTERN int clearenv(void); -EXTERN int setenv(const char *name, const char *value, int overwrite); -EXTERN int unsetenv(const char *name); -#endif - -/* Process exit functions */ - -EXTERN void exit(int status) noreturn_function; -EXTERN void abort(void) noreturn_function; -#ifdef CONFIG_SCHED_ATEXIT -EXTERN int atexit(CODE void (*func)(void)); -#endif -#ifdef CONFIG_SCHED_ONEXIT -EXTERN int on_exit(CODE void (*func)(int, FAR void *), FAR void *arg); -#endif - -/* String to binary conversions */ - -EXTERN long strtol(const char *, char **, int); -EXTERN unsigned long strtoul(const char *, char **, int); -#ifdef CONFIG_HAVE_LONG_LONG -EXTERN long long strtoll(const char *, char **, int); -EXTERN unsigned long long strtoull(const char *, char **, int); -#endif -EXTERN double_t strtod(const char *, char **); - -#define atoi(nptr) strtol((nptr), NULL, 10) -#define atol(nptr) strtol((nptr), NULL, 10) -#ifdef CONFIG_HAVE_LONG_LONG -#define atoll(nptr) strtoll((nptr), NULL, 10) -#endif -#define atof(nptr) strtod((nptr), NULL) - -/* Memory Management */ - -EXTERN FAR void *malloc(size_t); -EXTERN void free(FAR void*); -EXTERN FAR void *realloc(FAR void*, size_t); -EXTERN FAR void *memalign(size_t, size_t); -EXTERN FAR void *zalloc(size_t); -EXTERN FAR void *calloc(size_t, size_t); - -/* Misc */ - -EXTERN int abs(int j); -EXTERN long int labs(long int j); -#ifdef CONFIG_HAVE_LONG_LONG -EXTERN long long int llabs(long long int j); -#endif - -/* Sorting */ - -EXTERN void qsort(void *base, size_t nmemb, size_t size, - int(*compar)(const void *, const void *)); - -#ifdef CONFIG_CAN_PASS_STRUCTS -EXTERN struct mallinfo mallinfo(void); -#else -EXTERN int mallinfo(struct mallinfo *info); -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_STDLIB_H */ diff --git a/nuttx/include/string.h b/nuttx/include/string.h deleted file mode 100644 index 7aa028bfa..000000000 --- a/nuttx/include/string.h +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** - * include/string.h - * - * Copyright (C) 2007-2012 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_STRING_H -#define __INCLUDE_STRING_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ -/* Compatibility definitions */ - -#ifndef CONFIG_ARCH_BZERO -# define bzero(s,n) (void)memset(s,0,n) -#endif - -#define bcopy(b1,b2,len) (void)memmove(b2,b1,len) - -/**************************************************************************** - * Global Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -EXTERN FAR char *strdup(FAR const char *s); -EXTERN FAR char *strndup(FAR const char *s, size_t size); -EXTERN FAR const char *strerror(int); -EXTERN size_t strlen(FAR const char *); -EXTERN size_t strnlen(FAR const char *, size_t); -EXTERN FAR char *strcat(FAR char *, FAR const char *); -EXTERN FAR char *strncat(FAR char *, FAR const char *, size_t); -EXTERN int strcmp(FAR const char *, FAR const char *); -EXTERN int strncmp(FAR const char *, FAR const char *, size_t); -EXTERN int strcasecmp(FAR const char *, FAR const char *); -EXTERN int strncasecmp(FAR const char *, FAR const char *, size_t); -EXTERN FAR char *strcpy(char *dest, FAR const char *src); -EXTERN FAR char *strncpy(char *, FAR const char *, size_t); -EXTERN FAR char *strpbrk(FAR const char *, FAR const char *); -EXTERN FAR char *strchr(FAR const char *s, int c); -EXTERN FAR char *strrchr(FAR const char *s, int c); -EXTERN size_t strspn(FAR const char *, FAR const char *); -EXTERN size_t strcspn(FAR const char *, FAR const char *); -EXTERN FAR char *strstr(FAR const char *, FAR const char *); -EXTERN FAR char *strcasestr(FAR const char *, FAR const char *); -EXTERN FAR char *strtok(FAR char *, FAR const char *); -EXTERN FAR char *strtok_r(FAR char *, FAR const char *, FAR char **); - -EXTERN FAR void *memchr(FAR const void *s, int c, size_t n); -EXTERN FAR void *memccpy(FAR void *s1, FAR const void *s2, int c, size_t n); -EXTERN int memcmp(FAR const void *s1, FAR const void *s2, size_t n); -EXTERN FAR void *memcpy(FAR void *dest, FAR const void *src, size_t n); -EXTERN FAR void *memmove(FAR void *dest, FAR const void *src, size_t count); -EXTERN FAR void *memset(FAR void *s, int c, size_t n); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif -#endif /* __INCLUDE_STRING_H */ diff --git a/nuttx/include/sys/ioctl.h b/nuttx/include/sys/ioctl.h deleted file mode 100644 index 3d1874869..000000000 --- a/nuttx/include/sys/ioctl.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** - * include/sys/ioctl.h - * - * Copyright (C) 2007, 2008, 2012 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_SYS_IOCTL_H -#define __INCLUDE_SYS_IOCTL_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -/* Get NuttX configuration and NuttX-specific IOCTL definitions */ - -#include -#include - -/* Include network ioctls info */ - -#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 -# include -#endif - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/* ioctl() is a non-standard UNIX-like API */ - -EXTERN int ioctl(int fd, int req, unsigned long arg); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_SYS_IOCTL_H */ diff --git a/nuttx/include/sys/mman.h b/nuttx/include/sys/mman.h deleted file mode 100644 index ab847b97a..000000000 --- a/nuttx/include/sys/mman.h +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** - * include/sys/mman.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 __INCLUDE_SYS_MMAN_H -#define __INCLUDE_SYS_MMAN_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/* Protections are chosen from these bits, OR'd together. NuttX does not - * support any of these, but are provided for source level compatibility - */ - -#define PROT_NONE 0x0 /* Page may not be accessed */ -#define PROT_READ 0x1 /* Page may be read */ -#define PROT_WRITE 0x2 /* Page may be written */ -#define PROT_EXEC 0x4 /* Page may be executed */ - -/* Sharing types -- ignored by NuttX. */ - -#define MAP_SHARED 0x00001 /* Share this mapping */ -#define MAP_PRIVATE 0x00002 /* Create a private copy-on-write mapping */ -#define MAP_TYPE 0x0000f /* Mask for type of mapping */ -#define MAP_FIXED 0x00010 /* Map to specified address exactly */ -#define MAP_FILE 0x00000 /* The mapping is backed by a file */ -#define MAP_ANONYMOUS 0x00020 /* The mapping is not backed by any file */ -#define MAP_ANON MAP_ANONYMOUS - -/* These are Linux-specific. */ - -#define MAP_GROWSDOWN 0x00100 /* Used to stack allocations */ -#define MAP_DENYWRITE 0x00800 /* Do not permit writes to file */ -#define MAP_EXECUTABLE 0x01000 /* Mark it as an executable */ -#define MAP_LOCKED 0x02000 /* Lock pages mapped into memory */ -#define MAP_NORESERVE 0x04000 /* Do not reserve swap space for this mapping */ -#define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables */ -#define MAP_NONBLOCK 0x10000 /* Do not block on IO */ - -/* Failure return */ - -#define MAP_FAILED ((void*)-1) - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -EXTERN FAR void *mmap(FAR void *start, size_t length, int prot, int flags, - int fd, off_t offset); - -#ifdef CONFIG_FS_RAMMAP -EXTERN int munmap(FAR void *start, size_t length); -#else -# define munmap(start, length) -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_SYS_MMAN_H */ diff --git a/nuttx/include/sys/mount.h b/nuttx/include/sys/mount.h deleted file mode 100644 index 194dec8cc..000000000 --- a/nuttx/include/sys/mount.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * include/sys/mount.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 __INCLUDE_SYS_MOUNT_H -#define __INCLUDE_SYS_MOUNT_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/* Mount flags */ - -#define MS_RDONLY 1 /* Mount file system read-only */ - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -EXTERN int mount(const char *source, const char *target, - const char *filesystemtype, unsigned long mountflags, - const void *data); -EXTERN int umount(const char *target); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_SYS_MOUNT_H */ diff --git a/nuttx/include/sys/prctl.h b/nuttx/include/sys/prctl.h deleted file mode 100644 index f1441a77a..000000000 --- a/nuttx/include/sys/prctl.h +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** - * include/sys/prctl.h - * - * Copyright (C) 2012 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_SYS_PRCTL_H -#define __INCLUDE_SYS_PRCTL_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/* Supported prctl() commands. - * - * PR_SET_NAME - * Set the task (or thread) name for the thread whose ID is in required - * arg2 (int), using the value in the location pointed to by required arg1 - * (char*). The name can be up to CONFIG_TASK_NAME_SIZE long (including - * any null termination). The thread ID of 0 will set the name of the - * calling thread. As an example: - * - * prctl(PR_SET_NAME, "MyName", 0); - * - * PR_GET_NAME - * Return the task (or thread) name for the for the thread whose ID is - * optional arg2 (int), in the buffer pointed to by optional arg1 (char *). - * The buffer must be CONFIG_TASK_NAME_SIZE long (including any null - * termination). As an example: - * - * char myname[CONFIG_TASK_NAME_SIZE]; - * prctl(PR_GET_NAME, myname, 0); - */ - - #define PR_SET_NAME 1 - #define PR_GET_NAME 2 - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: prctl - * - * Description: - * prctl() is called with a first argument describing what to do (with - * values PR_* defined above) and with additional arguments depending on - * the specific command. - * - * Returned Value: - * The returned value may depend on the specific commnand. For PR_SET_NAME - * and PR_GET_NAME, the returned value of 0 indicates successful operation. - * On any failure, -1 is retruend and the errno value is set appropriately. - * - * EINVAL The value of 'option' is not recognized. - * EFAULT optional arg1 is not a valid address. - * ESRCH No task/thread can be found corresponding to that specified - * by optional arg1. - * - ****************************************************************************/ - -EXTERN int prctl(int option, ...); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_SYS_PRCTL_H */ diff --git a/nuttx/include/sys/select.h b/nuttx/include/sys/select.h deleted file mode 100644 index 1ff074b6c..000000000 --- a/nuttx/include/sys/select.h +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** - * include/sys/select.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 __INCLUDE_SYS_SELECT_H -#define __INCLUDE_SYS_SELECT_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -#if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0 - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/* Get the total number of descriptors that we will have to support */ - -#define __SELECT_NDESCRIPTORS (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS) - -/* We will use a 32-bit bitsets to represent the set of descriptors. How - * many uint32_t's do we need to span all descriptors? - */ - -#if __SELECT_NDESCRIPTORS <= 32 -# define __SELECT_NUINT32 1 -#elif __SELECT_NDESCRIPTORS <= 64 -# define __SELECT_NUINT32 2 -#elif __SELECT_NDESCRIPTORS <= 96 -# define __SELECT_NUINT32 3 -#elif __SELECT_NDESCRIPTORS <= 128 -# define __SELECT_NUINT32 4 -#elif __SELECT_NDESCRIPTORS <= 160 -# define __SELECT_NUINT32 5 -#elif __SELECT_NDESCRIPTORS <= 192 -# define __SELECT_NUINT32 6 -#elif __SELECT_NDESCRIPTORS <= 224 -# define __SELECT_NUINT32 7 -#elif __SELECT_NDESCRIPTORS <= 256 -# define __SELECT_NUINT32 8 -#else -# warning "Large fd_set needed" -#endif - -/* These macros map a file descripto to an index and bit number */ - -#define _FD_NDX(fd) ((fd) >> 5) -#define _FD_BIT(fd) ((fd) & 0x1f) - -/* Standard helper macros */ - -#define FD_CLR(fd,set) (((uint32_t*)(set))[_FD_NDX(fd)] &= ~(1 << _FD_BIT(fd))) -#define FD_SET(fd,set) (((uint32_t*)(set))[_FD_NDX(fd)] |= (1 << _FD_BIT(fd))) -#define FD_ISSET(fd,set) ((((uint32_t*)(set))[_FD_NDX(fd)] & (1 << _FD_BIT(fd))) != 0) -#define FD_ZERO(set) memset(set, 0, sizeof(fd_set)) - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ - -typedef uint32_t fd_set[__SELECT_NUINT32]; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -EXTERN int select(int nfds, FAR fd_set *readfds, FAR fd_set *writefds, - FAR fd_set *exceptfds, FAR struct timeval *timeout); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* CONFIG_NFILE_DESCRIPTORS || CONFIG_NSOCKET_DESCRIPTORS */ -#endif /* __INCLUDE_SYS_SELECT_H */ diff --git a/nuttx/include/sys/sendfile.h b/nuttx/include/sys/sendfile.h deleted file mode 100644 index 0f3c05444..000000000 --- a/nuttx/include/sys/sendfile.h +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************** - * include/sys/sendfile.h - * - * Copyright (C) 2012 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_SYS_SENDFILE_H -#define __INCLUDE_SYS_SENDFILE_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ - -#ifndef CONFIG_LIB_SENDFILE_BUFSIZE -# define CONFIG_LIB_SENDFILE_BUFSIZE 512 -#endif - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/************************************************************************ - * Name: sendfile - * - * Description: - * sendfile() copies data between one file descriptor and another. - * sendfile() basically just wraps a sequence of reads() and writes() - * to perform a copy. It serves a purpose in systems where there is - * a penalty for copies to between user and kernal space, but really - * nothing in NuttX but provide some Linux compatible (and adding - * another 'almost standard' interface). - * - * NOTE: This interface is *not* specified in POSIX.1-2001, or other - * standards. The implementation here is very similar to the Linux - * sendfile interface. Other UNIX systems implement sendfile() with - * different semantics and prototypes. sendfile() should not be used - * in portable programs. - * - * Input Parmeters: - * infd - A file (or socket) descriptor opened for reading - * outfd - A descriptor opened for writing. - * offset - If 'offset' is not NULL, then it points to a variable - * holding the file offset from which sendfile() will start - * reading data from 'infd'. When sendfile() returns, this - * variable will be set to the offset of the byte following - * the last byte that was read. If 'offset' is not NULL, - * then sendfile() does not modify the current file offset of - * 'infd'; otherwise the current file offset is adjusted to - * reflect the number of bytes read from 'infd.' - * - * If 'offset' is NULL, then data will be read from 'infd' - * starting at the current file offset, and the file offset - * will be updated by the call. - * count - The number of bytes to copy between the file descriptors. - * - * Returned Value: - * If the transfer was successful, the number of bytes written to outfd is - * returned. On error, -1 is returned, and errno is set appropriately. - * There error values are those returned by read() or write() plus: - * - * EINVAL - Bad input parameters. - * ENOMEM - Could not allocated an I/O buffer - * - ************************************************************************/ - -EXTERN ssize_t sendfile (int outfd, int infd, FAR off_t *offset, size_t count); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_SYS_SENDFILE_H */ diff --git a/nuttx/include/sys/socket.h b/nuttx/include/sys/socket.h deleted file mode 100644 index 89ade941f..000000000 --- a/nuttx/include/sys/socket.h +++ /dev/null @@ -1,234 +0,0 @@ -/**************************************************************************** - * include/sys/socket.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 __INCLUDE_SYS_SOCKET_H -#define __INCLUDE_SYS_SOCKET_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* The socket()domain parameter specifies a communication domain; this selects - * the protocol family which will be used for communication. - */ - -/* Protocol families */ - -#define PF_UNSPEC 0 /* Protocol family unspecified */ -#define PF_UNIX 1 /* Local communication */ -#define PF_LOCAL 1 /* Local communication */ -#define PF_INET 2 /* IPv4 Internet protocols */ -#define PF_INET6 3 /* IPv6 Internet protocols */ -#define PF_IPX 4 /* IPX - Novell protocols */ -#define PF_NETLINK 5 /* Kernel user interface device */ -#define PF_X25 6 /* ITU-T X.25 / ISO-8208 protocol */ -#define PF_AX25 7 /* Amateur radio AX.25 protocol */ -#define PF_ATMPVC 8 /* Access to raw ATM PVCs */ -#define PF_APPLETALK 9 /* Appletalk */ -#define PF_PACKET 10 /* Low level packet interface */ - -/* Address families */ - -#define AF_UNSPEC PF_UNSPEC -#define AF_UNIX PF_UNIX -#define AF_LOCAL PF_LOCAL -#define AF_INET PF_INET -#define AF_INET6 PF_INET6 -#define AF_IPX PF_IPX -#define AF_NETLINK PF_NETLINK -#define AF_X25 PF_X25 -#define AF_AX25 PF_AX25 -#define AF_ATMPVC PF_ATMPVC -#define AF_APPLETALK PF_APPLETALK -#define AF_PACKET PF_PACKET - -/* The socket created by socket() has the indicated type, which specifies - * the communication semantics. - */ - -#define SOCK_STREAM 0 /* Provides sequenced, reliable, two-way, connection-based byte streams. - * An out-of-band data transmission mechanism may be supported. */ -#define SOCK_DGRAM 1 /* Supports datagrams (connectionless, unreliable messages of a fixed - * maximum length). */ -#define SOCK_SEQPACKET 2 /* Provides a sequenced, reliable, two-way connection-based data - * transmission path for datagrams of fixed maximum length; a consumer - * is required to read an entire packet with each read system call. */ -#define SOCK_RAW 3 /* Provides raw network protocol access. */ -#define SOCK_RDM 4 /* Provides a reliable datagram layer that does not guarantee ordering. */ -#define SOCK_PACKET 5 /* Obsolete and should not be used in new programs */ - -/* Bits in the FLAGS argument to `send', `recv', et al. These are the bits - * recognized by Linus, not all are supported by NuttX. - */ - -#define MSG_OOB 0x0001 /* Process out-of-band data. */ -#define MSG_PEEK 0x0002 /* Peek at incoming messages. */ -#define MSG_DONTROUTE 0x0004 /* Don't use local routing. */ -#define MSG_CTRUNC 0x0008 /* Control data lost before delivery. */ -#define MSG_PROXY 0x0010 /* Supply or ask second address. */ -#define MSG_TRUNC 0x0020 -#define MSG_DONTWAIT 0x0040 /* Enable nonblocking IO. */ -#define MSG_EOR 0x0080 /* End of record. */ -#define MSG_WAITALL 0x0100 /* Wait for a full request. */ -#define MSG_FIN 0x0200 -#define MSG_SYN 0x0400 -#define MSG_CONFIRM 0x0800 /* Confirm path validity. */ -#define MSG_RST 0x1000 -#define MSG_ERRQUEUE 0x2000 /* Fetch message from error queue. */ -#define MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE. */ -#define MSG_MORE 0x8000 /* Sender will send more. */ - -/* Socket options */ - -#define SO_DEBUG 0 /* Enables recording of debugging information (get/set). - * arg: pointer to integer containing a boolean value */ -#define SO_ACCEPTCONN 1 /* Reports whether socket listening is enabled (get only). - * arg: pointer to integer containing a boolean value */ -#define SO_BROADCAST 2 /* Permits sending of broadcast messages (get/set). - * arg: pointer to integer containing a boolean value */ -#define SO_REUSEADDR 3 /* Allow reuse of local addresses (get/set) - * arg: pointer to integer containing a boolean value */ -#define SO_KEEPALIVE 4 /* Keeps connections active by enabling the periodic transmission - * of messages (get/set). - * arg: pointer to integer containing a boolean value */ -#define SO_LINGER 5 /* Lingers on a close() if data is present (get/set) - * arg: struct linger */ -#define SO_OOBINLINE 6 /* Leaves received out-of-band data (data marked urgent) inline - * (get/set) arg: pointer to integer containing a boolean value */ -#define SO_SNDBUF 7 /* Sets send buffer size. arg: integer value (get/set). */ -#define SO_RCVBUF 8 /* Sets receive buffer size. arg: integer value (get/set). */ -#define SO_ERROR 9 /* Reports and clears error status (get only). arg: returns - * an integer value */ -#define SO_TYPE 10 /* Reports the socket type (get only). return: int */ -#define SO_DONTROUTE 11 /* Requests that outgoing messages bypass standard routing (get/set) - * arg: pointer to integer containing a boolean value */ -#define SO_RCVLOWAT 12 /* Sets the minimum number of bytes to process for socket input - * (get/set). arg: integer value */ -#define SO_RCVTIMEO 13 /* Sets the timeout value that specifies the maximum amount of time - * an input function waits until it completes (get/set). - * arg: struct timeval */ -#define SO_SNDLOWAT 14 /* Sets the minimum number of bytes to process for socket output - * (get/set). arg: integer value */ -#define SO_SNDTIMEO 15 /* Sets the timeout value specifying the amount of time that an - * output function blocks because flow control prevents data from - * being sent(get/set). arg: struct timeval */ - -/* Protocol levels supported by get/setsockopt(): */ - -#define SOL_SOCKET 0 /* Only socket-level options supported */ - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ - - /* sockaddr_storage structure. This structure must be (1) large enough to - * accommodate all supported protocol-specific address structures, and (2) - * aligned at an appropriate boundary so that pointers to it can be cast - * as pointers to protocol-specific address structures and used to access - * the fields of those structures without alignment problems - */ - -#ifdef CONFIG_NET_IPv6 -struct sockaddr_storage -{ - sa_family_t ss_family; /* Address family */ - char ss_data[18]; /* 18-bytes of address data */ -}; -#else -struct sockaddr_storage -{ - sa_family_t ss_family; /* Address family */ - char ss_data[14]; /* 14-bytes of address data */ -}; -#endif - -/* The sockaddr structure is used to define a socket address which is used - * in the bind(), connect(), getpeername(), getsockname(), recvfrom(), and - * sendto() functions. - */ - -struct sockaddr -{ - sa_family_t sa_family; /* Address family: See AF_* definitions */ - char sa_data[14]; /* 14-bytes of address data */ -}; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -EXTERN int socket(int domain, int type, int protocol); -EXTERN int bind(int sockfd, FAR const struct sockaddr *addr, socklen_t addrlen); -EXTERN int connect(int sockfd, FAR const struct sockaddr *addr, socklen_t addrlen); - -EXTERN int listen(int sockfd, int backlog); -EXTERN int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen); - -EXTERN ssize_t send(int sockfd, FAR const void *buf, size_t len, int flags); -EXTERN ssize_t sendto(int sockfd, FAR const void *buf, size_t len, int flags, - FAR const struct sockaddr *to, socklen_t tolen); - -EXTERN ssize_t recv(int sockfd, FAR void *buf, size_t len, int flags); -EXTERN ssize_t recvfrom(int sockfd, FAR void *buf, size_t len, int flags, - FAR struct sockaddr *from, FAR socklen_t *fromlen); - -EXTERN int setsockopt(int sockfd, int level, int option, - FAR const void *value, socklen_t value_len); -EXTERN int getsockopt(int sockfd, int level, int option, - FAR void *value, FAR socklen_t *value_len); - -EXTERN int getsockname(int sockfd, FAR struct sockaddr *addr, - FAR socklen_t *addrlen); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_SYS_SOCKET_H */ diff --git a/nuttx/include/sys/sockio.h b/nuttx/include/sys/sockio.h deleted file mode 100644 index abfc2f562..000000000 --- a/nuttx/include/sys/sockio.h +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** - * include/sys/sockio.h - * - * Copyright (C) 2010, 2012 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_SYS_SOCKIO_H -#define __INCLUDE_SYS_SOCKIO_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -/* Get NuttX configuration and NuttX-specific network IOCTL definitions */ - -#include -#include -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -#define IMSFNAMSIZ 8 - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ - - /* RFC3678: IPv4 Options - * - * o ioctl() SIOCGIPMSFILTER: to retrieve the list of source addresses - * that comprise the source filter along with the current filter mode. - * - * o ioctl() SIOCSIPMSFILTER: to set or modify the source filter content - * (e.g., unicast source address list) or mode (exclude or include). - * - * Ioctl option Argument type - * ----------------------------- ---------------------- - * SIOCGIPMSFILTER struct ip_msfilter - * SIOCSIPMSFILTER struct ip_msfilter - * - * The imsf_fmode mode is a 32-bit integer that identifies the filter - * mode. The value of this field must be either MCAST_INCLUDE or - * MCAST_EXCLUDE, which are likewise defined in . - */ - -#if 0 /* REVISIT: Current NuttX implementation is non-standard. - * Lookup is by device name, not IP address. - */ - -struct ip_msfilter -{ - struct in_addr imsf_multiaddr; /* IP multicast address of group */ - struct in_addr imsf_interface; /* Local IP address of interface */ - uint32_t imsf_fmode; /* Filter mode */ -#ifdef CONFIG_NET_IGMPv3 - uint32_t imsf_numsrc; /* number of sources in src_list */ - struct in_addr imsf_slist[1]; /* start of source list */ -#endif -}; - -#else - -struct ip_msfilter -{ - char imsf_name[IMSFNAMSIZ]; /* Network device name, e.g., "eth0" */ - struct in_addr imsf_multiaddr; /* IP multicast address of group */ - uint32_t imsf_fmode; /* Filter mode */ -}; - -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_SYS_SOCKIO_H */ diff --git a/nuttx/include/sys/stat.h b/nuttx/include/sys/stat.h deleted file mode 100644 index 1204b15aa..000000000 --- a/nuttx/include/sys/stat.h +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** - * include/sys/stat.h - * - * Copyright (C) 2007-2009, 2012 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_SYS_STAT_H -#define __INCLUDE_SYS_STAT_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* mode_t bit settings (most of these do not apply to Nuttx). This assumes - * that the full size of a mode_t is 16-bits. (However, mode_t must be size - * 'int' because it is promoted to size int when passed in varargs). - */ - -#define S_IXOTH 0000001 /* Permissions for others: RWX */ -#define S_IWOTH 0000002 -#define S_IROTH 0000004 -#define S_IRWXO 0000007 - -#define S_IXGRP 0000010 /* Group permissions: RWX */ -#define S_IWGRP 0000020 -#define S_IRGRP 0000040 -#define S_IRWXG 0000070 - -#define S_IXUSR 0000100 /* Owner permissions: RWX */ -#define S_IWUSR 0000200 -#define S_IRUSR 0000400 -#define S_IRWXU 0000700 - -#define S_ISVTX 0001000 /* "sticky" bit */ -#define S_ISGID 0002000 /* Set group ID bit */ -#define S_ISUID 0004000 /* Set UID bit */ - -#define S_IFIFO 0010000 /* File type bites */ -#define S_IFCHR 0020000 -#define S_IFDIR 0040000 -#define S_IFBLK 0060000 -#define S_IFREG 0100000 -#define S_IFLNK 0120000 -#define S_IFSOCK 0140000 -#define S_IFMT 0170000 - -/* File type macros that operate on an instance of mode_t */ - -#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ - -/* This is the simplified struct stat as returned by fstat(). This structure - * provides information about a specific file or directory in the file system. - */ - -struct stat -{ - mode_t st_mode; /* File type, atributes, and access mode bits */ - off_t st_size; /* Size of file/directory, in bytes */ - blksize_t st_blksize; /* Blocksize used for filesystem I/O */ - blkcnt_t st_blocks; /* Number of blocks allocated */ - time_t st_atime; /* Time of last access */ - time_t st_mtime; /* Time of last modification */ - time_t st_ctime; /* Time of last status change */ -}; - -/**************************************************************************** - * Global Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -EXTERN int mkdir(FAR const char *pathname, mode_t mode); -EXTERN int mkfifo(FAR const char *pathname, mode_t mode); -EXTERN int stat(const char *path, FAR struct stat *buf); -EXTERN int fstat(int fd, FAR struct stat *buf); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_SYS_STAT_H */ diff --git a/nuttx/include/sys/statfs.h b/nuttx/include/sys/statfs.h deleted file mode 100644 index 70e963dd9..000000000 --- a/nuttx/include/sys/statfs.h +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** - * include/sys/statfs.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 __INCLUDE_SYS_STATFS_H -#define __INCLUDE_SYS_STATFS_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/* struct statfs file system types. */ - -#define ADFS_SUPER_MAGIC 0xadf5 -#define AFFS_SUPER_MAGIC 0xadff -#define BEFS_SUPER_MAGIC 0x42465331 -#define BFS_MAGIC 0x1badface -#define CIFS_MAGIC_NUMBER 0xff534d42 -#define CODA_SUPER_MAGIC 0x73757245 -#define COH_SUPER_MAGIC 0x012ff7b7 -#define CRAMFS_MAGIC 0x28cd3d45 -#define DEVFS_SUPER_MAGIC 0x1373 -#define EFS_SUPER_MAGIC 0x00414a53 -#define EXT_SUPER_MAGIC 0x137d -#define EXT2_OLD_SUPER_MAGIC 0xef51 -#define EXT2_SUPER_MAGIC 0xef53 -#define EXT3_SUPER_MAGIC 0xef53 -#define HFS_SUPER_MAGIC 0x4244 -#define HPFS_SUPER_MAGIC 0xf995e849 -#define HUGETLBFS_MAGIC 0x958458f6 -#define ISOFS_SUPER_MAGIC 0x9660 -#define JFFS2_SUPER_MAGIC 0x72b6 -#define JFS_SUPER_MAGIC 0x3153464a -#define MINIX_SUPER_MAGIC 0x137f /* orig. minix */ -#define MINIX_SUPER_MAGIC2 0x138f /* 30 char minix */ -#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 */ -#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2, 30 char names */ -#define MSDOS_SUPER_MAGIC 0x4d44 -#define NCP_SUPER_MAGIC 0x564c -#define NFS_SUPER_MAGIC 0x6969 -#define NTFS_SB_MAGIC 0x5346544e -#define OPENPROM_SUPER_MAGIC 0x9fa1 -#define PROC_SUPER_MAGIC 0x9fa0 -#define QNX4_SUPER_MAGIC 0x002f -#define REISERFS_SUPER_MAGIC 0x52654973 -#define ROMFS_MAGIC 0x7275 -#define SMB_SUPER_MAGIC 0x517B -#define SYSV2_SUPER_MAGIC 0x012ff7b6 -#define SYSV4_SUPER_MAGIC 0x012FF7B5 -#define TMPFS_MAGIC 0x01021994 -#define UDF_SUPER_MAGIC 0x15013346 -#define UFS_MAGIC 0x00011954 -#define USBDEVICE_SUPER_MAGIC 0x9fa2 -#define VXFS_SUPER_MAGIC 0xa501fcf5 -#define XENIX_SUPER_MAGIC 0x012ff7b4 -#define XFS_SUPER_MAGIC 0x58465342 -#define _XIAFS_SUPER_MAGIC 0x012fd16d - -/* NuttX specific file-systems */ - -#define BINFS_MAGIC 0x4242 -#define NXFFS_MAGIC 0x4747 - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ - -struct statfs -{ - uint32_t f_type; /* Type of filesystem (see definitions above) */ - size_t f_namelen; /* Maximum length of filenames */ - size_t f_bsize; /* Optimal block size for transfers */ - off_t f_blocks; /* Total data blocks in the file system of this size */ - off_t f_bfree; /* Free blocks in the file system */ - off_t f_bavail; /* Free blocks avail to non-superuser */ - off_t f_files; /* Total file nodes in the file system */ - off_t f_ffree; /* Free file nodes in the file system */ -}; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/* Inspired by Linux statfs() which was, in turn, inspired by - * the BSD statfs(). None of these implementations agree in the - * form of the struct statfs. - */ - -EXTERN int statfs(const char *path, struct statfs *buf); -EXTERN int fstatfs(int fd, struct statfs *buf); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_SYS_STATFS_H */ diff --git a/nuttx/include/sys/syscall.h b/nuttx/include/sys/syscall.h deleted file mode 100644 index 57545beb7..000000000 --- a/nuttx/include/sys/syscall.h +++ /dev/null @@ -1,398 +0,0 @@ -/**************************************************************************** - * include/sys/syscall.h - * This file contains the system call numbers. - * - * Copyright (C) 2011-2012 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_SYS_SYSCALL_H -#define __INCLUDE_SYS_SYSCALL_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#ifndef __ASSEMBLY__ -# include -#endif - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Reserve the first system calls for platform-specific usage if so - * configured. - */ - -#ifndef CONFIG_SYS_RESERVED -# define CONFIG_SYS_RESERVED (0) -#endif - -/* System call numbers - * - * These first system calls are supported regardless of the NuttX - * configuration - */ - -#define SYS__exit (CONFIG_SYS_RESERVED+0) -#define SYS_exit (CONFIG_SYS_RESERVED+1) -#define SYS_get_errno (CONFIG_SYS_RESERVED+2) -#define SYS_getpid (CONFIG_SYS_RESERVED+3) -#define SYS_sched_getparam (CONFIG_SYS_RESERVED+4) -#define SYS_sched_getscheduler (CONFIG_SYS_RESERVED+5) -#define SYS_sched_lock (CONFIG_SYS_RESERVED+6) -#define SYS_sched_lockcount (CONFIG_SYS_RESERVED+7) -#define SYS_sched_rr_get_interval (CONFIG_SYS_RESERVED+8) -#define SYS_sched_setparam (CONFIG_SYS_RESERVED+9) -#define SYS_sched_setscheduler (CONFIG_SYS_RESERVED+10) -#define SYS_sched_unlock (CONFIG_SYS_RESERVED+11) -#define SYS_sched_yield (CONFIG_SYS_RESERVED+12) -#define SYS_sem_close (CONFIG_SYS_RESERVED+13) -#define SYS_sem_destroy (CONFIG_SYS_RESERVED+14) -#define SYS_sem_open (CONFIG_SYS_RESERVED+15) -#define SYS_sem_post (CONFIG_SYS_RESERVED+16) -#define SYS_sem_trywait (CONFIG_SYS_RESERVED+17) -#define SYS_sem_unlink (CONFIG_SYS_RESERVED+18) -#define SYS_sem_wait (CONFIG_SYS_RESERVED+19) -#define SYS_set_errno (CONFIG_SYS_RESERVED+20) -#define SYS_task_create (CONFIG_SYS_RESERVED+21) -#define SYS_task_delete (CONFIG_SYS_RESERVED+22) -#define SYS_task_restart (CONFIG_SYS_RESERVED+23) -#define SYS_up_assert (CONFIG_SYS_RESERVED+24) -#define SYS_up_assert_code (CONFIG_SYS_RESERVED+25) -#define __SYS_atexit (CONFIG_SYS_RESERVED+26) - -/* The following can be individually enabled */ - -#ifdef CONFIG_SCHED_ATEXIT -# define SYS_atexit __SYS_atexit -# define __SYS_onexit (__SYS_atexit+1) -#else -# define __SYS_onexit __SYS_atexit -#endif - -#ifdef CONFIG_SCHED_ONEXIT -# define SYS_onexit __SYS_onexit -# define __SYS_waitpaid (__SYS_onexit+1) -#else -# define __SYS_waitpaid __SYS_onexit -#endif - -#ifdef CONFIG_SCHED_WAITPID -# define SYS_waitpid __SYS_waitpaid -# define __SYS_signals (__SYS_waitpaid+1) -#else -# define __SYS_signals __SYS_waitpaid -#endif - -/* The following are only defined is signals are supported in the NuttX - * configuration. - */ - -#ifndef CONFIG_DISABLE_SIGNALS -# define SYS_kill (__SYS_signals+0) -# define SYS_sigaction (__SYS_signals+1) -# define SYS_sigpending (__SYS_signals+2) -# define SYS_sigprocmask (__SYS_signals+3) -# define SYS_sigqueue (__SYS_signals+4) -# define SYS_sigsuspend (__SYS_signals+5) -# define SYS_sigtimedwait (__SYS_signals+6) -# define SYS_sigwaitinfo (__SYS_signals+7) -# define SYS_sleep (__SYS_signals+8) -# define SYS_usleep (__SYS_signals+9) -# define __SYS_clock (__SYS_signals+10) -#else -# define __SYS_clock __SYS_signals -#endif - -/* The following are only defined if the system clock is enabled in the - * NuttX configuration. - */ - -#ifndef CONFIG_DISABLE_CLOCK -# define SYS_clock_systimer (__SYS_clock+0) -# define SYS_clock_getres (__SYS_clock+1) -# define SYS_clock_gettime (__SYS_clock+2) -# define SYS_clock_settime (__SYS_clock+3) -# define SYS_gettimeofday (__SYS_clock+4) -# define __SYS_timers (__SYS_clock+5) -#else -# define __SYS_timers __SYS_clock -#endif - -/* The following are defined only if POSIX timers are supported */ - -#ifndef CONFIG_DISABLE_POSIX_TIMERS -# define SYS_timer_create (__SYS_timers+0) -# define SYS_timer_delete (__SYS_timers+1) -# define SYS_timer_getoverrun (__SYS_timers+2) -# define SYS_timer_gettime (__SYS_timers+3) -# define SYS_timer_settime (__SYS_timers+4) -# define __SYS_descriptors (__SYS_timers+5) -#else -# define __SYS_descriptors __SYS_timers -#endif - -/* The following are defined if either file or socket descriptor are - * enabled. - */ - -#ifndef CONFIG_NET -# undef CONFIG_NSOCKET_DESCRIPTORS -# define CONFIG_NSOCKET_DESCRIPTORS 0 -#endif - -#if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0 -# define SYS_close (__SYS_descriptors+0) -# define SYS_ioctl (__SYS_descriptors+1) -# define SYS_read (__SYS_descriptors+2) -# define SYS_write (__SYS_descriptors+3) -# ifndef CONFIG_DISABLE_POLL -# define SYS_poll (__SYS_descriptors+4) -# define SYS_select (__SYS_descriptors+5) -# define __SYS_filedesc (__SYS_descriptors+6) -# else -# define __SYS_filedesc (__SYS_descriptors+4) -# endif -#else -# define __SYS_filedesc __SYS_descriptors -#endif - -/* The following are defined if file descriptors are enabled */ - -#if CONFIG_NFILE_DESCRIPTORS > 0 -# define SYS_closedir (__SYS_filedesc+0) -# define SYS_dup (__SYS_filedesc+1) -# define SYS_dup2 (__SYS_filedesc+2) -# define SYS_fcntl (__SYS_filedesc+3) -# define SYS_lseek (__SYS_filedesc+4) -# define SYS_mkfifo (__SYS_filedesc+5) -# define SYS_mmap (__SYS_filedesc+6) -# define SYS_open (__SYS_filedesc+7) -# define SYS_opendir (__SYS_filedesc+8) -# define SYS_pipe (__SYS_filedesc+9) -# define SYS_readdir (__SYS_filedesc+10) -# define SYS_rewinddir (__SYS_filedesc+11) -# define SYS_seekdir (__SYS_filedesc+12) -# define SYS_stat (__SYS_filedesc+13) -# define SYS_statfs (__SYS_filedesc+14) -# define SYS_telldir (__SYS_filedesc+15) - -# if CONFIG_NFILE_STREAMS > 0 -# define SYS_fs_fdopen (__SYS_filedesc+16) -# define SYS_sched_getstreams (__SYS_filedesc+17) -# define __SYS_mountpoint (__SYS_filedesc+18) -# else -# define __SYS_mountpoint (__SYS_filedesc+16) -# endif - -# if !defined(CONFIG_DISABLE_MOUNTPOINT) -# define SYS_fsync (__SYS_mountpoint+0) -# define SYS_mkdir (__SYS_mountpoint+1) -# define SYS_mount (__SYS_mountpoint+2) -# define SYS_rename (__SYS_mountpoint+3) -# define SYS_rmdir (__SYS_mountpoint+4) -# define SYS_umount (__SYS_mountpoint+5) -# define SYS_unlink (__SYS_mountpoint+6) -# define __SYS_pthread (__SYS_mountpoint+7) -# else -# define __SYS_pthread __SYS_mountpoint -# endif - -#else -# define __SYS_pthread __SYS_filedesc -#endif - -/* The following are defined if pthreads are enabled */ - -#ifndef CONFIG_DISABLE_PTHREAD -# define SYS_pthread_barrier_destroy (__SYS_pthread+0) -# define SYS_pthread_barrier_init (__SYS_pthread+1) -# define SYS_pthread_barrier_wait (__SYS_pthread+2) -# define SYS_pthread_cancel (__SYS_pthread+3) -# define SYS_pthread_cond_broadcast (__SYS_pthread+4) -# define SYS_pthread_cond_destroy (__SYS_pthread+5) -# define SYS_pthread_cond_init (__SYS_pthread+6) -# define SYS_pthread_cond_signal (__SYS_pthread+7) -# define SYS_pthread_cond_wait (__SYS_pthread+8) -# define SYS_pthread_create (__SYS_pthread+9) -# define SYS_pthread_detach (__SYS_pthread+10) -# define SYS_pthread_exit (__SYS_pthread+11) -# define SYS_pthread_getschedparam (__SYS_pthread+12) -# define SYS_pthread_getspecific (__SYS_pthread+13) -# define SYS_pthread_join (__SYS_pthread+14) -# define SYS_pthread_key_create (__SYS_pthread+15) -# define SYS_pthread_key_delete (__SYS_pthread+16) -# define SYS_pthread_mutex_destroy (__SYS_pthread+17) -# define SYS_pthread_mutex_init (__SYS_pthread+18) -# define SYS_pthread_mutex_lock (__SYS_pthread+19) -# define SYS_pthread_mutex_trylock (__SYS_pthread+20) -# define SYS_pthread_mutex_unlock (__SYS_pthread+21) -# define SYS_pthread_once (__SYS_pthread+22) -# define SYS_pthread_setcancelstate (__SYS_pthread+23) -# define SYS_pthread_setschedparam (__SYS_pthread+24) -# define SYS_pthread_setschedprio (__SYS_pthread+25) -# define SYS_pthread_setspecific (__SYS_pthread+26) -# define SYS_pthread_yield (__SYS_pthread+27) - -# ifndef CONFIG_DISABLE_SIGNAL -# define SYS_pthread_cond_timedwait (__SYS_pthread+28) -# define SYS_pthread_kill (__SYS_pthread+29) -# define SYS_pthread_sigmask (__SYS_pthread+30) -# define __SYS_mqueue (__SYS_pthread+31) -# else -# define __SYS_mqueue (__SYS_pthread+28) -# endif - -#else -# define __SYS_mqueue __SYS_pthread -#endif - -/* The following are defined only if message queues are enabled */ - -#ifndef CONFIG_DISABLE_MQUEUE -# define SYS_mq_close (__SYS_mqueue+0) -# define SYS_mq_notify (__SYS_mqueue+1) -# define SYS_mq_open (__SYS_mqueue+2) -# define SYS_mq_receive (__SYS_mqueue+3) -# define SYS_mq_send (__SYS_mqueue+4) -# define SYS_mq_timedreceive (__SYS_mqueue+5) -# define SYS_mq_timedsend (__SYS_mqueue+6) -# define SYS_mq_unlink (__SYS_mqueue+7) -# define __SYS_environ (__SYS_mqueue+8) -#else -# define __SYS_environ __SYS_mqueue -#endif - -/* The following are defined only if environment variables are supported */ - -#ifndef CONFIG_DISABLE_ENVIRON -# define SYS_clearenv (__SYS_environ+0) -# define SYS_getenv (__SYS_environ+1) -# define SYS_putenv (__SYS_environ+2) -# define SYS_setenv (__SYS_environ+3) -# define SYS_unsetenv (__SYS_environ+4) -# define __SYS_network (__SYS_environ+5) -#else -# define __SYS_network __SYS_environ -#endif - -/* The following are defined only if networking AND sockets are supported */ - -#if CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET) -# define SYS_accept (__SYS_network+0) -# define SYS_bind (__SYS_network+1) -# define SYS_connect (__SYS_network+2) -# define SYS_getsockopt (__SYS_network+3) -# define SYS_listen (__SYS_network+4) -# define SYS_recv (__SYS_network+5) -# define SYS_recvfrom (__SYS_network+6) -# define SYS_send (__SYS_network+7) -# define SYS_sendto (__SYS_network+8) -# define SYS_setsockopt (__SYS_network+9) -# define SYS_socket (__SYS_network+10) -# define SYS_nnetsocket (__SYS_network+11) -#else -# define SYS_nnetsocket __SYS_network -#endif - -/* The following is defined only if CONFIG_TASK_NAME_SIZE > 0 */ - -#if CONFIG_TASK_NAME_SIZE > 0 -# define SYS_prctl (SYS_nnetsocket+0) -# define SYS_maxsyscall (SYS_nnetsocket+1) -#else -# define SYS_maxsyscall SYS_nnetsocket -#endif - -/* Note that the reported number of system calls does *NOT* include the - * architecture-specific system calls. If the "real" total is required, - * use SYS_maxsyscall. - */ - -#define SYS_nsyscalls (SYS_maxsyscall-CONFIG_SYS_RESERVED) - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -#ifndef __ASSEMBLY__ - -/* This is the union of all possible stub function types */ - -union syscall_stubfunc_u -{ - uintptr_t (*stub0)(void); - uintptr_t (*stub1)(uintptr_t parm1); - uintptr_t (*stub2)(uintptr_t parm1, uintptr_t parm2); - uintptr_t (*stub3)(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3); - uintptr_t (*stub4)(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, - uintptr_t parm4); - uintptr_t (*stub5)(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, - uintptr_t parm4, uintptr_t parm5); - uintptr_t (*stub6)(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, - uintptr_t parm4, uintptr_t parm5, uintptr_t parm6); -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/* Stub lookup tables. Each table is indexed by the system call numbers - * defined above. Given the system call number, the corresponding entry in - * these tables describes how to call the stub dispatch function. - */ - -EXTERN const union syscall_stubfunc_u g_stublookup[SYS_nsyscalls]; -EXTERN const uint8_t g_stubnparms[SYS_nsyscalls]; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __ASSEMBLY__ */ -#endif /* __INCLUDE_SYS_SYSCALL_H */ - diff --git a/nuttx/include/sys/time.h b/nuttx/include/sys/time.h deleted file mode 100644 index 75dfd7280..000000000 --- a/nuttx/include/sys/time.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** - * include/sys/time.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 __INCLUDE_SYS_TIME_H -#define __INCLUDE_SYS_TIME_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -EXTERN int gettimeofday(struct timeval *tp, FAR void *tzp); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_SYS_TIME_H */ diff --git a/nuttx/include/sys/types.h b/nuttx/include/sys/types.h deleted file mode 100644 index 38f091e8a..000000000 --- a/nuttx/include/sys/types.h +++ /dev/null @@ -1,234 +0,0 @@ -/**************************************************************************** - * include/sys/types.h - * - * Copyright (C) 2007-2009, 2011-2012 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_SYS_TYPES_H -#define __INCLUDE_SYS_TYPES_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#ifndef __ASSEMBLY__ -# include -#endif - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Alternative values for type bool (for historic reasons) */ - -#ifndef TRUE -# define TRUE 1 -#endif -#ifndef FALSE -# define FALSE 0 -#endif - -/* NULL is usually defined in stddef.h (which includes this file) */ - -#ifndef NULL - /* SDCC is sensitive to NULL pointer type conversions, and C++ defines - * NULL as zero - */ - -# if defined(SDCC) || defined(__cplusplus) -# define NULL (0) -# else -# define NULL ((void*)0) -# endif -#endif - -/* POSIX-like OS return values: */ - -#if !defined(__cplusplus) -# undef ERROR -# define ERROR -1 -#endif - -#undef OK -#define OK 0 - -/* HPUX-like MIN/MAX value */ - -#define PRIOR_RR_MIN 0 -#define PRIOR_RR_MAX 255 -#define PRIOR_FIFO_MIN 0 -#define PRIOR_FIFO_MAX 255 -#define PRIOR_OTHER_MIN 0 -#define PRIOR_OTHER_MAX 255 - -/* Scheduling Priorities. NOTE: Only the idle task can take - * the true minimum priority. */ - -#define SCHED_PRIORITY_MAX 255 -#define SCHED_PRIORITY_DEFAULT 100 -#define SCHED_PRIORITY_MIN 1 -#define SCHED_PRIORITY_IDLE 0 - -/**************************************************************************** - * Type Declarations - ****************************************************************************/ - -#ifndef __ASSEMBLY__ - -/* Floating point types */ - -typedef float float32; -#ifndef CONFIG_HAVE_DOUBLE -typedef float double_t; -typedef float float64; -#else -typedef double double_t; -typedef double float64; -#endif - -/* Misc. scalar types */ - -/* mode_t is an integer type used for file attributes. mode_t needs - * to be at least 16-bits but, in fact must be sizeof(int) because it is - * pased via varargs. - */ - -typedef unsigned int mode_t; - -/* size_t is used for sizes of memory objects. - * ssize_t is used for a count of bytes or an error indication. - */ - -#ifdef CONFIG_SMALL_MEMORY -typedef uint16_t size_t; -typedef int16_t ssize_t; -#else -typedef uint32_t size_t; -typedef int32_t ssize_t; -#endif - -/* uid_t is used for user IDs - * gid_t is used for group IDs. - */ - -typedef int16_t uid_t; -typedef int16_t gid_t; - -/* dev_t is used for device IDs */ - -typedef uint16_t dev_t; - -/* ino_t is used for file serial numbers */ - -typedef uint16_t ino_t; - -/* pid_t is used for process IDs and process group IDs. It must be signed because - * negative PID values are used to represent invalid PIDs. - */ - -typedef int16_t pid_t; - -/* id_t is a general identifier that can be used to contain at least a pid_t, - * uid_t, or gid_t. - */ - -typedef int16_t id_t; - -/* Signed integral type of the result of subtracting two pointers */ - -typedef intptr_t ptrdiff_t; - -/* Wide, 16-bit character types. wchar_t is a built-in type in C++ and - * its declaration here may cause compilation errors on some compilers - * if -DCONFIG_WCHAR_BUILTIN is not included in the CXXFLAGS. - */ - -#ifndef CONFIG_WCHAR_BUILTIN -typedef uint16_t wchar_t; -#endif - -/* blkcnt_t and off_t are signed integer types. - * - * blkcnt_t is used for file block counts. - * off_t is used for file offsets and sizes. - * fpos_t is used for file positions. - * - * Hence, all should be independent of processor architecture. - */ - -typedef uint32_t blkcnt_t; -typedef int32_t off_t; -typedef off_t fpos_t; - -/* Large file versions */ - -#ifdef CONFIG_HAVE_LONG_LONG -typedef int64_t off64_t; -typedef int64_t fpos64_t; -#endif - -/* blksize_t is a signed integer value used for file block sizes */ - -typedef int16_t blksize_t; - -/* Network related */ - -typedef unsigned int socklen_t; -typedef uint16_t sa_family_t; - -/* Used for system times in clock ticks */ - -typedef uint32_t clock_t; - -/* The type useconds_t shall be an unsigned integer type capable of storing - * values at least in the range [0, 1000000]. The type suseconds_t shall be - * a signed integer type capable of storing values at least in the range - * [-1, 1000000]. - */ - -typedef uint32_t useconds_t; -typedef int32_t suseconds_t; - -/* Task entry point */ - -typedef int (*main_t)(int argc, char *argv[]); - -#endif - -/**************************************************************************** - * Global Function Prototypes - ****************************************************************************/ - -#endif /* __INCLUDE_SYS_TYPES_H */ diff --git a/nuttx/include/sys/vfs.h b/nuttx/include/sys/vfs.h deleted file mode 100644 index 8433893c3..000000000 --- a/nuttx/include/sys/vfs.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** - * include/sys/vfs.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 __INCLUDE_SYS_VFS_H -#define __INCLUDE_SYS_VFS_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -/* sys/vfs.h is just an alternative location for the information in - * sys/statfs.h. - */ - -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#endif /* __INCLUDE_SYS_VFS_H */ diff --git a/nuttx/include/sys/wait.h b/nuttx/include/sys/wait.h deleted file mode 100644 index 2476adef9..000000000 --- a/nuttx/include/sys/wait.h +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** - * include/sys/wait.h - * - * Copyright (C) 2011, 2013 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_SYS_WAIT_H -#define __INCLUDE_SYS_WAIT_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#ifdef CONFIG_SCHED_WAITPID - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/* The following are provided for analysis of returned status values. - * Encoded is as follows as 2 bytes of info(MS) then two bytes of code (LS). - * Code: - * 0 - Child has exited, info is the exit code. - * Other values - Not implemented - */ - -#define WEXITSTATUS(s) (((s) >> 8) & 0xff)/* Return exit status */ - -#define WIFEXITED(s) (((s) & 0xff) == 0) /* True: Child exited normally */ -#define WIFCONTINUED(s) (false) /* True: Child has been continued */ -#define WIFSIGNALED(s) (false) /* True: Child exited due to uncaught signal */ -#define WIFSTOPPED(s) (false) /* True: Child is currently stopped */ -#define WSTOPSIG(s) (false) /* Return signal number that caused process to stop */ -#define WTERMSIG(s) (false) /* Return signal number that caused process to terminate */ - -/* The following symbolic constants are possible values for the options - * argument to waitpid() (1) and/or waitid() (2), - */ - -#define WCONTINUED (1 << 0) /* Status for child that has been continued (1)(2) */ -#define WNOHANG (1 << 1) /* Do not wait if status not available (1) */ -#define WUNTRACED (1 << 2) /* Report status of stopped child process (1) */ - -#define WEXITED (1 << 3) /* Wait for processes that have exited (2) */ -#define WSTOPPED (1 << 4) /* Status for child stopped on signal (2) */ -#define WNOHANG (1 << 5) /* Return immediately if there are no children (2) */ -#define WNOWAIT (1 << 6) /* Keep the process in a waitable state (2) */ - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -#ifndef __ASSEMBLY__ - -enum idtype_e -{ - P_PID = 1, - P_GID = 2, - P_ALL = 3 -}; -typedef enum idtype_e idtype_t; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -EXTERN pid_t wait(FAR int *stat_loc); -EXTERN int waitid(idtype_t idtype, id_t id, FAR siginfo_t *info, int options); -EXTERN pid_t waitpid(pid_t pid, FAR int *stat_loc, int options); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __ASSEMBLY__ */ -#endif /* CONFIG_SCHED_WAITPID */ -#endif /* __INCLUDE_SYS_WAIT_H */ diff --git a/nuttx/include/syscall.h b/nuttx/include/syscall.h deleted file mode 100644 index ae888e9c2..000000000 --- a/nuttx/include/syscall.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** - * include/syscall.h - * - * Copyright (C) 2011-2012 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_SYSCALL_H -#define __INCLUDE_SYSCALL_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ -/* This is just a wrapper around sys/syscall.h and arch/syscall.h */ - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_SYSCALL_H */ diff --git a/nuttx/include/syslog.h b/nuttx/include/syslog.h deleted file mode 100644 index cfb2db97b..000000000 --- a/nuttx/include/syslog.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** - * include/syslog.h - * - * Copyright (C) 2013 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_SYSLOG_H -#define __INCLUDE_SYSLOG_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Type Declarations - ****************************************************************************/ - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/* These low-level debug APIs are provided by the NuttX library. These are - * normally accessed via the macros in debug.h. If the cross-compiler's - * C pre-processor supports a variable number of macro arguments, then those - * macros below will map all debug statements to one or the other of the - * following. - */ - -int syslog(FAR const char *format, ...); -int vsyslog(const char *src, va_list ap); - -#ifdef CONFIG_ARCH_LOWPUTC -int lowsyslog(FAR const char *format, ...); -int lowvsyslog(const char *src, va_list ap); -#endif - -/* Enable or disable syslog output */ - -#ifdef CONFIG_SYSLOG_ENABLE -void syslog_enable(bool enable); -#endif - -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_SYSLOG_H */ diff --git a/nuttx/include/termios.h b/nuttx/include/termios.h deleted file mode 100644 index 3032e4746..000000000 --- a/nuttx/include/termios.h +++ /dev/null @@ -1,304 +0,0 @@ -/**************************************************************************** - * include/termios.h - * - * Copyright (C) 2011-2012 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_TERMIOS_H -#define __INCLUDE_TERMIOS_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include -#include - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/* Terminal input modes (c_iflag in the termios structure) */ - -#define BRKINT (1 << 0) /* Bit 0: Signal interrupt on break */ -#define ICRNL (1 << 1) /* Bit 1: Map CR to NL on input */ -#define IGNBRK (1 << 2) /* Bit 2: Ignore break condition */ -#define IGNCR (1 << 3) /* Bit 3: Ignore CR */ -#define IGNPAR (1 << 4) /* Bit 4: Ignore characters with parity errors */ -#define INLCR (1 << 5) /* Bit 5: Map NL to CR on input */ -#define INPCK (1 << 6) /* Bit 6: Enable input parity check */ -#define ISTRIP (1 << 7) /* Bit 7: Strip character */ - /* Bit 8: unused */ -#define IXANY (1 << 9) /* Bit 9: Enable any character to restart output */ -#define IXOFF (1 << 10) /* Bit 10: Enable start/stop input control */ -#define IXON (1 << 11) /* Bit 11: Enable start/stop output control */ -#define PARMRK (1 << 12) /* Bit 12: Mark parity errors */ - -/* Terminal output modes (c_oflag in the termios structure) */ - -#define OPOST (1 << 0) /* Bit 0: Post-process output */ - /* Bit 1: unused */ -#define ONLCR (1 << 2) /* Bit 2: Map NL to CR-NL on output */ -#define OCRNL (1 << 3) /* Bit 3: Map CR to NL on output */ -#define ONOCR (1 << 4) /* Bit 4: No CR output at column 0 */ -#define ONLRET (1 << 5) /* Bit 5: NL performs CR function */ -#define OFILL (1 << 6) /* Bit 6: Use fill characters for delay */ -#define NLDLY (1 << 7) /* Bit 7: Select newline delays: */ -# define NL0 (0 << 7) /* Newline character type 0 */ -# define NL1 (1 << 7) /* Newline character type 1 */ -#define CRDLY (3 << 8) /* Bits 8-9: Select carriage-return delays: */ -# define CR0 (0 << 8) /* Carriage-return delay type 0 */ -# define CR1 (1 << 8) /* Carriage-return delay type 1 */ -# define CR2 (2 << 8) /* Carriage-return delay type 2 */ -# define CR3 (3 << 8) /* Carriage-return delay type 3 */ -#define TABDLY (3 << 10) /* Bit 10-11: Select horizontal-tab delays: */ -# define TAB0 (0 << 10) /* Horizontal-tab delay type 0 */ -# define TAB1 (1 << 10) /* Horizontal-tab delay type 1 */ -# define TAB2 (2 << 10) /* Horizontal-tab delay type 2 */ -# define TAB3 (3 << 10) /* Expand tabs to spaces */ -#define BSDLY (1 << 12) /* Bit 12: Select backspace delays: */ -# define BS0 (0 << 12) /* Backspace-delay type 0 */ -# define BS1 (1 << 12) /* Backspace-delay type 1 */ -#define VTDLY (1 << 13) /* Bit 13: Select vertical-tab delays: */ -# define VT0 (0 << 13) /* Vertical-tab delay type 0 */ -# define VT1 (1 << 13) /* Vertical-tab delay type 1 */ -#define FFDLY (1 << 14) /* Bit 14: Select form-feed delays: */ -# define FF0 (0 << 14) /* Form-feed delay type 0 */ -# define FF1 (1 << 14) /* Form-feed delay type 1 */ - -/* Control Modes (c_cflag in the termios structure) */ - -#define CSIZE (3 << 0) /* Bits 0-1: Character size: */ -# define CS5 (0 << 0) /* 5 bits */ -# define CS6 (1 << 0) /* 6 bits */ -# define CS7 (2 << 0) /* 7 bits */ -# define CS8 (3 << 0) /* 8 bits */ -#define CSTOPB (1 << 2) /* Bit 2: Send two stop bits, else one */ -#define CREAD (1 << 3) /* Bit 3: Enable receiver */ -#define PARENB (1 << 4) /* Bit 4: Parity enable */ -#define PARODD (1 << 5) /* Bit 5: Odd parity, else even */ -#define HUPCL (1 << 6) /* Bit 6: Hang up on last close */ -#define CLOCAL (1 << 7) /* Bit 7: Ignore modem status lines */ -#define CCTS_OFLOW (1 << 8) /* Bit 8: CTS flow control of output */ -#define CRTSCTS CCTS_OFLOW -#define CRTS_IFLOW (1 << 9) /* Bit 9: RTS flow control of input */ - -/* Local Modes (c_lflag in the termios structure) */ - -#define ECHO (1 << 0) /* Bit 0: Enable echo */ -#define ECHOE (1 << 1) /* Bit 1: Echo erase character as error-correcting backspace */ -#define ECHOK (1 << 2) /* Bit 2: Echo KILL */ -#define ECHONL (1 << 3) /* Bit 3: Echo NL */ -#define ICANON (1 << 4) /* Bit 4: Canonical input (erase and kill processing) */ -#define IEXTEN (1 << 5) /* Bit 5: Enable extended input character processing */ -#define ISIG (1 << 6) /* Bit 6: Enable signals */ -#define NOFLSH (1 << 7) /* Bit 7: Disable flush after interrupt or quit */ -#define TOSTOP (1 << 8) /* Bit 8: Send SIGTTOU for background output */ - -/* The following are subscript names for the termios c_cc array */ - -#define VEOF 0 /* Bit 0: EOF character (canonical mode) */ -#define VMIN VEOF /* Bit 0: MIN value (Non-canonical mode) */ -#define VEOL 1 /* Bit 1: EOL character (canonical mode) */ -#define VTIME VEOL /* Bit 1: TIME value (Non-canonical mode) */ -#define VERASE 2 /* Bit 2: ERASE character (canonical mode) */ -#define VINTR 3 /* Bit 3: INTR character */ -#define VKILL 4 /* Bit 4: KILL character (canonical mode) */ -#define VQUIT 5 /* Bit 5: QUIT character */ -#define VSTART 6 /* Bit 6: START character */ -#define VSTOP 7 /* Bit 7: STOP character */ -#define VSUSP 8 /* Bit 8: SUSP character */ -#define NCCS 9 /* Bit 9: Size of the array c_cc for control characters */ - -/* Baud Rate Selection. These are instances of type speed_t. Values of 38400 - * and below are specified by POSIX; values above 38400 are sometimes referred - * to as extended values and most values appear in most termios.h implementations. - * - * NOTE that is NuttX that the encoding of the speed_t values is simply the - * value of the baud itself. So this opens a window for non-portable abuse - * of the speed-related interfaces: The defined values should be used where- - * ever possible for reasons of portability. - */ - -#define B0 0 /* Hang up */ -#define B50 50 /* 50 baud */ -#define B75 75 /* 75 baud */ -#define B110 110 /* 110 baud */ -#define B134 134 /* 134.5 baud */ -#define B150 150 /* 150 baud */ -#define B200 200 /* 200 baud */ -#define B300 300 /* 300 baud */ -#define B600 600 /* 600 baud */ -#define B1200 1200 /* 1,200 baud */ -#define B1800 1800 /* 1,800 baud */ -#define B2400 2400 /* 2,400 baud */ -#define B4800 4800 /* 4,800 baud */ -#define B9600 9600 /* 9,600 baud */ -#define B19200 19200 /* 19,200 baud */ -#define B38400 38400 /* 38,400 baud */ - -#define B57600 57600 /* 57,600 baud */ -#define B115200 115200 /* 115,200 baud */ -#define B128000 128000 /* 128,000 baud */ -#define B230400 230400 /* 230,400 baud */ -#define B256000 256000 /* 256,000 baud */ -#define B460800 460800 /* 460,800 baud */ -#define B500000 500000 /* 500,000 baud */ -#define B576000 576000 /* 576,000 baud */ -#define B921600 921600 /* 921,600 baud */ -#define B1000000 1000000 /* 1,000,000 baud */ -#define B1152000 1152000 /* 1,152,000 baud */ -#define B1500000 1500000 /* 1,500,000 baud */ -#define B2000000 2000000 /* 2,000,000 baud */ -#define B2500000 2500000 /* 2,500,000 baud */ -#define B3000000 3000000 /* 3,000,000 baud */ - -/* Attribute Selection (used with tcsetattr()) */ - -#define TCSANOW 0 /* Change attributes immediately */ -#define TCSADRAIN 1 /* Change attributes when output has drained */ -#define TCSAFLUSH 2 /* Change attributes when output has drained; also flush pending input */ - -/* Line Control (used with tcflush()) */ - -#define TCIFLUSH 0 /* Flush pending input. Flush untransmitted output */ -#define TCIOFLUSH 1 /* Flush both pending input and untransmitted output */ -#define TCOFLUSH 2 /* Flush untransmitted output */ - -/* Constants for use with tcflow() */ - -#define TCIOFF 0 /* Transmit a STOP character, intended to suspend input data */ -#define TCION 1 /* Transmit a START character, intended to restart input data */ -#define TCOOFF 2 /* Suspend output */ -#define TCOON 3 /* Restart output */ - -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/* Baud rate selection */ - -typedef uint32_t speed_t; /* Used for terminal baud rates */ - -/* Types used within the termios structure */ - -typedef uint16_t tcflag_t; /* Used for terminal modes */ -typedef int cc_t; /* Used for terminal special characters */ - -/* The termios structure */ - -struct termios -{ - /* Exposed fields defined by POSIX */ - - tcflag_t c_iflag; /* Input modes */ - tcflag_t c_oflag; /* Output modes */ - tcflag_t c_cflag; /* Control modes */ - tcflag_t c_lflag; /* Local modes */ - cc_t c_cc[NCCS]; /* Control chars */ - - /* Implementation specific fields. For portability reasons, these fields - * should not be accessed directly, but rather through only through the - * cf[set|get][o|i]speed() POSIX interfaces. - */ - - speed_t c_speed; /* Input/output speed (non-POSIX)*/ -}; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/* The cfgetspeed() function is a non-POSIX function will extract the baud - * from the termios structure to which the termiosp argument points. NuttX - * does not control input/output baud independently. Both must be the same. - * The POSIX standard interfaces, cfigetispeed() and cfigetospeed() are - * supported by simply defining them to be cfgetspeed(). - */ - -EXTERN speed_t cfgetspeed(FAR const struct termios *termiosp); -#define cfgetispeed(termiosp) cfgetspeed(termiosp) -#define cfgetospeed(termiosp) cfgetspeed(termiosp) - -/* The cfsetspeed() function is a non-POSIX function that sets the baud - * stored in the structure pointed to by termiosp to speed. NuttX does - * not control input/output baud independently. Both must be the same. - * The POSIX standard interfaces, cfigetispeed() and cfigetospeed() are - * supported by simply defining them to be cfsetspeed(). - */ - -EXTERN int cfsetspeed(FAR struct termios *termiosp, speed_t speed); -#define cfsetispeed(termiosp,speed) cfsetspeed(termiosp,speed) -#define cfsetospeed(termiosp,speed) cfsetspeed(termiosp,speed) - -/* Wait for transmission of output */ - -EXTERN int tcdrain(int fd); - -/* Suspend or restart the transmission or reception of data */ - -EXTERN int tcflow(int fd, int action); - -/* Flush non-transmitted output data, non-read input data or both */ - -EXTERN int tcflush(int fd, int cmd); - -/* Get the parameters associated with the terminal */ - -EXTERN int tcgetattr(int fd, FAR struct termios *termiosp); - -/* Get process group ID for session leader for controlling terminal */ - -EXTERN pid_t tcgetsid(int fd); - -/* Send a "break" for a specific duration */ - -EXTERN int tcsendbreak(int fd, int duration); - -/* Set the parameters associated with the terminal */ - -EXTERN int tcsetattr(int fd, int options, FAR const struct termios *termiosp); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_TERMIOS_H */ diff --git a/nuttx/include/time.h b/nuttx/include/time.h deleted file mode 100644 index 623f9afb2..000000000 --- a/nuttx/include/time.h +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************** - * include/time.h - * - * 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. - * - ********************************************************************************/ - -#ifndef __INCLUDE_TIME_H -#define __INCLUDE_TIME_H - -/******************************************************************************** - * Included Files - ********************************************************************************/ - -#include - -#include -#include - -/******************************************************************************** - * Pre-processor Definitions - ********************************************************************************/ - -/* Clock tick of the system (frequency Hz). - * - * NOTE: This symbolic name CLK_TCK has been removed from the standard. It is - * replaced with CLOCKS_PER_SEC. Both are defined here. - * - * The default value is 100Hz, but this default setting can be overridden by - * defining the clock interval in milliseconds as CONFIG_MSEC_PER_TICK in the - * board configuration file. - */ - -#ifdef CONFIG_MSEC_PER_TICK -# define CLK_TCK (1000/CONFIG_MSEC_PER_TICK) -# define CLOCKS_PER_SEC (1000/CONFIG_MSEC_PER_TICK) -#else -# define CLK_TCK (100) -# define CLOCKS_PER_SEC (100) -#endif - -/* CLOCK_REALTIME refers to the standard time source. For most implementations, - * the standard time source is the system timer interrupt. However, if the - * platform supports an RTC, then the standard time source will be the RTC - * for the clock_gettime() and clock_settime() interfaces (the system timer - * is still the time source for all of the interfaces). - */ - -#define CLOCK_REALTIME 0 - -/* If an RTC is supported, then the non-standard CLOCK_ACTIVETIME is also - * supported to manage time based on the system timer interrupt separately from - * the RTC. This may be necessary, for example, in certain cases where the - * system timer interrupt has been stopped in low power modes. - * - * CLOCK_ACTIVETIME is only recognized by clock_gettime() and clock_settime(). - */ - -#ifdef CONFIG_RTC -# define CLOCK_ACTIVETIME 1 -#else -# define CLOCK_ACTIVETIME CLOCK_REALTIME -#endif - -/* This is a flag that may be passed to the timer_settime() function */ - -#define TIMER_ABSTIME 1 - -/* Local time is the same as gmtime in this implementation */ - -#define localtime(c) gmtime(c) -#define localtime_r(c,r) gmtime_r(c,r) - -/******************************************************************************** - * Global Type Declarations - ********************************************************************************/ - -typedef uint32_t time_t; /* Holds time in seconds */ -typedef uint8_t clockid_t; /* Identifies one time base source */ -typedef FAR void *timer_t; /* Represents one POSIX timer */ - -struct timespec -{ - time_t tv_sec; /* Seconds */ - long tv_nsec; /* Nanoseconds */ -}; - -struct timeval -{ - time_t tv_sec; /* Seconds */ - long tv_usec; /* Microseconds */ -}; - -struct tm -{ - int tm_sec; /* second (0-61, allows for leap seconds) */ - int tm_min; /* minute (0-59) */ - int tm_hour; /* hour (0-23) */ - int tm_mday; /* day of the month (1-31) */ - int tm_mon; /* month (0-11) */ - int tm_year; /* years since 1900 */ -#if 0 /* not supported */ - int tm_wday; /* day of the week (0-6) */ - int tm_yday; /* day of the year (0-365) */ - int tm_isdst; /* non-0 if daylight savings time is in effect */ -#endif -}; - -/* Struct itimerspec is used to define settings for an interval timer */ - -struct itimerspec -{ - struct timespec it_value; /* First time */ - struct timespec it_interval; /* and thereafter */ -}; - -/* forward reference (defined in signal.h) */ - -struct sigevent; - -/******************************************************************************** - * Global Variables - ********************************************************************************/ - -/* extern char *tznames[]; not supported */ - -/******************************************************************************** - * Global Function Prototypes - ********************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -EXTERN clock_t clock(void); - -EXTERN int clock_settime(clockid_t clockid, const struct timespec *tp); -EXTERN int clock_gettime(clockid_t clockid, struct timespec *tp); -EXTERN int clock_getres(clockid_t clockid, struct timespec *res); - -EXTERN time_t mktime(const struct tm *tp); -EXTERN FAR struct tm *gmtime(FAR const time_t *timer); -EXTERN FAR struct tm *gmtime_r(FAR const time_t *timer, FAR struct tm *result); -EXTERN size_t strftime(char *s, size_t max, const char *format, const struct tm *tm); - -EXTERN time_t time(time_t *tloc); - -EXTERN int timer_create(clockid_t clockid, FAR struct sigevent *evp, FAR timer_t *timerid); -EXTERN int timer_delete(timer_t timerid); -EXTERN int timer_settime(timer_t timerid, int flags, FAR const struct itimerspec *value, - FAR struct itimerspec *ovalue); -EXTERN int timer_gettime(timer_t timerid, FAR struct itimerspec *value); -EXTERN int timer_getoverrun(timer_t timerid); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_TIME_H */ diff --git a/nuttx/include/unistd.h b/nuttx/include/unistd.h deleted file mode 100644 index 46eb14cdd..000000000 --- a/nuttx/include/unistd.h +++ /dev/null @@ -1,194 +0,0 @@ -/**************************************************************************** - * include/unistd.h - * - * Copyright (C) 2007-2009, 2013 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_UNISTD_H -#define __INCLUDE_UNISTD_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* The number of functions that may be registerd to be called - * at program exit. - */ - -#define ATEXIT_MAX 1 - -/* Values for seeking */ - -#define SEEK_SET 0 /* From the start of the file */ -#define SEEK_CUR 1 /* From the current file offset */ -#define SEEK_END 2 /* From the end of the file */ - -/* Bit values for the second argument to access */ - -#define F_OK 0 /* Test existence */ -#define R_OK 1 /* Test read permission */ -#define W_OK 2 /* Test write permission */ -#define X_OK 4 /* Test execute permission */ - -/* POSIX feature set macros */ - -#define POSIX_VERSION -#undef _POSIX_SAVED_IDS -#undef _POSIX_JOB_CONTROL -#define _POSIX_REALTIME_SIGNALS 1 -#define _POSIX_MESSAGE_PASSING 1 -#undef _POSIX_MAPPED_FILES -#undef _POSIX_SHARED_MEMORY_OBJECTS -#define _POSIX_PRIORITY_SCHEDULING 1 -#define _POSIX_TIMERS -#undef _POSIX_MEMLOCK -#undef _POSIX_MEMLOCK_RANGE -#undef _POSIX_FSYNC -#define _POSIX_SYNCHRONIZED_IO -#undef _POSIX_ASYNCHRONOUS_IO -#undef _POSIX_PRIORITIZED_IO - -/* Execution time constants (not supported) */ - -#undef _POSIX_CHOWN_RESTRICTED -#undef _POSIX_NO_TRUNC -#undef _POSIX_VDISABLE - -#define _POSIX_SYNC_IO -#undef _POSIX_ASYNC_IO -#undef _POSIX_PRIO_IO - -#define fdatasync(f) fsync(f) - -/**************************************************************************** - * Global Variables - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/* Used by getopt (obviously NOT thread safe!). These variables cannot be - * accessed directly by an external NXFLAT module. In that case, accessor - * functions must be used. - */ - -#ifndef __NXFLAT__ -EXTERN FAR char *optarg; /* Optional argument following option */ -EXTERN int optind; /* Index into argv */ -EXTERN int optopt; /* unrecognized option character */ -#else -# define optarg (*(getoptargp())) -# define optind (*(getopindgp())) -# define optopt (*(getoptoptp())) -#endif - -/**************************************************************************** - * Global Function Prototypes - ****************************************************************************/ - -/* Task Control Interfaces */ - -EXTERN pid_t vfork(void); -EXTERN pid_t getpid(void); -EXTERN void _exit(int status) noreturn_function; -EXTERN unsigned int sleep(unsigned int seconds); -EXTERN int usleep(useconds_t usec); -EXTERN int pause(void); - -/* File descriptor operations */ - -EXTERN int close(int fd); -EXTERN int dup(int fd); -EXTERN int dup2(int fd1, int fd2); -EXTERN int fsync(int fd); -EXTERN off_t lseek(int fd, off_t offset, int whence); -EXTERN ssize_t read(int fd, FAR void *buf, size_t nbytes); -EXTERN ssize_t write(int fd, FAR const void *buf, size_t nbytes); - -/* Special devices */ - -EXTERN int pipe(int filedes[2]); - -/* Working directory operations */ - -EXTERN int chdir(FAR const char *path); -EXTERN FAR char *getcwd(FAR char *buf, size_t size); - -/* File path operations */ - -EXTERN int unlink(FAR const char *pathname); -EXTERN int rmdir(FAR const char *pathname); - -/* Execution of programs from files */ - -#ifdef CONFIG_LIBC_EXECFUNCS -EXTERN int execl(FAR const char *path, ...); -EXTERN int execv(FAR const char *path, FAR char *const argv[]); - -/* Non-standard functions to manage symbol tables */ - -struct symtab_s; /* See include/nuttx/binfmt/symtab.h */ -EXTERN void exec_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols); -EXTERN void exec_setsymtab(FAR const struct symtab_s *symtab, int nsymbols); -#endif - -/* Other */ - -EXTERN int getopt(int argc, FAR char *const argv[], FAR const char *optstring); - -/* Accessor functions intended for use only by external NXFLAT - * modules. The global variables optarg, optind, and optopt cannot - * be referenced directly from external modules. - */ - -EXTERN FAR char **getoptargp(void); /* Optional argument following option */ -EXTERN int *getopindgp(void); /* Index into argv */ -EXTERN int *getoptoptp(void); /* unrecognized option character */ - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_UNISTD_H */ diff --git a/nuttx/include/wdog.h b/nuttx/include/wdog.h deleted file mode 100644 index 3179c06a4..000000000 --- a/nuttx/include/wdog.h +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** - * include/wdog.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 __INCLUDE_WDOG_H -#define __INCLUDE_WDOG_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Global Type Declarations - ****************************************************************************/ - -/* The arguments are passed as uint32_t values. For systems where the - * sizeof(pointer) < sizeof(uint32_t), the following union defines the - * alignment of the pointer within the uint32_t. For example, the SDCC - * MCS51 general pointer is 24-bits, but uint32_t is 32-bits (of course). - * - * For systems where sizeof(pointer) > sizeof(uint32_t), we will have to do - * some redesign. - */ - -union wdparm_u -{ - FAR void *pvarg; - FAR uint32_t *dwarg; -}; - -typedef union wdparm_u wdparm_t; - -/* This is the form of the function that is called when the - * watchdog function expires. Up to four parameters may be passed. - */ - -typedef CODE void (*wdentry_t)(int argc, uint32_t arg1, ...); - -/* Watchdog 'handle' */ - -typedef FAR struct wdog_s *WDOG_ID; - -/**************************************************************************** - * Global Variables - ****************************************************************************/ - -/**************************************************************************** - * Global Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -EXTERN WDOG_ID wd_create(void); -EXTERN int wd_delete(WDOG_ID wdog); -EXTERN int wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry, int argc, ...); -EXTERN int wd_cancel(WDOG_ID wdog); -EXTERN int wd_gettime(WDOG_ID wdog); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* _WDOG_H_ */ -- cgit v1.2.3